summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/sfrt_driver_ctx.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/driver/sfrt_driver_ctx.c b/src/driver/sfrt_driver_ctx.c
index d065474..58cccd7 100644
--- a/src/driver/sfrt_driver_ctx.c
+++ b/src/driver/sfrt_driver_ctx.c
@@ -43,7 +43,7 @@ static uint32_t sfrt_argv_flags(uint32_t flags)
static int sfrt_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];
@@ -52,7 +52,7 @@ static int sfrt_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 SFRT_USAGE;
@@ -107,7 +107,7 @@ int sfrt_get_driver_ctx(
{
struct sfrt_driver_ctx_impl * ctx;
struct sfrt_common_ctx cctx;
- const struct argv_option * options;
+ const struct argv_option * optv[SFRT_OPTV_ELEMENTS];
struct argv_meta * meta;
struct argv_entry * entry;
size_t nunits;
@@ -115,9 +115,9 @@ int sfrt_get_driver_ctx(
(void)envp;
- options = sfrt_default_options;
+ argv_optv_init(sfrt_default_options,optv);
- if (!(meta = argv_get(argv,options,sfrt_argv_flags(flags))))
+ if (!(meta = argv_get(argv,optv,sfrt_argv_flags(flags))))
return -1;
nunits = 0;
@@ -126,7 +126,7 @@ int sfrt_get_driver_ctx(
cctx.drvflags = flags;
if (!argv[1] && (flags & SFRT_DRIVER_VERBOSITY_USAGE))
- return sfrt_driver_usage(program,0,options,meta);
+ return sfrt_driver_usage(program,0,optv,meta);
/* get options, count units */
for (entry=meta->entries; entry->fopt || entry->arg; entry++) {
@@ -134,7 +134,7 @@ int sfrt_get_driver_ctx(
switch (entry->tag) {
case TAG_HELP:
if (flags & SFRT_DRIVER_VERBOSITY_USAGE)
- return sfrt_driver_usage(program,entry->arg,options,meta);
+ return sfrt_driver_usage(program,entry->arg,optv,meta);
case TAG_VERSION:
cctx.drvflags |= SFRT_DRIVER_VERSION;
@@ -169,11 +169,14 @@ int sfrt_create_driver_ctx(
const struct sfrt_common_ctx * cctx,
struct sfrt_driver_ctx ** pctx)
{
+ const struct argv_option * optv[SFRT_OPTV_ELEMENTS];
struct argv_meta * meta;
struct sfrt_driver_ctx_impl * ctx;
char * argv[] = {"sofort_driver",0};
- if (!(meta = argv_get(argv,sfrt_default_options,0)))
+ argv_optv_init(sfrt_default_options,optv);
+
+ if (!(meta = argv_get(argv,optv,0)))
return -1;
if (!(ctx = sfrt_driver_ctx_alloc(meta,cctx,0)))