summaryrefslogtreecommitdiff
path: root/src/driver/amgc_driver_ctx.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/driver/amgc_driver_ctx.c')
-rw-r--r--src/driver/amgc_driver_ctx.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/driver/amgc_driver_ctx.c b/src/driver/amgc_driver_ctx.c
index d287008..e5b218e 100644
--- a/src/driver/amgc_driver_ctx.c
+++ b/src/driver/amgc_driver_ctx.c
@@ -61,7 +61,7 @@ static uint32_t amgc_argv_flags(uint32_t flags)
static int amgc_driver_usage(
const char * program,
const char * arg,
- const struct argv_option * options,
+ const struct argv_option ** optv,
struct argv_meta * meta)
{
char header[512];
@@ -70,7 +70,7 @@ static int amgc_driver_usage(
"Usage: %s [options] <file>...\n" "Options:\n",
program);
- argv_usage(stdout,header,options,arg);
+ argv_usage(stdout,header,optv,arg);
argv_free(meta);
return AMGC_USAGE;
@@ -151,7 +151,7 @@ int amgc_get_driver_ctx(
{
struct amgc_driver_ctx_impl * ctx;
struct amgc_common_ctx cctx;
- const struct argv_option * options;
+ const struct argv_option * optv[AMGC_OPTV_ELEMENTS];
struct argv_meta * meta;
struct argv_entry * entry;
size_t nunits;
@@ -160,9 +160,9 @@ int amgc_get_driver_ctx(
(void)envp;
- options = amgc_default_options;
+ argv_optv_init(amgc_default_options,optv);
- if (!(meta = argv_get(argv,options,amgc_argv_flags(flags))))
+ if (!(meta = argv_get(argv,optv,amgc_argv_flags(flags))))
return -1;
nunits = 0;
@@ -172,7 +172,7 @@ int amgc_get_driver_ctx(
cctx.drvflags = flags;
if (!argv[1] && (flags & AMGC_DRIVER_VERBOSITY_USAGE))
- return amgc_driver_usage(program,0,options,meta);
+ return amgc_driver_usage(program,0,optv,meta);
/* compiler defaults */
cctx.std = STANDARD_C99;
@@ -183,7 +183,7 @@ int amgc_get_driver_ctx(
switch (entry->tag) {
case TAG_HELP:
if (flags & AMGC_DRIVER_VERBOSITY_USAGE)
- return amgc_driver_usage(program,entry->arg,options,meta);
+ return amgc_driver_usage(program,entry->arg,optv,meta);
case TAG_VERSION:
cctx.drvflags |= AMGC_DRIVER_VERSION;
@@ -253,11 +253,14 @@ int amgc_create_driver_ctx(
const struct amgc_common_ctx * cctx,
struct amgc_driver_ctx ** pctx)
{
+ const struct argv_option * optv[AMGC_OPTV_ELEMENTS];
struct argv_meta * meta;
struct amgc_driver_ctx_impl * ctx;
char * argv[] = {"apimagic_driver",0};
- if (!(meta = argv_get(argv,amgc_default_options,0)))
+ argv_optv_init(amgc_default_options,optv);
+
+ if (!(meta = argv_get(argv,optv,0)))
return -1;
if (!(ctx = amgc_driver_ctx_alloc(meta,cctx,0,0)))