GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
- Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
- copyright (c) by Bruce Korb - all rights reserved
+ Copyright (C) by Bruce Korb - all rights reserved
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
- <program> copyright (c) by Bruce Korb - all rights reserved
+ <program> Copyright (C) by Bruce Korb - all rights reserved
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
- Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
endif
libopts_la_SOURCES = libopts.c
libopts_la_CPPFLAGS = -I$(top_srcdir)
-libopts_la_LDFLAGS = -version-info 37:0:12
+libopts_la_LDFLAGS = -version-info 37:1:12
EXTRA_DIST = \
COPYING.gplv3 COPYING.lgplv3 COPYING.mbsd \
MakeDefs.inc README ag-char-map.h \
autoopts/options.h autoopts/usage-txt.h autoopts/project.h \
autoopts.c autoopts.h boolean.c \
check.c compat/pathfind.c compat/snprintf.c \
- compat/strchr.c compat/windows-config.h compat/compat.h \
- compat/strdup.c configfile.c cook.c \
+ compat/strchr.c compat/windows-config.h compat/strdup.c \
+ compat/compat.h configfile.c cook.c \
enum.c env.c file.c \
find.c genshell.c genshell.h \
gettext.h init.c load.c \
LICENSING:
-This material is Copyright (c) 1992-2012 by Bruce Korb. You are
+This material is Copyright (C) 1992-2013 by Bruce Korb. You are
licensed to use this under the terms of either the GNU Lesser General
Public License (see: COPYING.lgpl), or, at your option, the modified
Berkeley Software Distribution License (see: COPYING.mbsd). Both of
/*
* 29 bits for 46 character classifications
- * generated by char-mapper on 12/27/12 at 12:58:59
+ * generated by char-mapper on 01/04/13 at 16:15:42
*
* This file contains the character classifications
* used by AutoGen and AutoOpts for identifying tokens.
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* DO NOT EDIT THIS FILE (ao-strs.c)
*
- * It has been AutoGen-ed December 27, 2012 at 12:58:59 PM by AutoGen 5.17.0pre12
+ * It has been AutoGen-ed January 4, 2013 at 04:15:42 PM by AutoGen 5.17.1pre14
* From the definitions ao-strs.def
* and the template file strings
*
*
* DO NOT EDIT THIS FILE (ao-strs.h)
*
- * It has been AutoGen-ed December 27, 2012 at 12:58:59 PM by AutoGen 5.17.0pre12
+ * It has been AutoGen-ed January 4, 2013 at 04:15:42 PM by AutoGen 5.17.1pre14
* From the definitions ao-strs.def
* and the template file strings
*
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
case 'x':
case 'X': /* HEX Escape */
if (IS_HEX_DIGIT_CHAR(*pzIn)) {
- char z[4], *pz = z;
+ char z[4];
+ unsigned int ct = 0;
- do *(pz++) = *(pzIn++);
- while (IS_HEX_DIGIT_CHAR(*pzIn) && (pz < z + 2));
- *pz = NUL;
+ do {
+ z[ct] = pzIn[ct];
+ if (++ct >= 2)
+ break;
+ } while (IS_HEX_DIGIT_CHAR(pzIn[ct]));
+ z[ct] = NUL;
*pRes = (char)strtoul(z, NULL, 16);
- res += (unsigned int)(pz - z);
+ return ct + 1;
}
break;
{
/*
* IF the character copied was an octal digit,
- * THEN set the output character to an octal value
+ * THEN set the output character to an octal value.
+ * The 3 octal digit result might exceed 0xFF, so check it.
*/
- char z[4], *pz = z + 1;
+ char z[4];
unsigned long val;
- z[0] = *pRes;
+ unsigned int ct = 0;
- while (IS_OCT_DIGIT_CHAR(*pzIn) && (pz < z + 3))
- *(pz++) = *(pzIn++);
- *pz = NUL;
+ z[ct++] = *--pzIn;
+ while (IS_OCT_DIGIT_CHAR(pzIn[ct])) {
+ z[ct] = pzIn[ct];
+ if (++ct >= 3)
+ break;
+ }
+
+ z[ct] = NUL;
val = strtoul(z, NULL, 8);
if (val > 0xFF)
val = 0xFF;
*pRes = (char)val;
- res = (unsigned int)(pz - z);
- break;
+ return ct;
}
- default: ;
+ default: /* quoted character is result character */;
}
return res;
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* DO NOT EDIT THIS FILE (genshell.c)
*
- * It has been AutoGen-ed December 27, 2012 at 12:59:02 PM by AutoGen 5.17.0pre12
+ * It has been AutoGen-ed January 4, 2013 at 04:15:46 PM by AutoGen 5.17.1pre14
* From the definitions genshell.def
* and the template file options
*
- * Generated from AutoOpts 37:0:12 templates.
+ * Generated from AutoOpts 37:1:12 templates.
*
* AutoOpts is a copyrighted work. This source file is not encumbered
* by AutoOpts licensing, but is provided under the licensing terms chosen
*
* DO NOT EDIT THIS FILE (genshell.h)
*
- * It has been AutoGen-ed December 27, 2012 at 12:59:02 PM by AutoGen 5.17.0pre12
+ * It has been AutoGen-ed January 4, 2013 at 04:15:46 PM by AutoGen 5.17.1pre14
* From the definitions genshell.def
* and the template file options
*
- * Generated from AutoOpts 37:0:12 templates.
+ * Generated from AutoOpts 37:1:12 templates.
*
* AutoOpts is a copyrighted work. This header file is not encumbered
* by AutoOpts licensing, but is provided under the licensing terms chosen
* tolerable version is at least as old as what was current when the header
* template was released.
*/
-#define AO_TEMPLATE_VERSION 151552
+#define AO_TEMPLATE_VERSION 151553
#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
|| (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
# error option template version mismatches autoopts/options.h header
/* Convenience header for conditional use of GNU <libintl.h>.
- Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2012 Free Software
+ Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2013 Free Software
Foundation, Inc.
This program is free software; you can redistribute it and/or modify
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* DO NOT EDIT THIS FILE (stdin.c)
*
- * It has been AutoGen-ed December 27, 2012 at 12:59:01 PM by AutoGen 5.17.0pre12
+ * It has been AutoGen-ed January 4, 2013 at 04:15:45 PM by AutoGen 5.17.1pre14
* From the definitions stdin
* and the template file str2enum
*
*
* DO NOT EDIT THIS FILE (stdin.h)
*
- * It has been AutoGen-ed December 27, 2012 at 12:59:01 PM by AutoGen 5.17.0pre12
+ * It has been AutoGen-ed January 4, 2013 at 04:15:45 PM by AutoGen 5.17.1pre14
* From the definitions stdin
* and the template file str2enum
*
*
* DO NOT EDIT THIS FILE (stdin.c)
*
- * It has been AutoGen-ed December 27, 2012 at 12:59:00 PM by AutoGen 5.17.0pre12
+ * It has been AutoGen-ed January 4, 2013 at 04:15:43 PM by AutoGen 5.17.1pre14
* From the definitions stdin
* and the template file str2enum
*
*
* DO NOT EDIT THIS FILE (stdin.h)
*
- * It has been AutoGen-ed December 27, 2012 at 12:59:00 PM by AutoGen 5.17.0pre12
+ * It has been AutoGen-ed January 4, 2013 at 04:15:43 PM by AutoGen 5.17.1pre14
* From the definitions stdin
* and the template file str2enum
*
/* Parse a time duration and return a seconds count
- Copyright (C) 2008-2012 Free Software Foundation, Inc.
+ Copyright (C) 2008-2013 Free Software Foundation, Inc.
Written by Bruce Korb <bkorb@gnu.org>, 2008.
This program is free software: you can redistribute it and/or modify
if (errno != 0)
return BAD_TIME;
- start = scale_n_add ((time_t)v, start, 60);
+ start = scale_n_add (v, start, 60);
if (errno != 0)
return BAD_TIME;
return base;
errno = 0;
- val = (time_t)str_const_to_ul (pz, &pz, 10);
+ val = str_const_to_ul (pz, &pz, 10);
if (errno != 0)
return BAD_TIME;
while (isspace ((unsigned char)*pz))
break;
}
- res = scale_n_add (res, (time_t)val, (int)mult);
+ res = scale_n_add (res, val, mult);
pz++;
while (isspace ((unsigned char)*pz))
/* Parse a time duration and return a seconds count
- Copyright (C) 2008-2012 Free Software Foundation, Inc.
+ Copyright (C) 2008-2013 Free Software Foundation, Inc.
Written by Bruce Korb <bkorb@gnu.org>, 2008.
This program is free software: you can redistribute it and/or modify
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
/* -*- buffer-read-only: t -*- vi: set ro:
*
* Prototypes for autoopts
- * Generated Thu Dec 27 12:59:13 PST 2012
+ * Generated Fri Jan 4 16:15:56 PST 2013
*/
#ifndef AUTOOPTS_PROTO_H_GUARD
#define AUTOOPTS_PROTO_H_GUARD 1
-#ifndef LOCAL
-# define LOCAL extern
-# define REDEF_LOCAL 1
-#else
-# undef REDEF_LOCAL
-#endif
/*
* Extracted from autoopts.c
*/
-LOCAL void *
+static void *
ao_malloc(size_t sz);
-LOCAL void *
+static void *
ao_realloc(void *p, size_t sz);
-LOCAL char *
+static char *
ao_strdup(char const *str);
-LOCAL tSuccess
+static tSuccess
handle_opt(tOptions * pOpts, tOptState * o_st);
-LOCAL tSuccess
+static tSuccess
next_opt(tOptions * opts, tOptState * o_st);
-LOCAL tSuccess
+static tSuccess
regular_opts(tOptions * opts);
/*
* Extracted from check.c
*/
-LOCAL bool
+static bool
is_consistent(tOptions * pOpts);
/*
* Extracted from configfile.c
*/
-LOCAL void
+static void
intern_file_load(tOptions * opts);
-LOCAL char*
+static char*
parse_attrs(tOptions * opts, char * txt, tOptionLoadMode * pMode,
tOptionValue * pType);
/*
* Extracted from env.c
*/
-LOCAL void
+static void
doPrognameEnv(tOptions * pOpts, teEnvPresetType type);
-LOCAL void
+static void
env_presets(tOptions * pOpts, teEnvPresetType type);
/*
* Extracted from find.c
*/
-LOCAL tSuccess
+static tSuccess
opt_find_long(tOptions * opts, char const * opt_name, tOptState * state);
-LOCAL tSuccess
+static tSuccess
opt_find_short(tOptions* pOpts, uint_t optValue, tOptState* pOptState);
-LOCAL tSuccess
+static tSuccess
get_opt_arg(tOptions * opts, tOptState * o_st);
-LOCAL tSuccess
+static tSuccess
find_opt(tOptions * opts, tOptState * o_st);
/*
* Extracted from init.c
*/
-LOCAL tSuccess
+static tSuccess
validate_struct(tOptions * opts, char const * pname);
-LOCAL tSuccess
+static tSuccess
immediate_opts(tOptions * opts);
-LOCAL bool
+static bool
ao_initialize(tOptions * opts, int a_ct, char ** a_v);
/*
* Extracted from load.c
*/
-LOCAL void
+static void
munge_str(char * txt, tOptionLoadMode mode);
-LOCAL void
+static void
loadOptionLine(
tOptions * opts,
tOptState * opt_state,
/*
* Extracted from nested.c
*/
-LOCAL void
+static void
unload_arg_list(tArgList * arg_list);
-LOCAL tOptionValue *
+static tOptionValue *
optionLoadNested(char const * text, char const * name, size_t nm_len);
-LOCAL int
+static int
get_special_char(char const ** ppz, int * ct);
-LOCAL void
+static void
emit_special_char(FILE * fp, int ch);
/*
* Extracted from sort.c
*/
-LOCAL void
-optionSort(tOptions* pOpts);
+static void
+optionSort(tOptions * opts);
/*
* Extracted from stack.c
*/
-LOCAL void
+static void
addArgListEntry(void** ppAL, void* entry);
/*
* Extracted from usage.c
*/
-LOCAL void
+static void
set_usage_flags(tOptions * opts, char const * flg_txt);
-#ifdef REDEF_LOCAL
-# undef LOCAL
-# define LOCAL
-#endif
#endif /* AUTOOPTS_PROTO_H_GUARD */
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
/* = = = START-STATIC-FORWARD = = = */
static tSuccess
-mustHandleArg(tOptions* pOpts, char* pzArg, tOptState* pOS,
- char** ppzOpts, int* pOptsIdx);
+must_arg(tOptions * opts, char * arg_txt, tOptState * pOS,
+ char ** opt_txt, uint32_t * opt_idx);
static tSuccess
-mayHandleArg(tOptions* pOpts, char* pzArg, tOptState* pOS,
- char** ppzOpts, int* pOptsIdx);
+maybe_arg(tOptions * opts, char * arg_txt, tOptState * pOS,
+ char ** opt_txt, uint32_t * opt_idx);
static tSuccess
-checkShortOpts(tOptions* pOpts, char* pzArg, tOptState* pOS,
- char** ppzOpts, int* pOptsIdx);
+short_opt_ck(tOptions * opts, char * arg_txt, tOptState * pOS,
+ char ** opt_txt, uint32_t * opt_idx);
/* = = = END-STATIC-FORWARD = = = */
/*
- * "mustHandleArg" and "mayHandleArg" are really similar. The biggest
+ * "must_arg" and "maybe_arg" are really similar. The biggest
* difference is that "may" will consume the next argument only if it
* does not start with a hyphen and "must" will consume it, hyphen or not.
*/
static tSuccess
-mustHandleArg(tOptions* pOpts, char* pzArg, tOptState* pOS,
- char** ppzOpts, int* pOptsIdx)
+must_arg(tOptions * opts, char * arg_txt, tOptState * pOS,
+ char ** opt_txt, uint32_t * opt_idx)
{
/*
* An option argument is required. Long options can either have
* See if an arg string follows the flag character. If not,
* the next arg must be the option argument.
*/
- if (*pzArg != NUL)
+ if (*arg_txt != NUL)
return SUCCESS;
break;
default:
return FAILURE;
}
- if (pOpts->curOptIdx >= pOpts->origArgCt)
+ if (opts->curOptIdx >= opts->origArgCt)
return FAILURE;
- ppzOpts[ (*pOptsIdx)++ ] = pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ opt_txt[ (*opt_idx)++ ] = opts->origArgVect[ (opts->curOptIdx)++ ];
return SUCCESS;
}
static tSuccess
-mayHandleArg(tOptions* pOpts, char* pzArg, tOptState* pOS,
- char** ppzOpts, int* pOptsIdx)
+maybe_arg(tOptions * opts, char * arg_txt, tOptState * pOS,
+ char ** opt_txt, uint32_t * opt_idx)
{
/*
* An option argument is optional.
* THEN see if there is another argument. If so and if it
* does *NOT* start with a hyphen, then it is the option arg.
*/
- if (*pzArg != NUL)
+ if (*arg_txt != NUL)
return SUCCESS;
break;
default:
return FAILURE;
}
- if (pOpts->curOptIdx >= pOpts->origArgCt)
+ if (opts->curOptIdx >= opts->origArgCt)
return PROBLEM;
- pzArg = pOpts->origArgVect[ pOpts->curOptIdx ];
- if (*pzArg != '-')
- ppzOpts[ (*pOptsIdx)++ ] = pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ arg_txt = opts->origArgVect[ opts->curOptIdx ];
+ if (*arg_txt != '-')
+ opt_txt[ (*opt_idx)++ ] = opts->origArgVect[ (opts->curOptIdx)++ ];
return SUCCESS;
}
* does or may take an argument, the do the argument processing and leave.
*/
static tSuccess
-checkShortOpts(tOptions* pOpts, char* pzArg, tOptState* pOS,
- char** ppzOpts, int* pOptsIdx)
+short_opt_ck(tOptions * opts, char * arg_txt, tOptState * pOS,
+ char ** opt_txt, uint32_t * opt_idx)
{
- while (*pzArg != NUL) {
- if (FAILED(opt_find_short(pOpts, (uint8_t)*pzArg, pOS)))
+ while (*arg_txt != NUL) {
+ if (FAILED(opt_find_short(opts, (uint8_t)*arg_txt, pOS)))
return FAILURE;
/*
* See if we can have an arg.
*/
if (OPTST_GET_ARGTYPE(pOS->pOD->fOptState) == OPARG_TYPE_NONE) {
- pzArg++;
+ arg_txt++;
} else if (pOS->pOD->fOptState & OPTST_ARG_OPTIONAL) {
/*
* Take an argument if it is not attached and it does not
* start with a hyphen.
*/
- if (pzArg[1] != NUL)
+ if (arg_txt[1] != NUL)
return SUCCESS;
- pzArg = pOpts->origArgVect[ pOpts->curOptIdx ];
- if (*pzArg != '-')
- ppzOpts[ (*pOptsIdx)++ ] =
- pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ arg_txt = opts->origArgVect[ opts->curOptIdx ];
+ if (*arg_txt != '-')
+ opt_txt[ (*opt_idx)++ ] =
+ opts->origArgVect[ (opts->curOptIdx)++ ];
return SUCCESS;
} else {
* IF we need another argument, be sure it is there and
* take it.
*/
- if (pzArg[1] == NUL) {
- if (pOpts->curOptIdx >= pOpts->origArgCt)
+ if (arg_txt[1] == NUL) {
+ if (opts->curOptIdx >= opts->origArgCt)
return FAILURE;
- ppzOpts[ (*pOptsIdx)++ ] =
- pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ opt_txt[ (*opt_idx)++ ] =
+ opts->origArgVect[ (opts->curOptIdx)++ ];
}
return SUCCESS;
}
* then this routine will to the trick.
*/
LOCAL void
-optionSort(tOptions* pOpts)
+optionSort(tOptions * opts)
{
- char** ppzOpts;
- char** ppzOpds;
- int optsIdx = 0;
- int opdsIdx = 0;
+ char ** opt_txt;
+ char ** ppzOpds;
+ uint32_t optsIdx = 0;
+ uint32_t opdsIdx = 0;
tOptState os = OPTSTATE_INITIALIZER(DEFINED);
* Disable for POSIX conformance, or if there are no operands.
*/
if ( (getenv("POSIXLY_CORRECT") != NULL)
- || NAMED_OPTS(pOpts))
+ || NAMED_OPTS(opts))
return;
/*
* Make sure we can allocate two full-sized arg vectors.
*/
- ppzOpts = malloc(pOpts->origArgCt * sizeof(char*));
- if (ppzOpts == NULL)
+ opt_txt = malloc(opts->origArgCt * sizeof(char*));
+ if (opt_txt == NULL)
goto exit_no_mem;
- ppzOpds = malloc(pOpts->origArgCt * sizeof(char*));
+ ppzOpds = malloc(opts->origArgCt * sizeof(char*));
if (ppzOpds == NULL) {
- free(ppzOpts);
+ free(opt_txt);
goto exit_no_mem;
}
- pOpts->curOptIdx = 1;
- pOpts->pzCurOpt = NULL;
+ opts->curOptIdx = 1;
+ opts->pzCurOpt = NULL;
/*
* Now, process all the options from our current position onward.
* non-standard programs that require it.)
*/
for (;;) {
- char* pzArg;
+ char * arg_txt;
tSuccess res;
/*
* If we're out of arguments, we're done. Join the option and
* operand lists into the original argument vector.
*/
- if (pOpts->curOptIdx >= pOpts->origArgCt) {
+ if (opts->curOptIdx >= opts->origArgCt) {
errno = 0;
goto joinLists;
}
- pzArg = pOpts->origArgVect[ pOpts->curOptIdx ];
- if (*pzArg != '-') {
- ppzOpds[ opdsIdx++ ] = pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ arg_txt = opts->origArgVect[ opts->curOptIdx ];
+ if (*arg_txt != '-') {
+ ppzOpds[ opdsIdx++ ] = opts->origArgVect[ (opts->curOptIdx)++ ];
continue;
}
- switch (pzArg[1]) {
+ switch (arg_txt[1]) {
case NUL:
/*
* A single hyphen is an operand.
*/
- ppzOpds[ opdsIdx++ ] = pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ ppzOpds[ opdsIdx++ ] = opts->origArgVect[ (opts->curOptIdx)++ ];
continue;
case '-':
* Two consecutive hypens. Put them on the options list and then
* _always_ force the remainder of the arguments to be operands.
*/
- if (pzArg[2] == NUL) {
- ppzOpts[ optsIdx++ ] =
- pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ if (arg_txt[2] == NUL) {
+ opt_txt[ optsIdx++ ] =
+ opts->origArgVect[ (opts->curOptIdx)++ ];
goto restOperands;
}
- res = opt_find_long(pOpts, pzArg+2, &os);
+ res = opt_find_long(opts, arg_txt+2, &os);
break;
default:
* option processing. Otherwise the character must be a
* short (i.e. single character) option.
*/
- if ((pOpts->fOptSet & OPTPROC_SHORTOPT) == 0) {
- res = opt_find_long(pOpts, pzArg+1, &os);
+ if ((opts->fOptSet & OPTPROC_SHORTOPT) == 0) {
+ res = opt_find_long(opts, arg_txt+1, &os);
} else {
- res = opt_find_short(pOpts, (uint8_t)pzArg[1], &os);
+ res = opt_find_short(opts, (uint8_t)arg_txt[1], &os);
}
break;
}
* Next, we have to see if we need to pull another argument to be
* used as the option argument.
*/
- ppzOpts[ optsIdx++ ] = pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ opt_txt[ optsIdx++ ] = opts->origArgVect[ (opts->curOptIdx)++ ];
if (OPTST_GET_ARGTYPE(os.pOD->fOptState) == OPARG_TYPE_NONE) {
/*
* of the argument string.
*/
if ( (os.optType == TOPT_SHORT)
- && FAILED(checkShortOpts(pOpts, pzArg+2, &os, ppzOpts,
- &optsIdx)) ) {
+ && FAILED(short_opt_ck(opts, arg_txt+2, &os, opt_txt,
+ &optsIdx)) ) {
errno = EINVAL;
goto freeTemps;
}
} else if (os.pOD->fOptState & OPTST_ARG_OPTIONAL) {
- switch (mayHandleArg(pOpts, pzArg+2, &os, ppzOpts, &optsIdx)) {
+ switch (maybe_arg(opts, arg_txt+2, &os, opt_txt, &optsIdx)) {
case FAILURE: errno = EIO; goto freeTemps;
case PROBLEM: errno = 0; goto joinLists;
}
} else {
- switch (mustHandleArg(pOpts, pzArg+2, &os, ppzOpts, &optsIdx)) {
+ switch (must_arg(opts, arg_txt+2, &os, opt_txt, &optsIdx)) {
case PROBLEM:
case FAILURE: errno = EIO; goto freeTemps;
}
} /* for (;;) */
restOperands:
- while (pOpts->curOptIdx < pOpts->origArgCt)
- ppzOpds[ opdsIdx++ ] = pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ while (opts->curOptIdx < opts->origArgCt)
+ ppzOpds[ opdsIdx++ ] = opts->origArgVect[ (opts->curOptIdx)++ ];
joinLists:
if (optsIdx > 0)
- memcpy(pOpts->origArgVect + 1, ppzOpts,
+ memcpy(opts->origArgVect + 1, opt_txt,
(size_t)optsIdx * sizeof(char*));
if (opdsIdx > 0)
- memcpy(pOpts->origArgVect + 1 + optsIdx, ppzOpds,
+ memcpy(opts->origArgVect + 1 + optsIdx, ppzOpds,
(size_t)opdsIdx * sizeof(char*));
freeTemps:
- free(ppzOpts);
+ free(opt_txt);
free(ppzOpds);
return;
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
* This file defines the string_tokenize interface
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
char const*
optionVersion(void)
{
- static char const zVersion[] =
- STR(AO_CURRENT.AO_REVISION);
-
- return zVersion;
+ static char const ver[] = OPTIONS_DOTTED_VERSION;
+ return ver;
}
/**