summaryrefslogtreecommitdiffhomepage
path: root/src/driver
diff options
context:
space:
mode:
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/sfrt_driver_ctx.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/driver/sfrt_driver_ctx.c b/src/driver/sfrt_driver_ctx.c
index 67834c0..bec02f6 100644
--- a/src/driver/sfrt_driver_ctx.c
+++ b/src/driver/sfrt_driver_ctx.c
@@ -85,25 +85,21 @@ int sfrt_get_driver_ctx(
struct sfrt_driver_ctx ** pctx)
{
struct sfrt_driver_ctx_impl * ctx;
+ struct sfrt_common_ctx cctx;
const struct argv_option * options;
struct argv_meta * meta;
struct argv_entry * entry;
size_t nunits;
- uint64_t dflags;
- uint64_t aflags;
const char * program;
- const char * astring; /* dummy */
options = sfrt_default_options;
if (!(meta = argv_get(argv,options,sfrt_argv_flags(flags))))
return -1;
- dflags = 0;
- aflags = 0;
nunits = 0;
- astring = 0; /* dummy */
program = argv_program_name(argv[0]);
+ memset(&cctx,0,sizeof(cctx));
if (!argv[1] && (flags & SFRT_DRIVER_VERBOSITY_USAGE))
return sfrt_driver_usage(program,0,options,meta);
@@ -117,18 +113,18 @@ int sfrt_get_driver_ctx(
return sfrt_driver_usage(program,entry->arg,options,meta);
case TAG_VERSION:
- dflags |= SFRT_DRIVER_VERSION;
+ cctx.drvflags |= SFRT_DRIVER_VERSION;
break;
/* dummy */
/* dummy */ case TAG_OUTPUT_DUMMY:
-/* dummy */ astring = entry->arg;
+/* dummy */ cctx.anystring = entry->arg;
/* dummy */ break;
/* dummy */
/* dummy */ case TAG_OUTPUT_PROPERTY:
/* dummy */ if (!(strcmp(entry->arg,"name")))
-/* dummy */ aflags |= SFRT_OUTPUT_NAME;
+/* dummy */ cctx.actflags |= SFRT_OUTPUT_NAME;
/* dummy */ else if (!(strcmp(entry->arg,"address")))
-/* dummy */ aflags |= SFRT_OUTPUT_ADDRESS;
+/* dummy */ cctx.actflags |= SFRT_OUTPUT_ADDRESS;
/* dummy */ break;
}
} else
@@ -139,12 +135,9 @@ int sfrt_get_driver_ctx(
return sfrt_get_driver_ctx_fail(meta);
ctx->ctx.program = program;
- ctx->cctx.drvflags = dflags;
- ctx->cctx.actflags = aflags;
- ctx->cctx.anystring = astring; /* dummy */
-
ctx->ctx.cctx = &ctx->cctx;
+ memcpy(&ctx->cctx,&cctx,sizeof(cctx));
*pctx = &ctx->ctx;
return SFRT_OK;
}