#include <afs/cmd.h>
#include <tests/tap/basic.h>
+#include "common.h"
enum cmdOptions {
copt_flag = 0,
list = list->next;
el = va_arg(ap, char *);
}
+ va_end(ap);
if (el == NULL && list == NULL) {
ok(1, "List has correct number of elements");
initialize_CMD_error_table();
- opts = cmd_CreateSyntax(NULL, testproc, NULL, NULL);
+ opts = cmd_CreateSyntax(NULL, testproc, NULL, 0, NULL);
cmd_AddParm(opts, "-flag", CMD_FLAG, CMD_OPTIONAL, "a flag");
cmd_AddParm(opts, "-first", CMD_SINGLE, CMD_REQUIRED, "first option");
cmd_AddParm(opts, "-second", CMD_LIST, CMD_OPTIONAL, "second option");
code = cmd_ParseLine("-help", tv, &tc, 100);
is_int(0, code, "cmd_ParseLine succeeds");
code = cmd_Parse(tc, tv, &retopts);
- is_int(CMD_USAGE, code, "cmd_Parse returns usage error with help output");
+ is_int(CMD_HELP, code, "cmd_Parse returns help indicator with help output");
ok(retopts == NULL, " ... and options is empty");
/* Check splitting with '=' */
cmd_FreeArgv(tv);
/* Now, try adding a configuration file into the mix */
- if (getenv("SOURCE") == NULL)
- path = strdup("test1.conf");
- else
- asprintf(&path, "%s/cmd/test1.conf", getenv("SOURCE"));
-
+ path = afstest_src_path("tests/cmd/test1.conf");
cmd_SetCommandName("test");
code = cmd_OpenConfigFile(path);
is_int(0, code, "cmd_OpenConfigFile succeeds");