* CID 1269537: Clean up a line of dead code in getShmTime().
* ntpq.c cleanup.
* Improve the ntpq documentation around the controlkey keyid.
+* autogen-5.18.5.
(4.3.19) 2015/04/25 Released by Harlan Stenn <stenn@ntp.org>
Below are from 4.2.8p3:
* [Bug 2804] Fix regression in previous fix.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
- Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ Copyright (C) 1992-2015 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.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
- Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ Copyright (C) 1992-2015 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.
+Copyright (C) 1992-2015 by Bruce Korb - all rights reserved
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
COPYING.gplv3 COPYING.lgplv3 COPYING.mbsd \
MakeDefs.inc README ag-char-map.h \
alias.c ao-strs.c ao-strs.h \
- autoopts/project.h autoopts/options.h autoopts/usage-txt.h \
+ autoopts/usage-txt.h autoopts/options.h autoopts/project.h \
autoopts.c autoopts.h boolean.c \
- check.c compat/snprintf.c compat/strchr.c \
- compat/strdup.c compat/_Noreturn.h compat/pathfind.c \
- compat/compat.h compat/windows-config.h configfile.c \
+ check.c compat/compat.h compat/strdup.c \
+ compat/windows-config.h compat/strchr.c compat/pathfind.c \
+ compat/snprintf.c compat/_Noreturn.h configfile.c \
cook.c enum.c env.c \
file.c find.c genshell.c \
genshell.h gettext.h init.c \
LICENSING:
-This material is Copyright (C) 1992-2014 by Bruce Korb. You are
+This material is Copyright (C) 1992-2015 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 08/08/14 at 16:09:03
+ * generated by char-mapper on 04/25/15 at 09:53:03
*
* 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-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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 August 8, 2014 at 04:09:03 PM by AutoGen 5.18.4pre11
+ * It has been AutoGen-ed
* From the definitions ao-strs.def
* and the template file strings
*
- * Copyright (C) 2011-2014 Bruce Korb, all rights reserved.
+ * Copyright (C) 2011-2015 Bruce Korb, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the
* Modified (3 clause) Berkeley Software Distribution License
*
* DO NOT EDIT THIS FILE (ao-strs.h)
*
- * It has been AutoGen-ed August 8, 2014 at 04:09:03 PM by AutoGen 5.18.4pre11
+ * It has been AutoGen-ed
* From the definitions ao-strs.def
* and the template file strings
*
- * Copyright (C) 2011-2014 Bruce Korb, all rights reserved.
+ * Copyright (C) 2011-2015 Bruce Korb, all rights reserved.
* This is free software. It is licensed for use, modification and
* redistribution under the terms of the
* Modified (3 clause) Berkeley Software Distribution License
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
*
* what: this is the main option processing routine
*
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + int + a_ct + program arg count +
- * arg: + char** + a_v + program arg vector +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + int + a_ct + program arg count +
+ * arg: + char ** + a_v + program arg vector +
*
* ret_type: int
* ret_desc: the count of the arguments processed
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
* Coercive cast. Compel an address to be interpreted as the type
* of the first argument. No complaints, just do it.
*/
-#define C(_t,_p) ((_t)(void *)(_p))
+#define C(_t,_p) ((_t)VOIDP(_p))
#endif
/* The __attribute__((__warn_unused_result__)) feature
char const * pzTime;
} arg_types_t;
-#define AGALOC(c, w) ao_malloc((size_t)c)
-#define AGREALOC(p, c, w) ao_realloc((void*)p, (size_t)c)
-#define AGFREE(p) free((void *)(intptr_t)p)
-#define AGDUPSTR(p, s, w) (p = ao_strdup(s))
+#define AGALOC(_c, _w) ao_malloc((size_t)_c)
+#define AGREALOC(_p, _c, _w) ao_realloc(VOIDP(_p), (size_t)_c)
+#define AGFREE(_p) free(VOIDP(_p))
+#define AGDUPSTR(_p, _s, _w) (_p = ao_strdup(_s))
static void *
ao_malloc(size_t sz);
static void *
ao_realloc(void *p, size_t sz);
-#define ao_free(_p) free((void *)_p)
+#define ao_free(_p) free(VOIDP(_p))
static char *
-ao_strdup(char const *str);
+ao_strdup(char const * str);
/**
* DO option handling?
#endif
#ifndef MAP_FAILED
-# define MAP_FAILED ((void*)-1)
+# define MAP_FAILED VOIDP(-1)
#endif
#ifndef _SC_PAGESIZE
#endif
#ifndef HAVE_STRCHR
-extern char* strchr(char const *s, int c);
-extern char* strrchr(char const *s, int c);
+extern char * strchr(char const * s, int c);
+extern char * strrchr(char const * s, int c);
#endif
/**
#undef _aof_
static char const zNil[] = "";
-static arg_types_t argTypes = { 0 };
+static arg_types_t argTypes = { NULL };
static char line_fmt_buf[32];
static bool displayEnum = false;
static char const pkgdatadir_default[] = PKGDATADIR;
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
* private:
*
* what: Decipher a boolean value
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + tOptDesc* + od + the descriptor for this arg +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + tOptDesc * + od + the descriptor for this arg +
*
* doc:
* Decipher a true or false value for a boolean valued option argument.
void
optionBooleanVal(tOptions * opts, tOptDesc * od)
{
- char* pz;
- bool res = true;
+ char * pz;
+ bool res = true;
if (INQUERY_CALL(opts, od))
return;
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
file_preset(tOptions * opts, char const * fname, int dir);
static char *
-handle_comment(char* txt);
+handle_comment(char * txt);
static char *
handle_cfg(tOptions * opts, tOptState * ost, char * txt, int dir);
/*=export_func configFileLoad
*
* what: parse a configuration file
- * arg: + char const* + fname + the file to load +
+ * arg: + char const * + fname + the file to load +
*
- * ret_type: const tOptionValue*
+ * ret_type: const tOptionValue *
* ret_desc: An allocated, compound value structure
*
* doc:
/*=export_func optionFindValue
*
* what: find a hierarcicaly valued option instance
- * arg: + const tOptDesc* + odesc + an option with a nested arg type +
- * arg: + char const* + name + name of value to find +
- * arg: + char const* + val + the matching value +
+ * arg: + const tOptDesc * + odesc + an option with a nested arg type +
+ * arg: + char const * + name + name of value to find +
+ * arg: + char const * + val + the matching value +
*
- * ret_type: const tOptionValue*
+ * ret_type: const tOptionValue *
* ret_desc: a compound value structure
*
* doc:
}
else do {
- tArgList* argl = odesc->optCookie;
- int argct = argl->useCt;
- void ** poptv = (void**)(intptr_t)(argl->apzArgs);
+ tArgList * argl = odesc->optCookie;
+ int argct = argl->useCt;
+ void ** poptv = (void **)(argl->apzArgs);
if (argct == 0) {
errno = ENOENT;
}
if (name == NULL) {
- res = (tOptionValue*)*poptv;
+ res = (tOptionValue *)*poptv;
break;
}
* FIXME: the handling of 'pzName' and 'pzVal' is just wrong.
*
* what: find a hierarcicaly valued option instance
- * arg: + const tOptDesc* + odesc + an option with a nested arg type +
- * arg: + const tOptionValue* + pPrevVal + the last entry +
- * arg: + char const* + name + name of value to find +
- * arg: + char const* + value + the matching value +
+ * arg: + const tOptDesc * + odesc + an option with a nested arg type +
+ * arg: + const tOptionValue * + pPrevVal + the last entry +
+ * arg: + char const * + name + name of value to find +
+ * arg: + char const * + value + the matching value +
*
- * ret_type: const tOptionValue*
+ * ret_type: const tOptionValue *
* ret_desc: a compound value structure
*
* doc:
char const * pzName, char const * pzVal)
{
bool old_found = false;
- tOptionValue* res = NULL;
+ tOptionValue * res = NULL;
(void)pzName;
(void)pzVal;
}
else do {
- tArgList* argl = odesc->optCookie;
- int ct = argl->useCt;
- void** poptv = (void**)(intptr_t)argl->apzArgs;
+ tArgList * argl = odesc->optCookie;
+ int ct = argl->useCt;
+ void ** poptv = (void **)argl->apzArgs;
while (--ct >= 0) {
- tOptionValue* pOV = *(poptv++);
+ tOptionValue * pOV = *(poptv++);
if (old_found) {
res = pOV;
break;
/*=export_func optionGetValue
*
* what: get a specific value from a hierarcical list
- * arg: + const tOptionValue* + pOptValue + a hierarchcal value +
- * arg: + char const* + valueName + name of value to get +
+ * arg: + const tOptionValue * + pOptValue + a hierarchcal value +
+ * arg: + char const * + valueName + name of value to get +
*
- * ret_type: const tOptionValue*
+ * ret_type: const tOptionValue *
* ret_desc: a compound value structure
*
* doc:
if (arg_list->useCt > 0) {
int ct = arg_list->useCt;
- void ** ovlist = (void**)(intptr_t)(arg_list->apzArgs);
+ void ** ovlist = (void **)(arg_list->apzArgs);
if (vname == NULL) {
- res = (tOptionValue*)*ovlist;
+ res = (tOptionValue *)*ovlist;
} else do {
tOptionValue * opt_val = *(ovlist++);
/*=export_func optionNextValue
*
* what: get the next value from a hierarchical list
- * arg: + const tOptionValue* + pOptValue + a hierarchcal list value +
- * arg: + const tOptionValue* + pOldValue + a value from this list +
+ * arg: + const tOptionValue * + pOptValue + a hierarchcal list value +
+ * arg: + const tOptionValue * + pOldValue + a value from this list +
*
- * ret_type: const tOptionValue*
+ * ret_type: const tOptionValue *
* ret_desc: a compound value structure
*
* doc:
arg_list = ov_list->v.nestVal;
{
int ct = arg_list->useCt;
- void ** o_list = (void**)(intptr_t)(arg_list->apzArgs);
+ void ** o_list = (void **)(arg_list->apzArgs);
while (ct-- > 0) {
tOptionValue * nov = *(o_list++);
} else {
err = 0;
- res = (tOptionValue*)*o_list;
+ res = (tOptionValue *)*o_list;
}
break;
}
* but actually I don't care that much. It ends with "-->".
*/
static char *
-handle_comment(char* txt)
+handle_comment(char * txt)
{
- char* pz = strstr(txt, "-->");
+ char * pz = strstr(txt, "-->");
if (pz != NULL)
pz += 3;
return pz;
static char *
handle_cfg(tOptions * opts, tOptState * ost, char * txt, int dir)
{
- char* pzName = txt++;
- char* pzEnd = strchr(txt, NL);
+ char * pzName = txt++;
+ char * pzEnd = strchr(txt, NL);
if (pzEnd == NULL)
return txt + strlen(txt);
* on to a newline *not* preceded by a backslash.
*/
if (pzEnd[-1] == '\\') {
- char* pcD = pzEnd-1;
- char* pcS = pzEnd;
+ char * pcD = pzEnd-1;
+ char * pcS = pzEnd;
for (;;) {
char ch = *(pcS++);
tOptionLoadMode mode = option_load_mode;
tOptionValue valu;
- char* pzName = ++txt;
- char* pzData;
- char* pcNulPoint;
+ char * pzName = ++txt;
+ char * pzData;
+ char * pcNulPoint;
txt = SPN_VALUE_NAME_CHARS(txt);
pcNulPoint = txt;
switch (*txt) {
case ' ':
case '\t':
- txt = (void *)(intptr_t)parse_attrs(
- opts, SPN_WHITESPACE_CHARS(txt), &mode, &valu);
+ txt = VOIDP(parse_attrs(
+ opts, SPN_WHITESPACE_CHARS(txt), &mode, &valu));
if (txt == NULL)
return txt;
if (*txt == '>')
*
* what: Load the locatable config files, in order
*
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + char const* + prog + program name +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + char const * + prog + program name +
*
* ret_type: int
* ret_desc: 0 -> SUCCESS, -1 -> FAILURE
* of this pointer to point to writable memory.
*/
{
- char const ** pp =
- (char const **)(void *)(intptr_t)&(opts->pzProgName);
+ char const ** pp = VOIDP(&(opts->pzProgName));
*pp = prog;
}
* private:
*
* what: Load an option rc/ini file
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + tOptDesc* + odesc + the descriptor for this arg +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + tOptDesc * + odesc + the descriptor for this arg +
*
* doc:
* Processes the options found in the file named with
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
* private:
*
* what: escape-process a string fragment
- * arg: + char const* + pzScan + points to character after the escape +
- * arg: + char* + pRes + Where to put the result byte +
+ * arg: + char const * + pzScan + points to character after the escape +
+ * arg: + char * + pRes + Where to put the result byte +
* arg: + unsigned int + nl_ch + replacement char if scanned char is \n +
*
* ret-type: unsigned int
case '*':
{
- char* p = strstr( ps+2, "*/" );
+ char * p = strstr( ps+2, "*/" );
/*
* Skip to terminating star slash
*/
* private:
*
* what: concatenate and escape-process strings
- * arg: + char* + pzScan + The *MODIFIABLE* input buffer +
- * arg: + int* + lnct_p + The (possibly NULL) pointer to a line count +
+ * arg: + char * + pzScan + The *MODIFIABLE* input buffer +
+ * arg: + int * + lnct_p + The (possibly NULL) pointer to a line count +
*
- * ret-type: char*
+ * ret-type: char *
* ret-desc: The address of the text following the processed strings.
* The return value is NULL if the strings are ill-formed.
*
* It is a quoted string. Process the escape sequence characters
* (in the set "abfnrtv") and make sure we find a closing quote.
*/
- char* pzD = pzScan++;
- char* pzS = pzScan;
+ char * pzD = pzScan++;
+ char * pzS = pzScan;
if (lnct_p == NULL)
lnct_p = &l;
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
{
/*
* Return the matching index as a pointer sized integer.
- * The result gets stashed in a char* pointer.
+ * The result gets stashed in a char * pointer.
*/
uintptr_t res = name_ct;
- size_t len = strlen((const char*)name);
+ size_t len = strlen((char *)name);
uintptr_t idx;
if (IS_DEC_DIGIT_CHAR(*name)) {
- char * pz = (char *)(void *)(intptr_t)name;
+ char * pz = VOIDP(name);
unsigned long val = strtoul(pz, &pz, 0);
if ((*pz == NUL) && (val < name_ct))
return (uintptr_t)val;
* Multiple partial matches means we have an ambiguous match.
*/
for (idx = 0; idx < name_ct; idx++) {
- if (strncmp((char*)(intptr_t)paz_names[idx], (char*)(intptr_t)name, len) == 0) {
+ if (strncmp((char *)paz_names[idx], (char *)name, len) == 0) {
if (paz_names[idx][len] == NUL)
return idx; /* full match */
* what: Convert between enumeration values and strings
* private:
*
- * arg: tOptDesc*, pOD, enumeration option description
+ * arg: tOptDesc *, pOD, enumeration option description
* arg: unsigned int, enum_val, the enumeration value to map
*
* ret_type: char const *
* what: Convert from a string to an enumeration value
* private:
*
- * arg: tOptions*, pOpts, the program options descriptor
- * arg: tOptDesc*, pOD, enumeration option description
+ * arg: tOptions *, pOpts, the program options descriptor
+ * arg: tOptDesc *, pOD, enumeration option description
* arg: char const * const *, paz_names, list of enumeration names
* arg: unsigned int, name_ct, number of names in list
*
*
* arg: tOptDesc *, od, the set membership option description
*
- * ret_type: char*
+ * ret_type: char *
* ret_desc: the names of the set bits
*
* doc: This converts the OPT_VALUE_name mask value to a allocated string.
uintptr_t sv = od->optArg.argIntptr;
char * res;
(*(od->pOptProc))(OPTPROC_RETURN_VALNAME, od);
- res = (void *)(intptr_t)od->optArg.argString;
+ res = VOIDP(od->optArg.argString);
od->optArg.argIntptr = sv;
return res;
}
* what: Convert between bit flag values and strings
* private:
*
- * arg: tOptions*, opts, the program options descriptor
- * arg: tOptDesc*, od, the set membership option description
+ * arg: tOptions *, opts, the program options descriptor
+ * arg: tOptDesc *, od, the set membership option description
* arg: char const * const *,
* nm_list, list of enumeration names
* arg: unsigned int, nm_ct, number of names in list
if (nm_ct < (8 * sizeof(uintptr_t)))
res &= (1UL << nm_ct) - 1UL;
- od->optCookie = (void *)res;
+ od->optCookie = VOIDP(res);
}
return;
fail_return:
- od->optCookie = (void *)0;
+ od->optCookie = VOIDP(0);
}
/** @}
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
doPrognameEnv(tOptions * pOpts, teEnvPresetType type)
{
char const * env_opts = getenv(pOpts->pzPROGNAME);
- token_list_t* pTL;
+ token_list_t * pTL;
int sv_argc;
proc_state_mask_t sv_flag;
char ** sv_argv;
*/
{
uintptr_t v = (uintptr_t)(pTL->tkn_list);
- pOpts->origArgVect = (void *)(v - sizeof(char *));
+ pOpts->origArgVect = VOIDP(v - sizeof(char *));
}
pOpts->origArgCt = (unsigned int)pTL->tkn_ct + 1;
pOpts->fOptSet &= ~OPTPROC_ERRSTOP;
{
int ct;
tOptState st;
- char* pzFlagName;
+ char * pzFlagName;
size_t spaceLeft;
char zEnvName[ AO_NAME_SIZE ];
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
/* NOTREACHED */
if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0)
- pOD->optCookie = (void *)(intptr_t)pOD->optArg.argString;
+ pOD->optCookie = VOIDP(pOD->optArg.argString);
else
AGDUPSTR(pOD->optCookie, pOD->optArg.argString, "file name");
/* NOTREACHED */
if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0)
- pOD->optCookie = (void *)(intptr_t)pOD->optArg.argString;
+ pOD->optCookie = VOIDP(pOD->optArg.argString);
else
AGDUPSTR(pOD->optCookie, pOD->optArg.argString, "file name");
* private:
*
* what: Decipher a boolean value
- * arg: + tOptions* + pOpts + program options descriptor +
- * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ * arg: + tOptions * + pOpts + program options descriptor +
+ * arg: + tOptDesc * + pOptDesc + the descriptor for this arg +
* arg: + teOptFileType + ftype + File handling type +
* arg: + tuFileMode + mode + file open mode (if needed) +
*
* The mode specifies if the file must exist, must not exist or may
* (or may not) exist. The mode may also specify opening the
* file: don't, open just the descriptor (fd), or open as a stream
- * (FILE* pointer).
+ * (FILE * pointer).
=*/
void
optionFileCheck(tOptions * pOpts, tOptDesc * pOD,
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
get_opt_arg_may(tOptions * pOpts, tOptState * o_st);
static tSuccess
-get_opt_arg_none(tOptions * pOpts, tOptState* o_st);
+get_opt_arg_none(tOptions * pOpts, tOptState * o_st);
/* = = = END-STATIC-FORWARD = = = */
/**
buf[res] = NUL;
*nm_pp = buf;
- *arg_pp = (char *)(intptr_t)p;
+ *arg_pp = (char *)p;
return res;
default:
* @param pOptState state about current option
*/
LOCAL tSuccess
-opt_find_short(tOptions* pOpts, uint_t optValue, tOptState* pOptState)
+opt_find_short(tOptions * pOpts, uint_t optValue, tOptState * pOptState)
{
- tOptDesc* pRes = pOpts->pOptDesc;
+ tOptDesc * pRes = pOpts->pOptDesc;
int ct = pOpts->optCt;
/*
if (*++pOpts->pzCurOpt != NUL)
o_st->pzOptArg = pOpts->pzCurOpt;
else {
- char* pzLA = pOpts->origArgVect[ pOpts->curOptIdx ];
+ char * pzLA = pOpts->origArgVect[ pOpts->curOptIdx ];
/*
* BECAUSE it is optional, we must make sure
*/
if ( (o_st->pzOptArg == NULL)
&& (! NAMED_OPTS(pOpts))) {
- char* pzLA = pOpts->origArgVect[ pOpts->curOptIdx ];
+ char * pzLA = pOpts->origArgVect[ pOpts->curOptIdx ];
/*
* BECAUSE it is optional, we must make sure
* @returns SUCCESS or FAILURE
*/
static tSuccess
-get_opt_arg_none(tOptions * pOpts, tOptState* o_st)
+get_opt_arg_none(tOptions * pOpts, tOptState * o_st)
{
/*
* No option argument. Make sure next time around we find
* strip off the "const" quality of the "default_opt" field.
*/
while (*(++pz) == '-') ;
- def_opt = (void *)(intptr_t)&(opts->specOptIdx.default_opt);
+ def_opt = VOIDP(&(opts->specOptIdx.default_opt));
def = *def_opt;
*def_opt = NO_EQUIVALENT;
res = opt_find_long(opts, pz, o_st);
(void)opts;
(void)od;
}
-/* extracted from optmain.tlib near line 1245 */
+/* extracted from optmain.tlib near line 1250 */
/**
* The directory containing the data associated with genshellopt.
if (option_xlateable_txt.field_ct != 0) {
res = dgettext("libopts", pz);
if (res == pz)
- res = (char *)(void *)_(pz);
+ res = (char *)VOIDP(_(pz));
} else
- res = (char *)(void *)_(pz);
+ res = (char *)VOIDP(_(pz));
#else
- res = (char *)(void *)_(pz);
+ res = (char *)VOIDP(_(pz));
#endif
if (res == pz)
return res;
* Do the translations. The first pointer follows the field count
* field. The field count field is the size of a pointer.
*/
- char ** ppz = (char**)(void*)&(option_xlateable_txt);
+ char ** ppz = (char**)VOIDP(&(option_xlateable_txt));
int ix = option_xlateable_txt.field_ct;
do {
/* prevent re-translation and disable "libopts" domain lookup */
option_xlateable_txt.field_ct = 0;
- coerce_it((void*)&(opts->pzCopyright));
- coerce_it((void*)&(opts->pzCopyNotice));
- coerce_it((void*)&(opts->pzFullVersion));
- coerce_it((void*)&(opts->pzUsageTitle));
- coerce_it((void*)&(opts->pzExplain));
- coerce_it((void*)&(opts->pzDetail));
+ coerce_it(VOIDP(&(opts->pzCopyright)));
+ coerce_it(VOIDP(&(opts->pzCopyNotice)));
+ coerce_it(VOIDP(&(opts->pzFullVersion)));
+ coerce_it(VOIDP(&(opts->pzUsageTitle)));
+ coerce_it(VOIDP(&(opts->pzExplain)));
+ coerce_it(VOIDP(&(opts->pzDetail)));
{
tOptDesc * od = opts->pOptDesc;
for (ix = opts->optCt; ix > 0; ix--, od++)
- coerce_it((void*)&(od->pzText));
+ coerce_it(VOIDP(&(od->pzText)));
}
}
}
puts(_("allocation of %d bytes failed\n"));
#line 53 "../init.c"
puts(_("AutoOpts function called without option descriptor\n"));
-#line 90 "../init.c"
+#line 86 "../init.c"
puts(_("\tThis exceeds the compiled library version: "));
-#line 88 "../init.c"
+#line 84 "../init.c"
puts(_("Automated Options Processing Error!\n"
"\t%s called AutoOpts function with structure version %d:%d:%d.\n"));
#line 80 "../autoopts.c"
puts(_("realloc of %d bytes at 0x%p failed\n"));
-#line 92 "../init.c"
+#line 88 "../init.c"
puts(_("\tThis is less than the minimum library version: "));
#line 121 "../version.c"
puts(_("Automated Options version %s\n"
"\tCopyright (C) 1999-2014 by Bruce Korb - all rights reserved\n"));
-#line 82 "../makeshell.c"
+#line 87 "../makeshell.c"
puts(_("(AutoOpts bug): %s.\n"));
#line 90 "../reset.c"
puts(_("optionResetOpt() called, but reset-option not configured"));
puts(_("%s: Command line arguments required\n"));
#line 43 "../alias.c"
puts(_("%d %s%s options allowed\n"));
-#line 89 "../makeshell.c"
+#line 94 "../makeshell.c"
puts(_("%s error %d (%s) calling %s for '%s'\n"));
-#line 301 "../makeshell.c"
+#line 306 "../makeshell.c"
puts(_("interprocess pipe"));
#line 168 "../version.c"
puts(_("error: version option argument '%c' invalid. Use:\n"
puts(_("Try '%s %s' for more information.\n"));
#line 45 "../alias.c"
puts(_("one %s%s option allowed\n"));
-#line 203 "../makeshell.c"
+#line 208 "../makeshell.c"
puts(_("standard output"));
-#line 938 "../makeshell.c"
+#line 943 "../makeshell.c"
puts(_("standard output"));
#line 274 "../usage.c"
puts(_("standard output"));
puts(_("standard error"));
#line 175 "../version.c"
puts(_("standard error"));
-#line 203 "../makeshell.c"
+#line 208 "../makeshell.c"
puts(_("write"));
-#line 938 "../makeshell.c"
+#line 943 "../makeshell.c"
puts(_("write"));
#line 273 "../usage.c"
puts(_("write"));
#line 380 "../usage.c"
puts(_("Options are specified by doubled hyphens and their name or by a single\n"
"hyphen and the flag character.\n"));
-#line 916 "../makeshell.c"
+#line 921 "../makeshell.c"
puts(_("\n"
"= = = = = = = =\n\n"
"This incarnation of genshell will produce\n"
/* Convenience header for conditional use of GNU <libintl.h>.
- Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2014 Free Software
+ Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2015 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-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
*/
if ((opts->fOptSet & OPTPROC_NO_XLAT_MASK) == OPTPROC_NXLAT_OPT)
opts->fOptSet |= OPTPROC_NXLAT_OPT_CFG;
- (*opts->pTransProc)();
+ opts->pTransProc();
}
/*
&& ( (opts->structVersion > OPTIONS_STRUCT_VERSION )
|| (opts->structVersion < OPTIONS_MINIMUM_VERSION )
) ) {
-
- static char const ao_ver_string[] =
- STR(AO_CURRENT)":"STR(AO_REVISION)":"STR(AO_AGE)"\n";
-
fprintf(stderr, zwrong_ver, pname, NUM_TO_VER(opts->structVersion));
if (opts->structVersion > OPTIONS_STRUCT_VERSION )
fputs(ztoo_new, stderr);
*/
if (opts->pzProgName == NULL) {
char const * pz = strrchr(pname, DIRCH);
+ char const ** pp =
+ (char const **)(void **)&(opts->pzProgName);
if (pz != NULL)
- opts->pzProgName = pz+1;
+ *pp = pz+1;
else
- opts->pzProgName = pname;
+ *pp = pname;
- pz = pathfind(getenv("PATH"), (char *)(intptr_t)pname, "rx");
+ pz = pathfind(getenv("PATH"), (char *)pname, "rx");
if (pz != NULL)
- pname = (void *)(intptr_t)pz;
+ pname = VOIDP(pz);
- opts->pzProgPath = pname;
+ pp = (char const **)VOIDP(&(opts->pzProgPath));
+ *pp = pname;
/*
* when comparing long names, these are equivalent
/* intprops.h -- properties of integer types
- Copyright (C) 2001-2005, 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2001-2005, 2009-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
#include "autoopts/project.h"
#define LOCAL static
#include "ao-strs.h"
+static char const ao_ver_string[] =
+ "41:0:16\n";
#include "autoopts/options.h"
#include "autoopts/usage-txt.h"
#include "genshell.h"
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
* private:
*
* what: translate and construct a path
- * arg: + char* + p_buf + The result buffer +
- * arg: + int + b_sz + The size of this buffer +
- * arg: + char const* + fname + The input name +
- * arg: + char const* + prg_path + The full path of the current program +
+ * arg: + char * + p_buf + The result buffer +
+ * arg: + int + b_sz + The size of this buffer +
+ * arg: + char const * + fname + The input name +
+ * arg: + char const * + prg_path + The full path of the current program +
*
* ret-type: bool
* ret-desc: true if the name was handled, otherwise false.
if (strchr(prg_path, DIRCH) != NULL)
path = prg_path;
else {
- path = pathfind(getenv("PATH"), (char*)(intptr_t)prg_path, "rx");
+ path = pathfind(getenv("PATH"), (char *)prg_path, "rx");
if (path == NULL)
return false;
*
* what: process a string for an option name and value
*
- * arg: tOptions*, opts, program options descriptor
- * arg: char const*, line, NUL-terminated text
+ * arg: tOptions *, opts, program options descriptor
+ * arg: char const *, line, NUL-terminated text
*
* doc:
*
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
* 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
*/
+ static inline unsigned char to_uchar (char ch) { return ch; }
+
+#define UPPER(_c) (toupper(to_uchar(_c)))
+#define LOWER(_c) (tolower(to_uchar(_c)))
+
/* = = = START-STATIC-FORWARD = = = */
static void
emit_var_text(char const * prog, char const * var, int fdin);
* private:
*
* what: Decipher a boolean value
- * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptions * + pOpts + program options descriptor +
*
* doc:
* Emit a shell script that will parse the command line options.
/* Copy the program name into the time/name buffer */
for (;;) {
- if ((*pzPN++ = (char)tolower((unsigned char)*pz++)) == NUL)
+ if ((*pzPN++ = (char)tolower(*pz++)) == NUL)
break;
}
- pp = (char **)(void *)(intptr_t)&(opts->pzProgPath);
+ pp = VOIDP(&(opts->pzProgPath));
*pp = tm_nm_buf;
- pp = (char **)(void *)(intptr_t)&(opts->pzProgName);
+ pp = VOIDP(&(opts->pzProgName));
*pp = tm_nm_buf;
}
text_to_var(opts, TT_USAGE, NULL);
{
- tOptDesc* pOptDesc = opts->pOptDesc;
- int optionCt = opts->optCt;
+ tOptDesc * pOptDesc = opts->pOptDesc;
+ int optionCt = opts->optCt;
for (;;) {
if (pOptDesc->pOptProc == optionPrintVersion) {
static void
emit_flag(tOptions * opts)
{
- tOptDesc* od = opts->pOptDesc;
- int opt_ct = opts->optCt;
+ tOptDesc * od = opts->pOptDesc;
+ int opt_ct = opts->optCt;
fputs(zOptionCase, stdout);
* They must not be the same. They cannot be, because it would
* not compile correctly if they were.
*/
- while (toupper((unsigned char)od->pz_Name[match_ct]) == toupper((unsigned char)name[match_ct]))
+ while (UPPER(od->pz_Name[match_ct]) == UPPER(name[match_ct]))
match_ct++;
if (match_ct > min_match_ct)
continue;
match_ct = 0;
- while ( toupper((unsigned char)od->pz_DisableName[match_ct])
- == toupper((unsigned char)name[match_ct]))
+ while ( toupper(od->pz_DisableName[match_ct])
+ == toupper(name[match_ct]))
match_ct++;
if (match_ct > min_match_ct)
min_match_ct = match_ct;
* Read in all the data as fast as our OS will let us.
*/
for (;;) {
- size_t inct = fread((void*)scan, 1, (size_t)stbf.st_size, fp);
+ size_t inct = fread(VOIDP(scan), 1, (size_t)stbf.st_size, fp);
if (inct == 0)
break;
* private:
* what: The usage function for the genshellopt generated program
*
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + int + exit_cd + usage text type to produce +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + int + exit_cd + usage text type to produce +
*
* doc:
* This function is used to create the usage strings for the option
*/
{
char * pz;
- char ** pp = (char **)(void *)(intptr_t)&(optionParseShellOptions->pzProgName);
+ char ** pp = VOIDP(&(optionParseShellOptions->pzProgName));
AGDUPSTR(pz, optionParseShellOptions->pzPROGNAME, "prog name");
*pp = pz;
while (*pz != NUL) {
- *pz = (char)tolower((unsigned char)*pz);
+ *pz = (char)LOWER(*pz);
pz++;
}
}
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
static void
remove_continuation(char * src);
-static char const*
-scan_q_str(char const* pzTxt);
+static char const *
+scan_q_str(char const * pzTxt);
static tOptionValue *
add_string(void ** pp, char const * name, size_t nm_len,
add_bool(void ** pp, char const * name, size_t nm_len,
char const * val, size_t d_len);
-static tOptionValue*
+static tOptionValue *
add_number(void ** pp, char const * name, size_t nm_len,
char const * val, size_t d_len);
-static tOptionValue*
+static tOptionValue *
add_nested(void ** pp, char const * name, size_t nm_len,
char * val, size_t d_len);
static void
remove_continuation(char * src)
{
- char* pzD;
+ char * pzD;
do {
while (*src == NL) src++;
/**
* Find the end of a quoted string, skipping escaped quote characters.
*/
-static char const*
-scan_q_str(char const* pzTxt)
+static char const *
+scan_q_str(char const * pzTxt)
{
char q = *(pzTxt++); /* remember the type of quote */
add_string(void ** pp, char const * name, size_t nm_len,
char const * val, size_t d_len)
{
- tOptionValue* pNV;
+ tOptionValue * pNV;
size_t sz = nm_len + d_len + sizeof(*pNV);
pNV = AGALOC(sz, "option name/str value pair");
else new_val->v.boolVal = ! IS_FALSE_TYPE_CHAR(*val);
new_val->valType = OPARG_TYPE_BOOLEAN;
- new_val->pzName = (char*)(new_val + 1);
+ new_val->pzName = (char *)(new_val + 1);
memcpy(new_val->pzName, name, nm_len);
new_val->pzName[ nm_len ] = NUL;
addArgListEntry(pp, new_val);
*
* @returns the new value structure
*/
-static tOptionValue*
+static tOptionValue *
add_number(void ** pp, char const * name, size_t nm_len,
char const * val, size_t d_len)
{
new_val->v.longVal = strtol(val, 0, 0);
new_val->valType = OPARG_TYPE_NUMERIC;
- new_val->pzName = (char*)(new_val + 1);
+ new_val->pzName = (char *)(new_val + 1);
memcpy(new_val->pzName, name, nm_len);
new_val->pzName[ nm_len ] = NUL;
addArgListEntry(pp, new_val);
*
* @returns the new value structure
*/
-static tOptionValue*
+static tOptionValue *
add_nested(void ** pp, char const * name, size_t nm_len,
char * val, size_t d_len)
{
- tOptionValue* new_val;
+ tOptionValue * new_val;
if (d_len == 0) {
size_t sz = nm_len + sizeof(*new_val) + 1;
new_val = AGALOC(sz, "empty nest");
new_val->v.nestVal = NULL;
new_val->valType = OPARG_TYPE_HIERARCHY;
- new_val->pzName = (char*)(new_val + 1);
+ new_val->pzName = (char *)(new_val + 1);
memcpy(new_val->pzName, name, nm_len);
new_val->pzName[ nm_len ] = NUL;
static char const *
scan_name(char const * name, tOptionValue * res)
{
- tOptionValue* new_val;
- char const * pzScan = name+1; /* we know first char is a name char */
- char const * pzVal;
- size_t nm_len = 1;
- size_t d_len = 0;
+ tOptionValue * new_val;
+ char const * pzScan = name+1; /* we know first char is a name char */
+ char const * pzVal;
+ size_t nm_len = 1;
+ size_t d_len = 0;
/*
* Scan over characters that name a value. These names may not end
char const ** pnew_val = arg_list->apzArgs;
while (ct-- > 0) {
- tOptionValue* new_val = (tOptionValue*)(void*)(intptr_t)*(pnew_val++);
+ tOptionValue * new_val = (tOptionValue *)VOIDP(*(pnew_val++));
if (new_val->valType == OPARG_TYPE_HIERARCHY)
unload_arg_list(new_val->v.nestVal);
AGFREE(new_val);
}
- AGFREE((void*)arg_list);
+ AGFREE(arg_list);
}
/*=export_func optionUnloadNested
unload_arg_list(opt_val->v.nestVal);
- AGFREE((void*)(intptr_t)opt_val);
+ AGFREE(opt_val);
}
/**
*/
for (ix = 0; ++ix < lm;) {
int iy = ix-1;
- tOptionValue * new_v = C(tOptionValue *, (intptr_t)arg_list->apzArgs[ix]);
- tOptionValue * old_v = C(tOptionValue *, (intptr_t)arg_list->apzArgs[iy]);
+ tOptionValue * new_v = C(tOptionValue *, arg_list->apzArgs[ix]);
+ tOptionValue * old_v = C(tOptionValue *, arg_list->apzArgs[iy]);
/*
* For as long as the new entry precedes the "old" entry,
* "-1" entry.
*/
while (strcmp(old_v->pzName, new_v->pzName) > 0) {
- arg_list->apzArgs[iy+1] = (void*)old_v;
- old_v = (tOptionValue*)(void*)(intptr_t)(arg_list->apzArgs[--iy]);
+ arg_list->apzArgs[iy+1] = VOIDP(old_v);
+ old_v = (tOptionValue *)VOIDP(arg_list->apzArgs[--iy]);
if (iy < 0)
break;
}
* Always store the pointer. Sometimes it is redundant,
* but the redundancy is cheaper than a test and branch sequence.
*/
- arg_list->apzArgs[iy+1] = (void*)new_v;
+ arg_list->apzArgs[iy+1] = VOIDP(new_v);
}
}
* arg: + char const * + pzName + the name for the text +
* arg: + size_t + nm_len + the length of "name" +
*
- * ret_type: tOptionValue*
+ * ret_type: tOptionValue *
* ret_desc: An allocated, compound value structure
*
* doc:
LOCAL tOptionValue *
optionLoadNested(char const * text, char const * name, size_t nm_len)
{
- tOptionValue* res_val;
+ tOptionValue * res_val;
/*
* Make sure we have some data and we have space to put what we find.
}
res_val = AGALOC(sizeof(*res_val) + nm_len + 1, "nest args");
res_val->valType = OPARG_TYPE_HIERARCHY;
- res_val->pzName = (char*)(res_val + 1);
+ res_val->pzName = (char *)(res_val + 1);
memcpy(res_val->pzName, name, nm_len);
res_val->pzName[nm_len] = NUL;
* private:
*
* what: parse a hierarchical option argument
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + tOptDesc* + od + the descriptor for this arg +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + tOptDesc * + od + the descriptor for this arg +
*
* doc:
* Nested value was found on the command line
av = arg_list->apzArgs;
while (--ct >= 0) {
- void * p = (void *)(intptr_t)*(av++);
+ void * p = VOIDP(*(av++));
optionUnloadNested((tOptionValue const *)p);
}
od->optArg.argString, od->pz_Name, strlen(od->pz_Name));
if (opt_val != NULL)
- addArgListEntry(&(od->optCookie), (void*)opt_val);
+ addArgListEntry(&(od->optCookie), VOIDP(opt_val));
}
}
base = 16;
pz++;
}
- retch = (int)strtoul(pz, (char **)(intptr_t)&pz, base);
+ retch = (int)strtoul(pz, (char **)&pz, base);
if (*pz != ';')
return '&';
base = (int)(++pz - *ppz);
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
* private:
*
* what: Show info about range constraints
- * arg: + tOptions* + pOpts + program options descriptor +
- * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
- * arg: + void * + rng_table + the value range tables +
- * arg: + int + rng_count + the number of entries +
+ * arg: + tOptions * + pOpts + program options descriptor +
+ * arg: + tOptDesc * + pOptDesc + the descriptor for this arg +
+ * arg: + void * + rng_table + the value range tables +
+ * arg: + int + rng_count + the number of entries +
*
* doc:
* Show information about a numeric option with range constraints.
=*/
void
-optionShowRange(tOptions * pOpts, tOptDesc * pOD, const void * rng_table, int rng_ct)
+optionShowRange(tOptions * pOpts, tOptDesc * pOD, void * rng_table, int rng_ct)
{
const struct {long const rmin, rmax;} * rng = rng_table;
* private:
*
* what: process an option with a numeric value.
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + tOptDesc* + od + the descriptor for this arg +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + tOptDesc * + od + the descriptor for this arg +
*
* doc:
* Decipher a numeric value.
void
optionNumericVal(tOptions * opts, tOptDesc * od)
{
- char* pz;
- long val;
+ char * pz;
+ long val;
/*
* Guard against all the different ways this procedure might get invoked
*
* DO NOT EDIT THIS FILE (stdin.c)
*
- * It has been AutoGen-ed August 8, 2014 at 04:09:05 PM by AutoGen 5.18.4pre11
+ * It has been AutoGen-ed
* From the definitions stdin
* and the template file str2enum
*
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "option-value-type.h"
-/* ANSI-C code produced by gperf version 3.0.3 */
+/* ANSI-C code produced by gperf version 3.0.4 */
/* Command-line: gperf option-value-type.gp */
/* Computed positions: -k'1' */
*
* DO NOT EDIT THIS FILE (stdin.h)
*
- * It has been AutoGen-ed August 8, 2014 at 04:09:05 PM by AutoGen 5.18.4pre11
+ * It has been AutoGen-ed
* From the definitions stdin
* and the template file str2enum
*
*
* DO NOT EDIT THIS FILE (stdin.c)
*
- * It has been AutoGen-ed August 8, 2014 at 04:09:04 PM by AutoGen 5.18.4pre11
+ * It has been AutoGen-ed
* From the definitions stdin
* and the template file str2enum
*
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "option-xat-attribute.h"
-/* ANSI-C code produced by gperf version 3.0.3 */
+/* ANSI-C code produced by gperf version 3.0.4 */
/* Command-line: gperf option-xat-attribute.gp */
/* Computed positions: -k'1' */
*
* DO NOT EDIT THIS FILE (stdin.h)
*
- * It has been AutoGen-ed August 8, 2014 at 04:09:04 PM by AutoGen 5.18.4pre11
+ * It has been AutoGen-ed
* From the definitions stdin
* and the template file str2enum
*
/* Parse a time duration and return a seconds count
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 Free Software Foundation, Inc.
Written by Bruce Korb <bkorb@gnu.org>, 2008.
This program is free software: you can redistribute it and/or modify
static unsigned long
str_const_to_ul (cch_t * str, cch_t ** ppz, int base)
{
- return strtoul (str, (char **)(intptr_t)ppz, base);
+ return strtoul (str, (char **)ppz, base);
}
/* Wrapper around strtol that does not require a cast. */
static long
str_const_to_l (cch_t * str, cch_t ** ppz, int base)
{
- return strtol (str, (char **)(intptr_t)ppz, base);
+ return strtol (str, (char **)ppz, base);
}
/* Returns BASE + VAL * SCALE, interpreting BASE = BAD_TIME
/* Parse a time duration and return a seconds count
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
+ Copyright (C) 2008-2015 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-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
*/
#if defined(HAVE_WORKING_FORK)
-static FILE *
+static inline FILE *
open_tmp_usage(char ** buf)
{
char * bf;
}
}
-static char *
+static inline char *
mk_pager_cmd(char const * fname)
{
/*
if (pager == NULL)
pager = MORE_STR;
- bfsz = strlen(fname) + strlen(pager) + PAGE_USAGE_FMT_LEN;
+ bfsz = 2 * strlen(fname) + strlen(pager) + PAGE_USAGE_FMT_LEN;
res = AGALOC(bfsz, "more cmd");
snprintf(res, bfsz, PAGE_USAGE_FMT, pager, fname);
- AGFREE((void*)(intptr_t)fname);
+ AGFREE(fname);
return res;
}
}
/* -*- buffer-read-only: t -*- vi: set ro:
*
* Prototypes for autoopts
- * Generated Fri Aug 8 16:09:18 PDT 2014
+ * Generated Sat Apr 25 09:53:18 PDT 2015
*/
#ifndef AUTOOPTS_PROTO_H_GUARD
#define AUTOOPTS_PROTO_H_GUARD 1
opt_find_long(tOptions * opts, char const * opt_name, tOptState * state);
static tSuccess
-opt_find_short(tOptions* pOpts, uint_t optValue, tOptState* pOptState);
+opt_find_short(tOptions * pOpts, uint_t optValue, tOptState * pOptState);
static tSuccess
get_opt_arg(tOptions * opts, tOptState * o_st);
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
uintptr_t val = 1;
printf(zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME,
(int)(uintptr_t)(pOD->optCookie));
- pOD->optCookie = (void*)(uintptr_t)~0UL;
+ pOD->optCookie = VOIDP(~0UL);
(*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD);
pz = pOD->optArg.argString;
static void
print_stacked_arg(tOptions * pOpts, tOptDesc * pOD)
{
- tArgList* pAL = (tArgList*)pOD->optCookie;
+ tArgList * pAL = (tArgList *)pOD->optCookie;
char const ** ppz = pAL->apzArgs;
int ct = pAL->useCt;
/*=export_func optionPutShell
* what: write a portable shell script to parse options
* private:
- * arg: tOptions*, pOpts, the program options descriptor
+ * arg: tOptions *, pOpts, the program options descriptor
* doc: This routine will emit portable shell script text for parsing
* the options described in the option definitions.
=*/
void
-optionPutShell(tOptions* pOpts)
+optionPutShell(tOptions * pOpts)
{
int optIx = 0;
printf(zOptCtFmt, pOpts->curOptIdx-1);
do {
- tOptDesc* pOD = pOpts->pOptDesc + optIx;
+ tOptDesc * pOD = pOpts->pOptDesc + optIx;
if ((pOD->fOptState & OPTST_NO_OUTPUT_MASK) != 0)
continue;
* but copy over the set-state bits.
*/
if (pOD->optActualIndex != optIx) {
- tOptDesc* p = pOpts->pOptDesc + pOD->optActualIndex;
+ tOptDesc * p = pOpts->pOptDesc + pOD->optActualIndex;
p->optArg = pOD->optArg;
p->fOptState &= OPTST_PERSISTENT_MASK;
p->fOptState |= pOD->fOptState & ~OPTST_PERSISTENT_MASK;
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
*/
static void
-optionReset( tOptions* pOpts, tOptDesc* pOD )
+optionReset(tOptions * pOpts, tOptDesc * pOD)
{
pOD->fOptState &= OPTST_PERSISTENT_MASK;
pOD->fOptState |= OPTST_RESET;
* private:
*
* what: Reset the value of an option
- * arg: + tOptions* + pOpts + program options descriptor +
- * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ * arg: + tOptions * + pOpts + program options descriptor +
+ * arg: + tOptDesc * + pOptDesc + the descriptor for this arg +
*
* doc:
* This code will cause another option to be reset to its initial state.
assert(0 == 1);
}
} else {
- succ = opt_find_long(pOpts, (char *)(intptr_t)pzArg, &opt_state);
+ succ = opt_find_long(pOpts, (char *)pzArg, &opt_state);
if (! SUCCESSFUL(succ)) {
fprintf(stderr, zIllOptStr, pOpts->pzProgPath, pzArg);
pOpts->pUsageProc(pOpts, EXIT_FAILURE);
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
* have been marked as allocated though.
*/
static void
-fixupSavedOptionArgs(tOptions* pOpts)
+fixupSavedOptionArgs(tOptions * pOpts)
{
- tOptions* p = pOpts->pSavedState;
- tOptDesc* pOD = pOpts->pOptDesc;
- int ct = pOpts->optCt;
+ tOptions * p = pOpts->pSavedState;
+ tOptDesc * pOD = pOpts->pOptDesc;
+ int ct = pOpts->optCt;
/*
* Make sure that allocated stuff is only referenced in the
switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
case OPARG_TYPE_STRING:
if (pOD->fOptState & OPTST_STACKED) {
- tOptDesc* q = p->pOptDesc + (pOD - pOpts->pOptDesc);
+ tOptDesc * q = p->pOptDesc + (pOD - pOpts->pOptDesc);
q->optCookie = NULL;
}
if (pOD->fOptState & OPTST_ALLOC_ARG) {
- tOptDesc* q = p->pOptDesc + (pOD - pOpts->pOptDesc);
+ tOptDesc * q = p->pOptDesc + (pOD - pOpts->pOptDesc);
AGDUPSTR(q->optArg.argString, pOD->optArg.argString, "arg");
}
break;
case OPARG_TYPE_HIERARCHY:
{
- tOptDesc* q = p->pOptDesc + (pOD - pOpts->pOptDesc);
+ tOptDesc * q = p->pOptDesc + (pOD - pOpts->pOptDesc);
q->optCookie = NULL;
}
}
/*=export_func optionSaveState
*
* what: saves the option state to memory
- * arg: tOptions*, pOpts, program options descriptor
+ * arg: tOptions *, pOpts, program options descriptor
*
* doc:
*
void
optionSaveState(tOptions * pOpts)
{
- tOptions * p = (tOptions*)pOpts->pSavedState;
+ tOptions * p = (tOptions *)pOpts->pSavedState;
if (p == NULL) {
size_t sz = sizeof(*pOpts)
/*=export_func optionRestore
*
* what: restore option state from memory copy
- * arg: tOptions*, pOpts, program options descriptor
+ * arg: tOptions *, pOpts, program options descriptor
*
* doc: Copy back the option state from saved memory.
* The allocated memory is left intact, so this routine can be
* printed to @code{stderr} and exit is called.
=*/
void
-optionRestore(tOptions* pOpts)
+optionRestore(tOptions * pOpts)
{
- tOptions* p = (tOptions*)pOpts->pSavedState;
+ tOptions * p = (tOptions *)pOpts->pSavedState;
if (p == NULL) {
char const * pzName = pOpts->pzProgName;
/*=export_func optionFree
*
* what: free allocated option processing memory
- * arg: tOptions*, pOpts, program options descriptor
+ * arg: tOptions *, pOpts, program options descriptor
*
* doc: AutoOpts sometimes allocates memory and puts pointers to it in the
* option state structures. This routine deallocates all such memory.
* this routine is always successful.
=*/
void
-optionFree(tOptions* pOpts)
+optionFree(tOptions * pOpts)
{
free_saved_state:
{
- tOptDesc* p = pOpts->pOptDesc;
+ tOptDesc * p = pOpts->pOptDesc;
int ct = pOpts->optCt;
do {
if (p->fOptState & OPTST_ALLOC_ARG) {
} while (p++, --ct > 0);
}
if (pOpts->pSavedState != NULL) {
- tOptions * p = (tOptions*)pOpts->pSavedState;
+ tOptions * p = (tOptions *)pOpts->pSavedState;
memcpy(pOpts, p, sizeof(*p));
memcpy(pOpts->pOptDesc, p+1, (size_t)p->optCt * sizeof(tOptDesc));
AGFREE(pOpts->pSavedState);
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
* we can stash the RC (INI) file.
*/
{
- char const * const* papz = opts->papzHomeList;
+ char const * const * papz = opts->papzHomeList;
if (papz == NULL)
return NULL;
size_t sz = strlen(pzDir) + strlen(opts->pzRcName) + 2;
{
- char * pzPath = (char*)AGALOC(sz, "file name");
+ char * pzPath = (char *)AGALOC(sz, "file name");
#ifdef HAVE_SNPRINTF
snprintf(pzPath, sz, "%s/%s", pzDir, opts->pzRcName);
#else
* THEN the char pointer is really the number
*/
if (OPTST_GET_ARGTYPE(od->fOptState) == OPARG_TYPE_NUMERIC)
- fprintf(fp, "%d", (int)(t_word)l_arg);
+ fprintf(fp, "%d", (int)(intptr_t)l_arg);
else {
for (;;) {
if (al == NULL)
return;
opt_ct = al->useCt;
- opt_list = (void **)(intptr_t)al->apzArgs;
+ opt_list = (void **)al->apzArgs;
if (opt_ct <= 0) {
fprintf(fp, OPEN_CLOSE_FMT, name);
return;
opt_ct = al->useCt;
- opt_list = (void **)(intptr_t)al->apzArgs;
+ opt_list = (void **)al->apzArgs;
if (opt_ct <= 0)
return;
* normally point to static data that is overwritten by each call.
* The test to detect allocated ctime, so we leak the memory.
*/
- AGFREE((void*)time_str);
+ AGFREE(time_str);
#endif
}
prt_str_arg(FILE * fp, tOptDesc * pOD)
{
if (pOD->fOptState & OPTST_STACKED) {
- tArgList * pAL = (tArgList*)pOD->optCookie;
+ tArgList * pAL = (tArgList *)pOD->optCookie;
int uct = pAL->useCt;
char const ** ppz = pAL->apzArgs;
* bit flag values back into a string suitable for printing.
*/
(*(od->pOptProc))(OPTPROC_RETURN_VALNAME, od);
- prt_entry(fp, od, (void*)(intptr_t)(od->optArg.argString));
+ prt_entry(fp, od, VOIDP(od->optArg.argString));
od->optArg.argEnum = val;
}
*
* what: saves the option state to a file
*
- * arg: tOptions*, opts, program options descriptor
+ * arg: tOptions *, opts, program options descriptor
*
* doc:
*
break;
case OPARG_TYPE_NUMERIC:
- prt_entry(fp, p, (void*)(p->optArg.argInt));
+ prt_entry(fp, p, VOIDP(p->optArg.argInt));
break;
case OPARG_TYPE_STRING:
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
/*
* Make sure we can allocate two full-sized arg vectors.
*/
- opt_txt = malloc(opts->origArgCt * sizeof(char*));
+ opt_txt = malloc(opts->origArgCt * sizeof(char *));
if (opt_txt == NULL)
goto exit_no_mem;
- ppzOpds = malloc(opts->origArgCt * sizeof(char*));
+ ppzOpds = malloc(opts->origArgCt * sizeof(char *));
if (ppzOpds == NULL) {
free(opt_txt);
goto exit_no_mem;
joinLists:
if (optsIdx > 0)
memcpy(opts->origArgVect + 1, opt_txt,
- (size_t)optsIdx * sizeof(char*));
+ (size_t)optsIdx * sizeof(char *));
if (opdsIdx > 0)
memcpy(opts->origArgVect + 1 + optsIdx, ppzOpds,
- (size_t)opdsIdx * sizeof(char*));
+ (size_t)opdsIdx * sizeof(char *));
freeTemps:
free(opt_txt);
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
* private:
*
* what: Remove option args from a stack
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + tOptDesc* + od + the descriptor for this arg +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + tOptDesc * + od + the descriptor for this arg +
*
* doc:
* Invoked for options that are equivalenced to stacked options.
if (INQUERY_CALL(opts, od))
return;
- arg_list = (tArgList*)od->optCookie;
+ arg_list = (tArgList *)od->optCookie;
/*
* IF we don't have any stacked options,
od->fOptState &= OPTST_PERSISTENT_MASK;
if ((od->fOptState & OPTST_INITENABLED) == 0)
od->fOptState |= OPTST_DISABLED;
- AGFREE((void *)arg_list);
+ AGFREE(arg_list);
od->optCookie = NULL;
}
}
LOCAL void
addArgListEntry(void ** ppAL, void * entry)
{
- tArgList* pAL = *(void**)ppAL;
+ tArgList * pAL = *(void **)ppAL;
/*
* IF we have never allocated one of these,
* THEN allocate one now
*/
if (pAL == NULL) {
- pAL = (tArgList*)AGALOC(sizeof(*pAL), "new option arg stack");
+ pAL = (tArgList *)AGALOC(sizeof(*pAL), "new option arg stack");
if (pAL == NULL)
return;
pAL->useCt = 0;
pAL->allocCt = MIN_ARG_ALLOC_CT;
- *ppAL = (void*)pAL;
+ *ppAL = VOIDP(pAL);
}
/*
* The base structure contains space for MIN_ARG_ALLOC_CT
* pointers. We subtract it off to find our augment size.
*/
- sz += sizeof(char*) * ((size_t)pAL->allocCt - MIN_ARG_ALLOC_CT);
- pAL = (tArgList*)AGREALOC((void*)pAL, sz, "expanded opt arg stack");
+ sz += sizeof(char *) * ((size_t)pAL->allocCt - MIN_ARG_ALLOC_CT);
+ pAL = (tArgList *)AGREALOC(VOIDP(pAL), sz, "expanded opt arg stack");
if (pAL == NULL)
return;
- *ppAL = (void*)pAL;
+ *ppAL = VOIDP(pAL);
}
/*
* private:
*
* what: put option args on a stack
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + tOptDesc* + od + the descriptor for this arg +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + tOptDesc * + od + the descriptor for this arg +
*
* doc:
* Keep an entry-ordered list of option arguments.
return;
if ((od->fOptState & OPTST_RESET) != 0) {
- tArgList * arg_list = (void*)od->optCookie;
+ tArgList * arg_list = od->optCookie;
int ix;
if (arg_list == NULL)
return;
return;
AGDUPSTR(pz, od->optArg.argString, "stack arg");
- addArgListEntry(&(od->optCookie), (void*)pz);
+ addArgListEntry(&(od->optCookie), VOIDP(pz));
}
}
/** @}
/* A substitute for ISO C11 <stdnoreturn.h>.
- Copyright 2012-2014 Free Software Foundation, Inc.
+ Copyright 2012-2015 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
*
* what: compare two strings with an equivalence mapping
*
- * arg: + char const* + str1 + first string +
- * arg: + char const* + str2 + second string +
- * arg: + int + ct + compare length +
+ * arg: + char const * + str1 + first string +
+ * arg: + char const * + str2 + second string +
+ * arg: + int + ct + compare length +
*
* ret_type: int
* ret_desc: the difference between two differing characters
*
* what: compare two strings with an equivalence mapping
*
- * arg: + char const* + str1 + first string +
- * arg: + char const* + str2 + second string +
+ * arg: + char const * + str1 + first string +
+ * arg: + char const * + str2 + second string +
*
* ret_type: int
* ret_desc: the difference between two differing characters
*
* what: map a list of characters to the same value
*
- * arg: + char const* + ch_list + characters to equivalence +
+ * arg: + char const * + ch_list + characters to equivalence +
*
* doc:
*
* err: none.
=*/
void
-strequate(char const* s)
+strequate(char const * s)
{
if ((s != NULL) && (*s != NUL)) {
unsigned char equiv = (unsigned char)*s;
*
* what: convert a string into its mapped-to value
*
- * arg: + char* + dest + output string +
- * arg: + char const* + src + input string +
+ * arg: + char * + dest + output string +
+ * arg: + char const * + src + input string +
*
* doc:
*
* err: none.
=*/
void
-strtransform(char* d, char const* s)
+strtransform(char * d, char const * s)
{
do {
*(d++) = (char)charmap[(unsigned char)*s];
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
#define FILE_WRITABLE(_prt,_flg) \
( (_prt & PROT_WRITE) \
&& ((_flg & (MAP_SHARED|MAP_PRIVATE)) == MAP_SHARED))
-#define MAP_FAILED_PTR ((void*)MAP_FAILED)
+#define MAP_FAILED_PTR (VOIDP(MAP_FAILED))
/**
* Load the contents of a text file. There are two separate implementations,
{
size_t sz = mapinfo->txt_size;
- char* pz = mapinfo->txt_data;
+ char * pz = mapinfo->txt_data;
while (sz > 0) {
ssize_t rdct = read(mapinfo->txt_fd, pz, sz);
*
* what: map a text file with terminating NUL
*
- * arg: char const*, pzFile, name of the file to map
- * arg: int, prot, mmap protections (see mmap(2))
- * arg: int, flags, mmap flags (see mmap(2))
- * arg: tmap_info_t*, mapinfo, returned info about the mapping
+ * arg: char const *, pzFile, name of the file to map
+ * arg: int, prot, mmap protections (see mmap(2))
+ * arg: int, flags, mmap flags (see mmap(2))
+ * arg: tmap_info_t *, mapinfo, returned info about the mapping
*
- * ret-type: void*
+ * ret-type: void *
* ret-desc: The mmaped data address
*
* doc:
* #include <mylib.h>
* tmap_info_t mi;
* int no_nul;
- * void* data = text_mmap("file", PROT_WRITE, MAP_PRIVATE, &mi);
+ * void * data = text_mmap("file", PROT_WRITE, MAP_PRIVATE, &mi);
* if (data == MAP_FAILED) return;
* no_nul = (mi.txt_size == mi.txt_full_size);
* << use the data >>
*
* what: unmap the data mapped in by text_mmap
*
- * arg: tmap_info_t*, mapinfo, info about the mapping
+ * arg: tmap_info_t *, mapinfo, info about the mapping
*
* ret-type: int
* ret-desc: -1 or 0. @code{errno} will have the error code.
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
* private:
*
* what: process an option with a time duration.
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + tOptDesc* + od + the descriptor for this arg +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + tOptDesc * + od + the descriptor for this arg +
*
* doc:
* Decipher a time duration value.
* private:
*
* what: process an option with a time and date.
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + tOptDesc* + od + the descriptor for this arg +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + tOptDesc * + od + the descriptor for this arg +
*
* doc:
* Decipher a time and date value.
* 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-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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 void
-copy_cooked(ch_t** ppDest, char const ** ppSrc);
+copy_cooked(ch_t ** ppDest, char const ** ppSrc);
static void
-copy_raw(ch_t** ppDest, char const ** ppSrc);
+copy_raw(ch_t ** ppDest, char const ** ppSrc);
static token_list_t *
alloc_token_list(char const * str);
/* = = = END-STATIC-FORWARD = = = */
static void
-copy_cooked(ch_t** ppDest, char const ** ppSrc)
+copy_cooked(ch_t ** ppDest, char const ** ppSrc)
{
- ch_t* pDest = (ch_t*)*ppDest;
- const ch_t* pSrc = (const ch_t*)(*ppSrc + 1);
+ ch_t * pDest = (ch_t *)*ppDest;
+ const ch_t * pSrc = (const ch_t *)(*ppSrc + 1);
for (;;) {
ch_t ch = *(pSrc++);
case NUL: *ppSrc = NULL; return;
case '"': goto done;
case '\\':
- pSrc += ao_string_cook_escape_char((char*)(intptr_t)pSrc, (char*)(intptr_t)&ch, 0x7F);
+ pSrc += ao_string_cook_escape_char((char *)pSrc, (char *)&ch, 0x7F);
if (ch == 0x7F)
break;
/* FALLTHROUGH */
}
done:
- *ppDest = (ch_t*)pDest; /* next spot for storing character */
+ *ppDest = (ch_t *)pDest; /* next spot for storing character */
*ppSrc = (char const *)pSrc; /* char following closing quote */
}
static void
-copy_raw(ch_t** ppDest, char const ** ppSrc)
+copy_raw(ch_t ** ppDest, char const ** ppSrc)
{
- ch_t* pDest = *ppDest;
- cc_t* pSrc = (cc_t*) (*ppSrc + 1);
+ ch_t * pDest = *ppDest;
+ cc_t * pSrc = (cc_t *) (*ppSrc + 1);
for (;;) {
ch_t ch = *(pSrc++);
} while (*pz != NUL);
res = malloc(sizeof(*res) + (size_t)(pz - str)
- + ((size_t)max_token_ct * sizeof(ch_t*)));
+ + ((size_t)max_token_ct * sizeof(ch_t *)));
}
if (res == NULL)
errno = ENOMEM;
- else res->tkn_list[0] = (ch_t*)(res->tkn_list + (max_token_ct - 1));
+ else res->tkn_list[0] = (ch_t *)(res->tkn_list + (max_token_ct - 1));
return res;
*
* what: tokenize an input string
*
- * arg: + char const* + string + string to be tokenized +
+ * arg: + char const * + string + string to be tokenized +
*
- * ret_type: token_list_t*
+ * ret_type: token_list_t *
* ret_desc: pointer to a structure that lists each token
*
* doc:
* @example
* #include <stdlib.h>
* int ix;
- * token_list_t* ptl = ao_string_tokenize(some_string)
+ * token_list_t * ptl = ao_string_tokenize(some_string)
* for (ix = 0; ix < ptl->tkn_ct; ix++)
* do_something_with_tkn(ptl->tkn_list[ix]);
* free(ptl);
* @code{ENOMEM} - There is not enough memory.
* @end itemize
=*/
-token_list_t*
-ao_string_tokenize(char const* str)
+token_list_t *
+ao_string_tokenize(char const * str)
{
- token_list_t* res = alloc_token_list(str);
- ch_t* pzDest;
+ token_list_t * res = alloc_token_list(str);
+ ch_t * pzDest;
/*
* Now copy each token into the output buffer.
if (res == NULL)
return res;
- pzDest = (ch_t*)(res->tkn_list[0]);
+ pzDest = (ch_t *)(res->tkn_list[0]);
res->tkn_ct = 0;
do {
#include <string.h>
int
-main(int argc, char** argv)
+main(int argc, char ** argv)
{
if (argc == 1) {
printf("USAGE: %s arg [ ... ]\n", *argv);
return 1;
}
while (--argc > 0) {
- char* arg = *(++argv);
- token_list_t* p = ao_string_tokenize(arg);
+ char * arg = *(++argv);
+ token_list_t * p = ao_string_tokenize(arg);
if (p == NULL) {
printf("Parsing string ``%s'' failed:\n\terrno %d (%s)\n",
arg, errno, strerror(errno));
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
/*=export_func optionOnlyUsage
*
* what: Print usage text for just the options
- * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptions * + pOpts + program options descriptor +
* arg: + int + ex_code + exit code for calling exit(3) +
*
* doc:
* private:
*
* what: Print usage text
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + int + exitCode + exit code for calling exit(3) +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + int + exitCode + exit code for calling exit(3) +
*
* doc:
* This routine will print usage in both GNU-standard and AutoOpts-expanded
/*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
- * AutoOpts is Copyright (C) 1992-2014 by Bruce Korb - all rights reserved
+ * AutoOpts is Copyright (C) 1992-2015 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
/*=export_func optionVersion
*
* what: return the compiled AutoOpts version number
- * ret_type: char const*
+ * ret_type: char const *
* ret_desc: the version string in constant memory
* doc:
* Returns the full version string compiled into the library.
* The returned string cannot be modified.
=*/
-char const*
+char const *
optionVersion(void)
{
static char const ver[] = OPTIONS_DOTTED_VERSION;
/*=export_func optionPrintVersion
*
* what: Print the program version
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + tOptDesc* + od + the descriptor for this arg +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + tOptDesc * + od + the descriptor for this arg +
*
* doc:
* This routine will print the version to stdout.
/*=export_func optionPrintVersionAndReturn
*
* what: Print the program version
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + tOptDesc* + od + the descriptor for this arg +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + tOptDesc * + od + the descriptor for this arg +
*
* doc:
* This routine will print the version to stdout and return
* private:
*
* what: Print the program version to stderr
- * arg: + tOptions* + opts + program options descriptor +
- * arg: + tOptDesc* + od + the descriptor for this arg +
+ * arg: + tOptions * + opts + program options descriptor +
+ * arg: + tOptDesc * + od + the descriptor for this arg +
*
* doc:
* This routine will print the version to stderr.