2 #include "credential.h"
3 #include "string-list.h"
4 #include "parse-options.h"
6 int main(int argc, const char **argv)
9 struct credential c = { NULL };
10 struct string_list methods = STRING_LIST_INIT_NODUP;
11 const char *const usage[] = {
12 "test-credential [options] [method...]",
15 struct option options[] = {
16 OPT_BOOLEAN(0, "reject", &reject, "reject"),
17 OPT_STRING(0, "description", &c.description, "desc",
19 OPT_STRING(0, "unique", &c.unique, "token",
21 OPT_STRING(0, "username", &c.username, "name", "username"),
22 OPT_STRING(0, "password", &c.password, "pass", "password"),
27 argc = parse_options(argc, argv, NULL, options, usage, 0);
28 for (i = 0; i < argc; i++)
29 string_list_append(&methods, argv[i]);
30 /* credential_reject will try to free() */
32 c.username = xstrdup(c.username);
34 c.password = xstrdup(c.password);
37 credential_reject(&c, &methods);
39 credential_fill(&c, &methods);
42 printf("username=%s\n", c.username);
44 printf("password=%s\n", c.password);