Files
nshmyrev 2a4e599258 Properly free array list arguments
git-svn-id: svn+ssh://svn.code.sf.net/p/cmusphinx/code/trunk/sphinxbase@11445 94700074-3cef-4d97-a70e-9c8c206c02f5
2012-07-01 12:05:02 +00:00

32 lines
831 B
C

/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
#include <stdio.h>
#include <string.h>
#include "cmd_ln.h"
#include "ckd_alloc.h"
const arg_t defs[] = {
{ "-a", ARG_INT32, "42", "This is the first argument." },
{ "-b", ARG_STRING, NULL, "This is the second argument." },
{ "-c", ARG_BOOLEAN, "no", "This is the third argument." },
{ "-d", ARG_FLOAT64, "1e-50", "This is the fourth argument." },
{ "-l", ARG_STRING_LIST, NULL, "This is the fifth argument." },
{ NULL, 0, NULL, NULL }
};
int
main(int argc, char *argv[])
{
cmd_ln_parse(defs, argc, argv, TRUE);
printf("%d %s %d %f\n",
cmd_ln_int32("-a"),
cmd_ln_str("-b") ? cmd_ln_str("-b") : "(null)",
cmd_ln_boolean("-c"),
cmd_ln_float64("-d"));
cmd_ln_free();
return 0;
}