summaryrefslogtreecommitdiffhomepage
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-12-25 19:13:13 -0500
committermidipix <writeonce@midipix.org>2016-12-25 19:13:13 -0500
commitcfa4ad8d5778a0504397f7f1c14b9a384138ba94 (patch)
treebc6428517388feaf822a108ea0bbc8bf9c6a013b /src/driver
parent105a7a006b33bbaec9f674cba2f0ed3463218869 (diff)
downloadperk-cfa4ad8d5778a0504397f7f1c14b9a384138ba94.tar.bz2
perk-cfa4ad8d5778a0504397f7f1c14b9a384138ba94.tar.xz
argv.h: use an option vector rather than a direct pointer to the option table.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/pe_driver_ctx.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c
index b0135e9..31cb262 100644
--- a/src/driver/pe_driver_ctx.c
+++ b/src/driver/pe_driver_ctx.c
@@ -50,7 +50,7 @@ static uint32_t pe_argv_flags(uint32_t flags)
static int pe_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];
@@ -59,7 +59,7 @@ static int pe_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 PERK_USAGE;
@@ -115,7 +115,7 @@ int pe_get_driver_ctx(
{
struct pe_driver_ctx_impl * ctx;
struct pe_common_ctx cctx;
- const struct argv_option * options;
+ const struct argv_option * optv[PERK_OPTV_ELEMENTS];
struct argv_meta * meta;
struct argv_entry * entry;
size_t nunits;
@@ -124,9 +124,9 @@ int pe_get_driver_ctx(
(void)envp;
- options = pe_default_options;
+ argv_optv_init(pe_default_options,optv);
- if (!(meta = argv_get(argv,options,pe_argv_flags(flags))))
+ if (!(meta = argv_get(argv,optv,pe_argv_flags(flags))))
return -1;
pretty = 0;
@@ -136,7 +136,7 @@ int pe_get_driver_ctx(
cctx.drvflags = flags;
if (!argv[1] && (flags & PERK_DRIVER_VERBOSITY_USAGE))
- return pe_driver_usage(program,0,options,meta);
+ return pe_driver_usage(program,0,optv,meta);
/* get options, count units */
for (entry=meta->entries; entry->fopt || entry->arg; entry++) {
@@ -144,7 +144,7 @@ int pe_get_driver_ctx(
switch (entry->tag) {
case TAG_HELP:
if (flags & PERK_DRIVER_VERBOSITY_USAGE)
- return pe_driver_usage(program,entry->arg,options,meta);
+ return pe_driver_usage(program,entry->arg,optv,meta);
case TAG_VERSION:
cctx.drvflags |= PERK_DRIVER_VERSION;