From: Harlan Stenn Date: Fri, 22 Feb 2013 01:52:51 +0000 (+0000) Subject: Upgrade to autogen-5.17.2pre and libopts-38.0.13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e309f47e3f77d4f74ff9a19c2a059d8bd76fab2b;p=thirdparty%2Fntp.git Upgrade to autogen-5.17.2pre and libopts-38.0.13 bk: 5126cf737r2YepgHcJX68BbI2GAkiw --- diff --git a/ChangeLog b/ChangeLog index 83a4a22579..7095f50491 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* Upgrade to autogen-5.17.2pre and libopts-38.0.13. (4.2.7p356) 2013/02/19 Released by Harlan Stenn * Added loc/debian. (4.2.7p355) 2013/02/18 Released by Harlan Stenn diff --git a/sntp/libopts/Makefile.am b/sntp/libopts/Makefile.am index 102de235d4..c6e59e1c28 100644 --- a/sntp/libopts/Makefile.am +++ b/sntp/libopts/Makefile.am @@ -7,16 +7,16 @@ noinst_LTLIBRARIES = libopts.la endif libopts_la_SOURCES = libopts.c libopts_la_CPPFLAGS = -I$(top_srcdir) -libopts_la_LDFLAGS = -version-info 37:1:12 +libopts_la_LDFLAGS = -version-info 38:0:13 EXTRA_DIST = \ COPYING.gplv3 COPYING.lgplv3 COPYING.mbsd \ MakeDefs.inc README ag-char-map.h \ alias.c ao-strs.c ao-strs.h \ - autoopts/options.h autoopts/usage-txt.h autoopts/project.h \ + autoopts/usage-txt.h autoopts/project.h autoopts/options.h \ autoopts.c autoopts.h boolean.c \ check.c compat/pathfind.c compat/snprintf.c \ - compat/strchr.c compat/windows-config.h compat/strdup.c \ - compat/compat.h configfile.c cook.c \ + compat/strdup.c compat/compat.h compat/windows-config.h \ + compat/strchr.c configfile.c cook.c \ enum.c env.c file.c \ find.c genshell.c genshell.h \ gettext.h init.c load.c \ diff --git a/sntp/libopts/ag-char-map.h b/sntp/libopts/ag-char-map.h index ff8e2dc52d..4b71cf0d2e 100644 --- a/sntp/libopts/ag-char-map.h +++ b/sntp/libopts/ag-char-map.h @@ -1,6 +1,6 @@ /* * 29 bits for 46 character classifications - * generated by char-mapper on 01/04/13 at 16:15:42 + * generated by char-mapper on 02/21/13 at 12:28:29 * * This file contains the character classifications * used by AutoGen and AutoOpts for identifying tokens. @@ -20,11 +20,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ #ifndef AG_CHAR_MAP_H_GUARD #define AG_CHAR_MAP_H_GUARD 1 diff --git a/sntp/libopts/alias.c b/sntp/libopts/alias.c index a4d44b6516..d05cc4be9b 100644 --- a/sntp/libopts/alias.c +++ b/sntp/libopts/alias.c @@ -2,8 +2,12 @@ /** * \file alias.c * - * Automated Options Paged Usage module. + * Handle options that are aliases for another option. * + * @addtogroup autoopts + * @{ + */ +/* * This routine will forward an option alias to the correct option code. * * This file is part of AutoOpts, a companion to AutoGen. @@ -20,20 +24,39 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ +LOCAL tSuccess +too_many_occurrences(tOptions * opts, tOptDesc * od) +{ + if ((opts->fOptSet & OPTPROC_ERRSTOP) != 0) { + char const * eqv = (od->optEquivIndex != NO_EQUIVALENT) ? zequiv : zNil; + + fprintf(stderr, ztoo_often_fmt, opts->pzProgName); + + if (od->optMaxCt > 1) + fprintf(stderr, zat_most, od->optMaxCt, od->pz_Name, eqv); + else + fprintf(stderr, zonly_one, od->pz_Name, eqv); + (*opts->pUsageProc)(opts, EXIT_FAILURE); + /* NOTREACHED */ + } + + return FAILURE; +} + /*=export_func optionAlias * private: * * what: relay an option to its alias - * arg: + tOptions* + pOpts + program options descriptor + - * arg: + tOptDesc* + pOptDesc + the descriptor for this arg + - * arg: + unsigned int + alias + the aliased-to option index + + * arg: + tOptions * + opts + program options descriptor + + * arg: + tOptDesc * + old_od + the descriptor for this arg + + * arg: + unsigned int + alias + the aliased-to option index + * ret-type: int * * doc: @@ -41,63 +64,50 @@ * Returns "-1" if the aliased-to option has appeared too many times. =*/ int -optionAlias(tOptions * pOpts, tOptDesc * pOldOD, unsigned int alias) +optionAlias(tOptions * opts, tOptDesc * old_od, unsigned int alias) { - tOptDesc * pOD; + tOptDesc * new_od; - if (pOpts <= OPTPROC_EMIT_LIMIT) + if (opts <= OPTPROC_EMIT_LIMIT) return 0; - pOD = pOpts->pOptDesc + alias; - if ((unsigned)pOpts->optCt <= alias) { - fwrite(zAliasRange, strlen (zAliasRange), 1, stderr); + new_od = opts->pOptDesc + alias; + if ((unsigned)opts->optCt <= alias) { + fputs(zbad_alias_id, stderr); exit(EXIT_FAILURE); } /* * Copy over the option instance flags */ - pOD->fOptState &= OPTST_PERSISTENT_MASK; - pOD->fOptState |= (pOldOD->fOptState & ~OPTST_PERSISTENT_MASK); - pOD->optArg.argString = pOldOD->optArg.argString; + new_od->fOptState &= OPTST_PERSISTENT_MASK; + new_od->fOptState |= (old_od->fOptState & ~OPTST_PERSISTENT_MASK); + new_od->optArg.argString = old_od->optArg.argString; /* * Keep track of count only for DEFINED (command line) options. * IF we have too many, build up an error message and bail. */ - if ( (pOD->fOptState & OPTST_DEFINED) - && (++pOD->optOccCt > pOD->optMaxCt) ) { - - if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) { - char const * pzEqv = - (pOD->optEquivIndex != NO_EQUIVALENT) ? zEquiv : zNil; - - fputs(zErrOnly, stderr); - - if (pOD->optMaxCt > 1) - fprintf(stderr, zAtMost, pOD->optMaxCt, pOD->pz_Name, pzEqv); - else - fprintf(stderr, zOnlyOne, pOD->pz_Name, pzEqv); - } - - return -1; - } + if ( (new_od->fOptState & OPTST_DEFINED) + && (++new_od->optOccCt > new_od->optMaxCt) ) + return too_many_occurrences(opts, new_od); /* * Clear the state bits and counters */ - pOldOD->fOptState &= OPTST_PERSISTENT_MASK; - pOldOD->optOccCt = 0; + old_od->fOptState &= OPTST_PERSISTENT_MASK; + old_od->optOccCt = 0; /* * If there is a procedure to call, call it */ - if (pOD->pOptProc != NULL) - (*pOD->pOptProc)(pOpts, pOD); + if (new_od->pOptProc != NULL) + (*new_od->pOptProc)(opts, new_od); return 0; } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/ao-strs.c b/sntp/libopts/ao-strs.c index d6b7acc1cd..c3e9ab4fe5 100644 --- a/sntp/libopts/ao-strs.c +++ b/sntp/libopts/ao-strs.c @@ -1,8 +1,8 @@ /* -*- buffer-read-only: t -*- vi: set ro: - * + * * DO NOT EDIT THIS FILE (ao-strs.c) - * - * It has been AutoGen-ed January 4, 2013 at 04:15:42 PM by AutoGen 5.17.1pre14 + * + * It has been AutoGen-ed February 21, 2013 at 12:28:29 PM by AutoGen 5.17.2pre16 * From the definitions ao-strs.def * and the template file strings * @@ -10,7 +10,7 @@ * This is free software. It is licensed for use, modification and * redistribution under the terms of the * Modified (3 clause) Berkeley Software Distribution License - * + * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 3. Neither the name ``Bruce Korb'' nor the name of any other * contributor may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * strings IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -38,118 +38,157 @@ */ #include "ao-strs.h" -char const ao_strs_strtable[6407] = -/* 0 */ " \t\n" +char const ao_strs_strtable[6637] = +/* 0 */ "-_^\0" +/* 4 */ " %s%s\n\0" +/* 12 */ "auto-options\0" +/* 25 */ "program\0" +/* 33 */ "%%-%ds %%s\n\0" +/* 45 */ "\n" + "%s\n\n\0" +/* 51 */ "=file\0" +/* 57 */ "=Mbr\0" +/* 62 */ "=Cplx\0" +/* 68 */ "[=arg]\0" +/* 75 */ "--%2$s%1$s\0" +/* 86 */ "=Tim\0" +/* 91 */ "none\0" +/* 96 */ "# preset/initialization file\n" + "# %s#\n\0" +/* 134 */ " %3s %-14s %s\0" +/* 148 */ "%s\0" +/* 151 */ "T/F\0" +/* 155 */ "\n" + "%s\n\n" + "%s\0" +/* 163 */ "Fil\0" +/* 167 */ "KWd\0" +/* 171 */ "Mbr\0" +/* 175 */ "Cpx\0" +/* 179 */ "no \0" +/* 183 */ "Num\0" +/* 187 */ "opt\0" +/* 191 */ "YES\0" +/* 195 */ "Str\0" +/* 199 */ "Tim\0" +/* 203 */ "\t\t\t\t- \0" +/* 210 */ "\t\t\t\t \0" +/* 217 */ "\t\t\t\t-- and \0" +/* 229 */ "\t\t\t\t%s\n\0" +/* 237 */ " \0" +/* 244 */ " \0" +/* 250 */ " \0" +/* 254 */ " \0" +/* 257 */ "all\0" +/* 261 */ " \t\n" ":=\0" -/* 6 */ "%s_%s_%d=\0" -/* 16 */ "\t\t\t\t- \0" -/* 23 */ "\t\t\t\t \0" -/* 30 */ "''\0" -/* 33 */ " ;;\n\n\0" -/* 46 */ "'\n\n\0" -/* 50 */ "\n\0" -/* 57 */ " %s\n\0" -/* 63 */ "%%-%ds\0" -/* 70 */ "\n" +/* 267 */ "%s_%s_%d=\0" +/* 277 */ "''\0" +/* 280 */ " ;;\n\n\0" +/* 293 */ "'\n\n\0" +/* 297 */ "\n\0" +/* 304 */ " %s\n\0" +/* 310 */ "%%-%ds\0" +/* 317 */ "\n" "export %s_%s_%d\n\0" -/* 88 */ "false\0" -/* 94 */ " -* )\n\0" -/* 104 */ "flag\0" -/* 109 */ "INVALID-%d\0" -/* 120 */ "*INVALID*\0" -/* 130 */ " --* )\n\0" -/* 141 */ "--\0" -/* 144 */ "LONGUSAGE\0" -/* 154 */ " %s\n\0" -/* 170 */ "more\0" -/* 175 */ "<%s type=nested>\n\0" -/* 193 */ "%s\n\0" -/* 197 */ "%s\n" +/* 335 */ "false\0" +/* 341 */ " -* )\n\0" +/* 351 */ "flag\0" +/* 356 */ "INVALID-%d\0" +/* 367 */ "*INVALID*\0" +/* 377 */ "\\n\\\n\0" +/* 382 */ " --* )\n\0" +/* 393 */ "--\0" +/* 396 */ "LONGUSAGE\0" +/* 406 */ " %s\n\0" +/* 422 */ "\\%03o\0" +/* 428 */ "more\0" +/* 433 */ "<%s type=nested>\n\0" +/* 451 */ "%s\n\0" +/* 455 */ "%s\n" " \0" -/* 203 */ "none\0" -/* 208 */ "OPT_ARG_NEEDED=NO\0" -/* 226 */ "<%s/>\n\0" -/* 233 */ "OPT_ARG_NEEDED=OK\0" -/* 251 */ "\t\0" -/* 253 */ "<%s>\0" -/* 258 */ "option\0" -/* 265 */ "\n" +/* 461 */ "OPT_ARG_NEEDED=NO\0" +/* 479 */ "<%s/>\n\0" +/* 486 */ "OPT_ARG_NEEDED=OK\0" +/* 504 */ "\t\0" +/* 506 */ "<%s>\0" +/* 511 */ "option\0" +/* 518 */ "\n" "export %s_%s\n\0" -/* 280 */ "%s_%s=\0" -/* 287 */ " | \0" -/* 291 */ "PAGER\0" -/* 297 */ " + \0" -/* 301 */ "\\'\0" -/* 304 */ "'%s'\0" -/* 309 */ " -- %s\0" -/* 316 */ "%s_%s_TEXT='\0" -/* 329 */ "#! %s\n\0" -/* 336 */ "\n" +/* 533 */ "%s_%s=\0" +/* 540 */ " | \0" +/* 544 */ "PAGER\0" +/* 550 */ " + \0" +/* 554 */ " puts(_(%s));\n\0" +/* 570 */ "\\'\0" +/* 573 */ "'%s'\0" +/* 578 */ " -- %s\0" +/* 585 */ "%s_%s_TEXT='\0" +/* 598 */ "#! %s\n\0" +/* 605 */ "\n" "env | grep '^%s_'\n\0" -/* 356 */ "=%1$lu # 0x%1$lX\n\0" -/* 374 */ "stdout\0" -/* 381 */ "%A %B %e, %Y at %r %Z\0" -/* 403 */ "/tmp/use.%lu\0" -/* 416 */ "true\0" -/* 421 */ " \0" -/* 424 */ "<%s type=%s>\0" -/* 437 */ "VERSION\0" -/* 445 */ "#x%02X;\0" -/* 453 */ "OPT_ARG_NEEDED=YES\0" -/* 472 */ "'\\''\0" -/* 477 */ " '%s'\0" -/* 483 */ "\n" +/* 625 */ "=%1$lu # 0x%1$lX\n\0" +/* 643 */ "stdout\0" +/* 650 */ "%A %B %e, %Y at %r %Z\0" +/* 672 */ "/tmp/use.%lu\0" +/* 685 */ "true\0" +/* 690 */ "<%s type=%s>\0" +/* 703 */ "VERSION\0" +/* 711 */ "#x%02X;\0" +/* 719 */ "OPT_ARG_NEEDED=YES\0" +/* 738 */ "'\\''\0" +/* 743 */ " '%s'\0" +/* 749 */ "\n" "OPTION_CT=0\n\0" -/* 497 */ "set --\0" -/* 504 */ " ;;\n\n\0" -/* 521 */ " '%c' )\n\0" -/* 537 */ " '%s' )\n\0" -/* 553 */ " '%s' | \\\n\0" -/* 571 */ "%1$s /tmp/use.%2$lu ; rm -f /tmp/use.%2$lu\0" -/* 614 */ "<%1$s type=boolean>%2$s\n\0" -/* 646 */ "# From the %s option definitions\n" +/* 763 */ "set --\0" +/* 770 */ " ;;\n\n\0" +/* 787 */ " '%c' )\n\0" +/* 803 */ " '%s' )\n\0" +/* 819 */ " '%s' | \\\n\0" +/* 837 */ "%1$s /tmp/use.%2$lu ; rm -f /tmp/use.%2$lu\0" +/* 880 */ "<%1$s type=boolean>%2$s\n\0" +/* 912 */ "# From the %s option definitions\n" "#\n\0" -/* 683 */ "echo 'Warning: Cannot load options files' >&2\0" -/* 730 */ "echo 'Warning: Cannot save options files' >&2\0" -/* 777 */ "echo 'Warning: Cannot suppress the loading of options files' >&2\0" -/* 843 */ "<%1$s type=integer>0x%2$lX\n\0" -/* 878 */ "%s WARNING: cannot save options - \0" -/* 914 */ "%1$s_%2$s_TEXT='no %2$s text'\n\0" -/* 945 */ "%1$s_%2$s_MODE='%3$s'\n" +/* 949 */ "echo 'Warning: Cannot load options files' >&2\0" +/* 996 */ "echo 'Warning: Cannot save options files' >&2\0" +/* 1043 */ "echo 'Warning: Cannot suppress the loading of options files' >&2\0" +/* 1109 */ "<%1$s type=integer>0x%2$lX\n\0" +/* 1144 */ "%1$s_%2$s_TEXT='no %2$s text'\n\0" +/* 1175 */ "%1$s_%2$s_MODE='%3$s'\n" "export %1$s_%2$s_MODE\n\0" -/* 990 */ "%1$s_%2$s='%3$s'\n" +/* 1220 */ "%1$s_%2$s='%3$s'\n" "export %1$s_%2$s\n\0" -/* 1025 */ "%1$s_%2$s_CT=%3$d\n" +/* 1255 */ "%1$s_%2$s_CT=%3$d\n" "export %1$s_%2$s_CT\n\0" -/* 1064 */ "OPTION_CT=%d\n" +/* 1294 */ "OPTION_CT=%d\n" "export OPTION_CT\n\0" -/* 1095 */ "%1$s_%2$s=%3$s\n" +/* 1325 */ "%1$s_%2$s=%3$s\n" "export %1$s_%2$s\n\0" -/* 1128 */ "%1$s_%2$s=%3$d # 0x%3$X\n" +/* 1358 */ "%1$s_%2$s=%3$d # 0x%3$X\n" "export %1$s_%2$s\n\0" -/* 1170 */ " case \"${OPT_CODE}\" in\n\0" -/* 1201 */ " if [ $%1$s_%2$s_CT -gt %3$u ] ; then\n" +/* 1400 */ " case \"${OPT_CODE}\" in\n\0" +/* 1431 */ " if [ $%1$s_%2$s_CT -gt %3$u ] ; then\n" " echo 'Error: more than %3$d %2$s options'\n" " echo \"$%1$s_USAGE_TEXT\"\n" " exit 1\n" " fi >&2\n\0" -/* 1392 */ "test ${%1$s_%2$s_CT-0} -ge %3$u || {\n" +/* 1622 */ "test ${%1$s_%2$s_CT-0} -ge %3$u || {\n" " echo %1$s_%2$s has not been set\n" " exit 1\n" "} 1>&2\n\0" -/* 1484 */ "test -n \"$%1$s_%2$s\" || {\n" +/* 1714 */ "test -n \"$%1$s_%2$s\" || {\n" " echo %1$s_%2$s has not been set\n" " exit 1\n" "} 1>&2\n\0" -/* 1565 */ " echo \"$%s_%s_TEXT\"\n" +/* 1795 */ " echo \"$%s_%s_TEXT\"\n" " exit 0\n\0" -/* 1616 */ "\n" +/* 1846 */ "\n" "# # # # # # # # # #\n" "#\n" "# END OF AUTOMATED OPTION PROCESSING\n" "#\n" "# # # # # # # # # # -- do not modify this marker --\n\0" -/* 1732 */ " if [ -n \"${OPT_ARG_VAL}\" ]\n" +/* 1962 */ " if [ -n \"${OPT_ARG_VAL}\" ]\n" " then\n" " eval %1$s_${OPT_NAME}${OPT_ELEMENT}=\"'${OPT_ARG_VAL}'\"\n" " export %1$s_${OPT_NAME}${OPT_ELEMENT}\n" @@ -164,15 +203,15 @@ char const ao_strs_strtable[6407] = "unset OPT_NAME || :\n" "unset OPT_CODE || :\n" "unset OPT_ARG_VAL || :\n\0" -/* 2111 */ " OPT_CODE=`echo \"X${OPT_ARG}\"|sed 's/^X-*//'`\n" +/* 2341 */ " OPT_CODE=`echo \"X${OPT_ARG}\"|sed 's/^X-*//'`\n" " shift\n" " OPT_ARG=$1\n" " case \"${OPT_CODE}\" in *=* )\n" " OPT_ARG_VAL=`echo \"${OPT_CODE}\"|sed 's/^[^=]*=//'`\n" " OPT_CODE=`echo \"${OPT_CODE}\"|sed 's/=.*$//'` ;; esac\n\0" -/* 2362 */ " OPT_CODE=`echo \"X${OPT_ARG}\" | sed 's/X-\\(.\\).*/\\1/'`\n" +/* 2592 */ " OPT_CODE=`echo \"X${OPT_ARG}\" | sed 's/X-\\(.\\).*/\\1/'`\n" " OPT_ARG=` echo \"X${OPT_ARG}\" | sed 's/X-.//'`\n\0" -/* 2479 */ "\n" +/* 2709 */ "\n" "ARG_COUNT=$#\n" "OPT_PROCESS=true\n" "OPT_ARG=$1\n" @@ -185,7 +224,7 @@ char const ao_strs_strtable[6407] = " OPT_PROCESS=false\n" " shift\n" " ;;\n\0" -/* 2686 */ " case \"${OPT_ARG_NEEDED}\" in\n" +/* 2916 */ " case \"${OPT_ARG_NEEDED}\" in\n" " NO )\n" " OPT_ARG_VAL=''\n" " ;;\n" @@ -213,10 +252,10 @@ char const ao_strs_strtable[6407] = " fi\n" " ;;\n" " esac\n\0" -/* 3465 */ " %1$s_%2$s_CT=`expr ${%1$s_%2$s_CT} + 1`\n" +/* 3695 */ " %1$s_%2$s_CT=`expr ${%1$s_%2$s_CT} + 1`\n" " OPT_ELEMENT=\"_${%1$s_%2$s_CT}\"\n" " OPT_NAME='%2$s'\n\0" -/* 3589 */ "\n" +/* 3819 */ "\n" "if test -z \"${%1$s_%2$s}\"\n" "then\n" " %1$s_%2$s_CT=0\n" @@ -226,16 +265,16 @@ char const ao_strs_strtable[6407] = " %1$s_%2$s_1=${%1$s_%2$s}\n" " export %1$s_%2$s_CT %1$s_%2$s_1\n" "fi\n\0" -/* 3747 */ " * )\n" +/* 3977 */ " * )\n" " OPT_PROCESS=false\n" " ;;\n" " esac\n\0" -/* 3804 */ " %1$s_%2$s_CT=0\n" +/* 4034 */ " %1$s_%2$s_CT=0\n" " OPT_ELEMENT=''\n" " %1$s_%2$s='%3$s'\n" " export %1$s_%2$s\n" " OPT_NAME='%2$s'\n\0" -/* 3945 */ " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n" +/* 4175 */ " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n" " echo 'Error: duplicate %2$s option'\n" " echo \"$%1$s_USAGE_TEXT\"\n" " exit 1\n" @@ -244,7 +283,7 @@ char const ao_strs_strtable[6407] = " %1$s_%2$s='%3$s'\n" " export %1$s_%2$s\n" " OPT_NAME='%2$s'\n\0" -/* 4262 */ "\n" +/* 4492 */ "\n" "ARG_COUNT=$#\n" "OPT_ARG=$1\n" "while [ $# -gt 0 ]\n" @@ -252,7 +291,7 @@ char const ao_strs_strtable[6407] = " OPT_ELEMENT=''\n" " OPT_ARG_VAL=''\n" " OPT_ARG=${1}\n\0" -/* 4365 */ " case \"${OPT_ARG_NEEDED}\" in\n" +/* 4595 */ " case \"${OPT_ARG_NEEDED}\" in\n" " NO )\n" " if [ -n \"${OPT_ARG}\" ]\n" " then\n" @@ -297,33 +336,33 @@ char const ao_strs_strtable[6407] = " fi\n" " ;;\n" " esac\n\0" -/* 5519 */ " echo \"$%s_LONGUSAGE_TEXT\" | ${PAGER-more}\n" +/* 5749 */ " echo \"$%s_LONGUSAGE_TEXT\" | ${PAGER-more}\n" " exit 0\n\0" -/* 5593 */ "%s OF %s\n" +/* 5823 */ "%s OF %s\n" "#\n" "# From here to the next `-- do not modify this marker --',\n" "# the text has been generated %s\n\0" -/* 5699 */ " eval %1$s_%2$s${OPT_ELEMENT}=true\n" +/* 5929 */ " eval %1$s_%2$s${OPT_ELEMENT}=true\n" " export %1$s_%2$s${OPT_ELEMENT}\n\0" -/* 5789 */ " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n" +/* 6019 */ " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n" " echo 'Error: duplicate %2$s option'\n" " echo \"$%1$s_USAGE_TEXT\"\n" " exit 1\n" " fi >&2\n" " %1$s_%2$s_set=true\n" " OPT_NAME='%2$s'\n\0" -/* 6048 */ "\n" +/* 6278 */ "\n" "%1$s_%2$s=${%1$s_%2$s-'%3$s'}\n" "%1$s_%2$s_set=false\n" "export %1$s_%2$s\n\0" -/* 6117 */ "\n" +/* 6347 */ "\n" "%1$s_%2$s=${%1$s_%2$s}\n" "%1$s_%2$s_set=false\n" "export %1$s_%2$s\n\0" -/* 6179 */ "# # # # # # # # # # -- do not modify this marker --\n" +/* 6409 */ "# # # # # # # # # # -- do not modify this marker --\n" "#\n" "# DO NOT EDIT THIS SECTION\n\0" -/* 6262 */ " * )\n" +/* 6492 */ " * )\n" " echo Unknown %s: \"${OPT_CODE}\" >&2\n" " echo \"$%s_USAGE_TEXT\" >&2\n" " exit 1\n" diff --git a/sntp/libopts/ao-strs.h b/sntp/libopts/ao-strs.h index d1f27b967f..5fd2409530 100644 --- a/sntp/libopts/ao-strs.h +++ b/sntp/libopts/ao-strs.h @@ -1,8 +1,8 @@ /* -*- buffer-read-only: t -*- vi: set ro: - * + * * DO NOT EDIT THIS FILE (ao-strs.h) - * - * It has been AutoGen-ed January 4, 2013 at 04:15:42 PM by AutoGen 5.17.1pre14 + * + * It has been AutoGen-ed February 21, 2013 at 12:28:29 PM by AutoGen 5.17.2pre16 * From the definitions ao-strs.def * and the template file strings * @@ -10,7 +10,7 @@ * This is free software. It is licensed for use, modification and * redistribution under the terms of the * Modified (3 clause) Berkeley Software Distribution License - * + * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,7 +23,7 @@ * 3. Neither the name ``Bruce Korb'' nor the name of any other * contributor may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * strings IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -39,214 +39,288 @@ #ifndef STRINGS_AO_STRS_H_GUARD #define STRINGS_AO_STRS_H_GUARD 1 /* - * 103 strings in ao_strs_strtable string table + * 140 strings in ao_strs_strtable string table */ -#define ARG_BREAK_STR (ao_strs_strtable+0) +#define ARG_BREAK_STR (ao_strs_strtable+261) #define ARG_BREAK_STR_LEN 5 -#define ARG_BY_NUM_FMT (ao_strs_strtable+6) +#define ARG_BY_NUM_FMT (ao_strs_strtable+267) #define ARG_BY_NUM_FMT_LEN 9 -#define BOOL_ATR_FMT (ao_strs_strtable+614) +#define BOOL_ATR_FMT (ao_strs_strtable+880) #define BOOL_ATR_FMT_LEN 31 -#define BULLET_STR (ao_strs_strtable+16) -#define BULLET_STR_LEN 6 -#define CHK_MAX_COUNT (ao_strs_strtable+1201) +#define CHK_MAX_COUNT (ao_strs_strtable+1431) #define CHK_MAX_COUNT_LEN 190 -#define CHK_MIN_COUNT (ao_strs_strtable+1392) +#define CHK_MIN_COUNT (ao_strs_strtable+1622) #define CHK_MIN_COUNT_LEN 91 -#define CHK_ONE_REQUIRED (ao_strs_strtable+1484) +#define CHK_ONE_REQUIRED (ao_strs_strtable+1714) #define CHK_ONE_REQUIRED_LEN 80 -#define DEEP_INDENT_STR (ao_strs_strtable+23) -#define DEEP_INDENT_STR_LEN 6 -#define ECHO_N_EXIT (ao_strs_strtable+1565) +#define ECHO_N_EXIT (ao_strs_strtable+1795) #define ECHO_N_EXIT_LEN 50 -#define EMPTY_ARG (ao_strs_strtable+30) +#define EMPTY_ARG (ao_strs_strtable+277) #define EMPTY_ARG_LEN 2 -#define END_MARK (ao_strs_strtable+1616) +#define END_MARK (ao_strs_strtable+1846) #define END_MARK_LEN 115 -#define END_OPT_SEL_STR (ao_strs_strtable+33) +#define END_OPT_SEL_STR (ao_strs_strtable+280) #define END_OPT_SEL_STR_LEN 12 -#define END_PRE_FMT (ao_strs_strtable+646) +#define END_PRE_FMT (ao_strs_strtable+912) #define END_PRE_FMT_LEN 36 -#define END_SET_TEXT (ao_strs_strtable+46) +#define END_SET_TEXT (ao_strs_strtable+293) #define END_SET_TEXT_LEN 3 -#define END_XML_FMT (ao_strs_strtable+50) +#define END_XML_FMT (ao_strs_strtable+297) #define END_XML_FMT_LEN 6 -#define ENUM_ERR_LINE (ao_strs_strtable+57) +#define ENUM_ERR_LINE (ao_strs_strtable+304) #define ENUM_ERR_LINE_LEN 5 -#define ENUM_ERR_WIDTH (ao_strs_strtable+63) +#define ENUM_ERR_WIDTH (ao_strs_strtable+310) #define ENUM_ERR_WIDTH_LEN 6 -#define EXPORT_ARG_FMT (ao_strs_strtable+70) +#define EXPORT_ARG_FMT (ao_strs_strtable+317) #define EXPORT_ARG_FMT_LEN 17 -#define FALSE_STR (ao_strs_strtable+88) +#define FALSE_STR (ao_strs_strtable+335) #define FALSE_STR_LEN 5 -#define FINISH_LOOP (ao_strs_strtable+1732) +#define FINISH_LOOP (ao_strs_strtable+1962) #define FINISH_LOOP_LEN 378 -#define FLAG_OPT_MARK (ao_strs_strtable+94) +#define FLAG_OPT_MARK (ao_strs_strtable+341) #define FLAG_OPT_MARK_LEN 9 -#define FLAG_STR (ao_strs_strtable+104) +#define FLAG_STR (ao_strs_strtable+351) #define FLAG_STR_LEN 4 -#define INIT_LOPT_STR (ao_strs_strtable+2111) +#define INIT_LOPT_STR (ao_strs_strtable+2341) #define INIT_LOPT_STR_LEN 250 -#define INIT_OPT_STR (ao_strs_strtable+2362) +#define INIT_OPT_STR (ao_strs_strtable+2592) #define INIT_OPT_STR_LEN 116 -#define INVALID_FMT (ao_strs_strtable+109) +#define INVALID_FMT (ao_strs_strtable+356) #define INVALID_FMT_LEN 10 -#define INVALID_STR (ao_strs_strtable+120) +#define INVALID_STR (ao_strs_strtable+367) #define INVALID_STR_LEN 9 -#define LONG_OPT_MARK (ao_strs_strtable+130) -#define LONG_OPT_MARKER (ao_strs_strtable+141) +#define LINE_SPLICE (ao_strs_strtable+377) +#define LINE_SPLICE_LEN 4 +#define LONG_OPT_MARK (ao_strs_strtable+382) +#define LONG_OPT_MARKER (ao_strs_strtable+393) #define LONG_OPT_MARKER_LEN 2 #define LONG_OPT_MARK_LEN 10 -#define LONG_USE_STR (ao_strs_strtable+144) +#define LONG_USE_STR (ao_strs_strtable+396) #define LONG_USE_STR_LEN 9 -#define LOOP_STR (ao_strs_strtable+2479) +#define LOOP_STR (ao_strs_strtable+2709) #define LOOP_STR_LEN 206 -#define LOPT_ARG_FMT (ao_strs_strtable+2686) +#define LOPT_ARG_FMT (ao_strs_strtable+2916) #define LOPT_ARG_FMT_LEN 778 -#define LVL3_CMD (ao_strs_strtable+154) +#define LVL3_CMD (ao_strs_strtable+406) #define LVL3_CMD_LEN 15 -#define MORE_STR (ao_strs_strtable+170) +#define MK_STR_OCT_FMT (ao_strs_strtable+422) +#define MK_STR_OCT_FMT_LEN 5 +#define MORE_STR (ao_strs_strtable+428) #define MORE_STR_LEN 4 -#define MULTI_ARG_FMT (ao_strs_strtable+3465) +#define MULTI_ARG_FMT (ao_strs_strtable+3695) #define MULTI_ARG_FMT_LEN 123 -#define MULTI_DEF_FMT (ao_strs_strtable+3589) +#define MULTI_DEF_FMT (ao_strs_strtable+3819) #define MULTI_DEF_FMT_LEN 157 -#define NESTED_OPT_FMT (ao_strs_strtable+175) +#define NESTED_OPT_FMT (ao_strs_strtable+433) #define NESTED_OPT_FMT_LEN 17 -#define NLSTR_FMT (ao_strs_strtable+193) +#define NLSTR_FMT (ao_strs_strtable+451) #define NLSTR_FMT_LEN 3 -#define NLSTR_SPACE_FMT (ao_strs_strtable+197) +#define NLSTR_SPACE_FMT (ao_strs_strtable+455) #define NLSTR_SPACE_FMT_LEN 5 -#define NONE_STR (ao_strs_strtable+203) +#define NONE_STR (ao_strs_strtable+91) #define NONE_STR_LEN 4 -#define NOT_FOUND_STR (ao_strs_strtable+3747) +#define NOT_FOUND_STR (ao_strs_strtable+3977) #define NOT_FOUND_STR_LEN 56 -#define NO_ARG_NEEDED (ao_strs_strtable+208) +#define NO_ARG_NEEDED (ao_strs_strtable+461) #define NO_ARG_NEEDED_LEN 17 -#define NO_LOAD_WARN (ao_strs_strtable+683) +#define NO_LOAD_WARN (ao_strs_strtable+949) #define NO_LOAD_WARN_LEN 46 -#define NO_MULTI_ARG_FMT (ao_strs_strtable+3804) +#define NO_MULTI_ARG_FMT (ao_strs_strtable+4034) #define NO_MULTI_ARG_FMT_LEN 140 -#define NO_SAVE_OPTS (ao_strs_strtable+730) +#define NO_SAVE_OPTS (ao_strs_strtable+996) #define NO_SAVE_OPTS_LEN 46 -#define NO_SGL_ARG_FMT (ao_strs_strtable+3945) +#define NO_SGL_ARG_FMT (ao_strs_strtable+4175) #define NO_SGL_ARG_FMT_LEN 316 -#define NO_SUPPRESS_LOAD (ao_strs_strtable+777) +#define NO_SUPPRESS_LOAD (ao_strs_strtable+1043) #define NO_SUPPRESS_LOAD_LEN 65 -#define NULL_ATR_FMT (ao_strs_strtable+226) +#define NULL_ATR_FMT (ao_strs_strtable+479) #define NULL_ATR_FMT_LEN 6 -#define NUMB_ATR_FMT (ao_strs_strtable+843) +#define NUMB_ATR_FMT (ao_strs_strtable+1109) #define NUMB_ATR_FMT_LEN 34 -#define OK_NEED_OPT_ARG (ao_strs_strtable+233) +#define OK_NEED_OPT_ARG (ao_strs_strtable+486) #define OK_NEED_OPT_ARG_LEN 17 -#define ONE_TAB_STR (ao_strs_strtable+251) +#define ONE_TAB_STR (ao_strs_strtable+504) #define ONE_TAB_STR_LEN 1 -#define ONLY_OPTS_LOOP (ao_strs_strtable+4262) +#define ONLY_OPTS_LOOP (ao_strs_strtable+4492) #define ONLY_OPTS_LOOP_LEN 102 -#define OPEN_CLOSE_FMT (ao_strs_strtable+226) +#define OPEN_CLOSE_FMT (ao_strs_strtable+479) #define OPEN_CLOSE_FMT_LEN 6 -#define OPEN_XML_FMT (ao_strs_strtable+253) +#define OPEN_XML_FMT (ao_strs_strtable+506) #define OPEN_XML_FMT_LEN 4 -#define OPTION_STR (ao_strs_strtable+258) +#define OPTION_STR (ao_strs_strtable+511) #define OPTION_STR_LEN 6 -#define OPT_ARG_FMT (ao_strs_strtable+4365) +#define OPT_ARG_FMT (ao_strs_strtable+4595) #define OPT_ARG_FMT_LEN 1153 -#define OPT_END_FMT (ao_strs_strtable+265) +#define OPT_END_FMT (ao_strs_strtable+518) #define OPT_END_FMT_LEN 14 -#define OPT_VAL_FMT (ao_strs_strtable+280) +#define OPT_VAL_FMT (ao_strs_strtable+533) #define OPT_VAL_FMT_LEN 6 -#define OR_STR (ao_strs_strtable+287) +#define OR_STR (ao_strs_strtable+540) #define OR_STR_LEN 3 -#define PAGER_NAME (ao_strs_strtable+291) +#define PAGER_NAME (ao_strs_strtable+544) #define PAGER_NAME_LEN 5 -#define PAGE_USAGE_FMT (ao_strs_strtable+571) -#define PAGE_USAGE_FMT (ao_strs_strtable+571) +#define PAGE_USAGE_FMT (ao_strs_strtable+837) +#define PAGE_USAGE_FMT (ao_strs_strtable+837) #define PAGE_USAGE_FMT_LEN 42 #define PAGE_USAGE_FMT_LEN 42 -#define PAGE_USAGE_TEXT (ao_strs_strtable+5519) +#define PAGE_USAGE_TEXT (ao_strs_strtable+5749) #define PAGE_USAGE_TEXT_LEN 73 -#define PLUS_STR (ao_strs_strtable+297) +#define PLUS_STR (ao_strs_strtable+550) #define PLUS_STR_LEN 3 -#define PREAMBLE_FMT (ao_strs_strtable+5593) +#define PREAMBLE_FMT (ao_strs_strtable+5823) #define PREAMBLE_FMT_LEN 105 -#define QUOT_APOS (ao_strs_strtable+301) +#define PUTS_FMT (ao_strs_strtable+554) +#define PUTS_FMT_LEN 15 +#define QUOT_APOS (ao_strs_strtable+570) #define QUOT_APOS_LEN 2 -#define QUOT_ARG_FMT (ao_strs_strtable+304) +#define QUOT_ARG_FMT (ao_strs_strtable+573) #define QUOT_ARG_FMT_LEN 4 -#define SAVE_WARN (ao_strs_strtable+878) -#define SAVE_WARN_LEN 35 -#define SET_MULTI_ARG (ao_strs_strtable+5699) +#define SET_MULTI_ARG (ao_strs_strtable+5929) #define SET_MULTI_ARG_LEN 89 -#define SET_NO_TEXT_FMT (ao_strs_strtable+914) +#define SET_NO_TEXT_FMT (ao_strs_strtable+1144) #define SET_NO_TEXT_FMT_LEN 30 -#define SET_OFF_FMT (ao_strs_strtable+309) +#define SET_OFF_FMT (ao_strs_strtable+578) #define SET_OFF_FMT_LEN 6 -#define SET_TEXT_FMT (ao_strs_strtable+316) +#define SET_TEXT_FMT (ao_strs_strtable+585) #define SET_TEXT_FMT_LEN 12 -#define SGL_ARG_FMT (ao_strs_strtable+5789) +#define SGL_ARG_FMT (ao_strs_strtable+6019) #define SGL_ARG_FMT_LEN 258 -#define SGL_DEF_FMT (ao_strs_strtable+6048) +#define SGL_DEF_FMT (ao_strs_strtable+6278) #define SGL_DEF_FMT_LEN 68 -#define SGL_NO_DEF_FMT (ao_strs_strtable+6117) +#define SGL_NO_DEF_FMT (ao_strs_strtable+6347) #define SGL_NO_DEF_FMT_LEN 61 -#define SHELL_MAGIC (ao_strs_strtable+329) +#define SHELL_MAGIC (ao_strs_strtable+598) #define SHELL_MAGIC_LEN 6 -#define SHOW_PROG_ENV (ao_strs_strtable+336) +#define SHOW_PROG_ENV (ao_strs_strtable+605) #define SHOW_PROG_ENV_LEN 19 -#define SHOW_VAL_FMT (ao_strs_strtable+356) +#define SHOW_VAL_FMT (ao_strs_strtable+625) #define SHOW_VAL_FMT_LEN 17 -#define START_MARK (ao_strs_strtable+6179) +#define START_MARK (ao_strs_strtable+6409) #define START_MARK_LEN 82 -#define STDOUT (ao_strs_strtable+374) +#define STDOUT (ao_strs_strtable+643) #define STDOUT_LEN 6 -#define TIME_FMT (ao_strs_strtable+381) +#define TIME_FMT (ao_strs_strtable+650) #define TIME_FMT_LEN 21 -#define TMP_USAGE_FMT (ao_strs_strtable+403) +#define TMP_USAGE_FMT (ao_strs_strtable+672) #define TMP_USAGE_FMT_LEN 12 -#define TRUE_STR (ao_strs_strtable+416) +#define TRUE_STR (ao_strs_strtable+685) #define TRUE_STR_LEN 4 -#define TWO_SPACES_STR (ao_strs_strtable+421) +#define TWO_SPACES_STR (ao_strs_strtable+254) #define TWO_SPACES_STR_LEN 2 -#define TYPE_ATR_FMT (ao_strs_strtable+424) +#define TYPE_ATR_FMT (ao_strs_strtable+690) #define TYPE_ATR_FMT_LEN 12 -#define UNK_OPT_FMT (ao_strs_strtable+6262) +#define UNK_OPT_FMT (ao_strs_strtable+6492) #define UNK_OPT_FMT_LEN 144 -#define VER_STR (ao_strs_strtable+437) +#define VER_STR (ao_strs_strtable+703) #define VER_STR_LEN 7 -#define XML_HEX_BYTE_FMT (ao_strs_strtable+445) +#define XML_HEX_BYTE_FMT (ao_strs_strtable+711) #define XML_HEX_BYTE_FMT_LEN 7 -#define YES_NEED_OPT_ARG (ao_strs_strtable+453) +#define YES_NEED_OPT_ARG (ao_strs_strtable+719) #define YES_NEED_OPT_ARG_LEN 18 -#define apostrophy (ao_strs_strtable+472) -#define apostrophy_LEN 4 -#define arg_fmt (ao_strs_strtable+477) +#define apostrophe (ao_strs_strtable+738) +#define apostrophe_LEN 4 +#define arg_fmt (ao_strs_strtable+743) #define arg_fmt_LEN 5 -#define init_optct (ao_strs_strtable+483) +#define init_optct (ao_strs_strtable+749) #define init_optct_LEN 13 -#define set_dash (ao_strs_strtable+497) +#define set_dash (ao_strs_strtable+763) #define set_dash_LEN 6 -#define zEquivMode (ao_strs_strtable+945) +#define zAll (ao_strs_strtable+257) +#define zAll_LEN 3 +#define zCfgAO_Flags (ao_strs_strtable+12) +#define zCfgAO_Flags_LEN 12 +#define zCfgProg (ao_strs_strtable+25) +#define zCfgProg_LEN 7 +#define zEquivMode (ao_strs_strtable+1175) #define zEquivMode_LEN 44 -#define zFullOptFmt (ao_strs_strtable+990) +#define zFiveSpaces (ao_strs_strtable+244) +#define zFiveSpaces_LEN 5 +#define zFmtFmt (ao_strs_strtable+33) +#define zFmtFmt_LEN 11 +#define zFullOptFmt (ao_strs_strtable+1220) #define zFullOptFmt_LEN 34 -#define zOptCookieCt (ao_strs_strtable+1025) +#define zGnuBreak (ao_strs_strtable+45) +#define zGnuBreak_LEN 5 +#define zGnuFileArg (ao_strs_strtable+51) +#define zGnuFileArg_LEN 5 +#define zGnuKeyLArg (ao_strs_strtable+57) +#define zGnuKeyLArg_LEN 4 +#define zGnuNestArg (ao_strs_strtable+62) +#define zGnuNestArg_LEN 5 +#define zGnuOptArg (ao_strs_strtable+68) +#define zGnuOptArg_LEN 6 +#define zGnuOptFmt (ao_strs_strtable+75) +#define zGnuOptFmt_LEN 10 +#define zGnuTimeArg (ao_strs_strtable+86) +#define zGnuTimeArg_LEN 4 +#define zNone (ao_strs_strtable+91) +#define zNone_LEN 4 +#define zOptCookieCt (ao_strs_strtable+1255) #define zOptCookieCt_LEN 38 -#define zOptCtFmt (ao_strs_strtable+1064) +#define zOptCtFmt (ao_strs_strtable+1294) #define zOptCtFmt_LEN 30 -#define zOptDisabl (ao_strs_strtable+1095) +#define zOptDisabl (ao_strs_strtable+1325) #define zOptDisabl_LEN 32 -#define zOptNumFmt (ao_strs_strtable+1128) +#define zOptNumFmt (ao_strs_strtable+1358) #define zOptNumFmt_LEN 41 -#define zOptionCase (ao_strs_strtable+1170) +#define zOptionCase (ao_strs_strtable+1400) #define zOptionCase_LEN 30 -#define zOptionEndSelect (ao_strs_strtable+504) +#define zOptionEndSelect (ao_strs_strtable+770) #define zOptionEndSelect_LEN 16 -#define zOptionFlag (ao_strs_strtable+521) +#define zOptionFlag (ao_strs_strtable+787) #define zOptionFlag_LEN 15 -#define zOptionFullName (ao_strs_strtable+537) +#define zOptionFullName (ao_strs_strtable+803) #define zOptionFullName_LEN 15 -#define zOptionPartName (ao_strs_strtable+553) +#define zOptionPartName (ao_strs_strtable+819) #define zOptionPartName_LEN 17 -extern char const ao_strs_strtable[6407]; +#define zPresetFile (ao_strs_strtable+96) +#define zPresetFile_LEN 37 +#define zReqOptFmt (ao_strs_strtable+134) +#define zReqOptFmt_LEN 13 +#define zSepChars (ao_strs_strtable+0) +#define zSepChars_LEN 3 +#define zShrtGnuOptFmt (ao_strs_strtable+148) +#define zShrtGnuOptFmt_LEN 2 +#define zSixSpaces (ao_strs_strtable+237) +#define zSixSpaces_LEN 6 +#define zStdBoolArg (ao_strs_strtable+151) +#define zStdBoolArg_LEN 3 +#define zStdBreak (ao_strs_strtable+155) +#define zStdBreak_LEN 7 +#define zStdFileArg (ao_strs_strtable+163) +#define zStdFileArg_LEN 3 +#define zStdKeyArg (ao_strs_strtable+167) +#define zStdKeyArg_LEN 3 +#define zStdKeyLArg (ao_strs_strtable+171) +#define zStdKeyLArg_LEN 3 +#define zStdNestArg (ao_strs_strtable+175) +#define zStdNestArg_LEN 3 +#define zStdNoArg (ao_strs_strtable+179) +#define zStdNoArg_LEN 3 +#define zStdNumArg (ao_strs_strtable+183) +#define zStdNumArg_LEN 3 +#define zStdOptArg (ao_strs_strtable+187) +#define zStdOptArg_LEN 3 +#define zStdReqArg (ao_strs_strtable+191) +#define zStdReqArg_LEN 3 +#define zStdStrArg (ao_strs_strtable+195) +#define zStdStrArg_LEN 3 +#define zStdTimeArg (ao_strs_strtable+199) +#define zStdTimeArg_LEN 3 +#define zTabHyp (ao_strs_strtable+203) +#define zTabHypAnd (ao_strs_strtable+217) +#define zTabHypAnd_LEN 11 +#define zTabHyp_LEN 6 +#define zTabSpace (ao_strs_strtable+210) +#define zTabSpace_LEN 6 +#define zTabout (ao_strs_strtable+229) +#define zTabout_LEN 7 +#define zThreeSpaces (ao_strs_strtable+250) +#define zThreeSpaces_LEN 3 +#define zTwoSpaces (ao_strs_strtable+254) +#define zTwoSpaces_LEN 2 +#define zambig_file (ao_strs_strtable+4) +#define zambig_file_LEN 7 +extern char const ao_strs_strtable[6637]; #endif /* STRINGS_AO_STRS_H_GUARD */ diff --git a/sntp/libopts/autoopts.c b/sntp/libopts/autoopts.c index c9e380b2d3..ff54b1619c 100644 --- a/sntp/libopts/autoopts.c +++ b/sntp/libopts/autoopts.c @@ -7,6 +7,10 @@ * routines are in separately compiled modules so that they will not * necessarily be linked in. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -21,11 +25,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ #ifndef PKGDATADIR @@ -43,12 +47,17 @@ static tePagerState pagerState = PAGER_STATE_INITIAL; FILE * option_usage_fp = NULL; +/** + * The number of tab characters to skip when printing continuation lines. + */ +static unsigned int tab_skip_ct = 0; + LOCAL void * ao_malloc(size_t sz) { void * res = malloc(sz); if (res == NULL) { - fprintf(stderr, zAO_Alloc, (int)sz); + fprintf(stderr, zalloc_fail, (int)sz); exit(EXIT_FAILURE); } return res; @@ -61,7 +70,7 @@ ao_realloc(void *p, size_t sz) { void * res = (p == NULL) ? malloc(sz) : realloc(p, sz); if (res == NULL) { - fprintf(stderr, zAO_Realloc, (int)sz, p); + fprintf(stderr, zrealloc_fail, (int)sz, p); exit(EXIT_FAILURE); } return res; @@ -74,7 +83,7 @@ ao_strdup(char const *str) { char * res = strdup(str); if (res == NULL) { - fprintf(stderr, zAO_Strdup, (int)strlen(str)); + fprintf(stderr, zalloc_fail, (int)strlen(str)); exit(EXIT_FAILURE); } return res; @@ -111,25 +120,25 @@ ao_strdup(char const *str) * invokes the handler procedure, if any. */ LOCAL tSuccess -handle_opt(tOptions * pOpts, tOptState * o_st) +handle_opt(tOptions * opts, tOptState * o_st) { /* * Save a copy of the option procedure pointer. * If this is an equivalence class option, we still want this proc. */ - tOptDesc* pOD = o_st->pOD; - tOptProc* pOP = pOD->pOptProc; - if (pOD->fOptState & OPTST_ALLOC_ARG) - AGFREE(pOD->optArg.argString); + tOptDesc * od = o_st->pOD; + tOptProc * opt_proc = od->pOptProc; + if (od->fOptState & OPTST_ALLOC_ARG) + AGFREE(od->optArg.argString); - pOD->optArg.argString = o_st->pzOptArg; + od->optArg.argString = o_st->pzOptArg; /* * IF we are presetting options, then we will ignore any un-presettable * options. They are the ones either marked as such. */ - if ( ((pOpts->fOptSet & OPTPROC_PRESETTING) != 0) - && ((pOD->fOptState & OPTST_NO_INIT) != 0) + if ( ((opts->fOptSet & OPTPROC_PRESETTING) != 0) + && ((od->fOptState & OPTST_NO_INIT) != 0) ) return PROBLEM; @@ -137,19 +146,19 @@ handle_opt(tOptions * pOpts, tOptState * o_st) * IF this is an equivalence class option, * THEN * Save the option value that got us to this option - * entry. (It may not be pOD->optChar[0], if this is an + * entry. (It may not be od->optChar[0], if this is an * equivalence entry.) * set the pointer to the equivalence class base */ - if (pOD->optEquivIndex != NO_EQUIVALENT) { - tOptDesc* p = pOpts->pOptDesc + pOD->optEquivIndex; + if (od->optEquivIndex != NO_EQUIVALENT) { + tOptDesc * eqv_od = opts->pOptDesc + od->optEquivIndex; /* * IF the current option state has not been defined (set on the * command line), THEN we will allow continued resetting of * the value. Once "defined", then it must not change. */ - if ((pOD->fOptState & OPTST_DEFINED) != 0) { + if ((od->fOptState & OPTST_DEFINED) != 0) { /* * The equivalenced-to option has been found on the command * line before. Make sure new occurrences are the same type. @@ -158,9 +167,9 @@ handle_opt(tOptions * pOpts, tOptState * o_st) * it was not the same equivalenced-to option, * THEN we have a usage problem. */ - if (p->optActualIndex != pOD->optIndex) { - fprintf(stderr, (char*)zMultiEquiv, p->pz_Name, pOD->pz_Name, - (pOpts->pOptDesc + p->optActualIndex)->pz_Name); + if (eqv_od->optActualIndex != od->optIndex) { + fprintf(stderr, zmultiway_bug, eqv_od->pz_Name, od->pz_Name, + (opts->pOptDesc + eqv_od->optActualIndex)->pz_Name); return FAILURE; } } else { @@ -170,61 +179,46 @@ handle_opt(tOptions * pOpts, tOptState * o_st) * never have been selected before, or else it was selected by * some sort of "presetting" mechanism. */ - p->optActualIndex = NO_EQUIVALENT; + eqv_od->optActualIndex = NO_EQUIVALENT; } - if (p->optActualIndex != pOD->optIndex) { + if (eqv_od->optActualIndex != od->optIndex) { /* * First time through, copy over the state * and add in the equivalence flag */ - p->optActualValue = pOD->optValue; - p->optActualIndex = pOD->optIndex; + eqv_od->optActualValue = od->optValue; + eqv_od->optActualIndex = od->optIndex; o_st->flags |= OPTST_EQUIVALENCE; } /* * Copy the most recent option argument. set membership state - * is kept in ``p->optCookie''. Do not overwrite. + * is kept in 'eqv_od->optCookie'. Do not overwrite. */ - p->optArg.argString = pOD->optArg.argString; - pOD = p; + eqv_od->optArg.argString = od->optArg.argString; + od = eqv_od; } else { - pOD->optActualValue = pOD->optValue; - pOD->optActualIndex = pOD->optIndex; + od->optActualValue = od->optValue; + od->optActualIndex = od->optIndex; } - pOD->fOptState &= OPTST_PERSISTENT_MASK; - pOD->fOptState |= (o_st->flags & ~OPTST_PERSISTENT_MASK); + od->fOptState &= OPTST_PERSISTENT_MASK; + od->fOptState |= (o_st->flags & ~OPTST_PERSISTENT_MASK); /* * Keep track of count only for DEFINED (command line) options. * IF we have too many, build up an error message and bail. */ - if ( (pOD->fOptState & OPTST_DEFINED) - && (++pOD->optOccCt > pOD->optMaxCt) ) { - - if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) { - char const * pzEqv = - (pOD->optEquivIndex != NO_EQUIVALENT) ? zEquiv : zNil; - - fputs(zErrOnly, stderr); - - if (pOD->optMaxCt > 1) - fprintf(stderr, zAtMost, pOD->optMaxCt, pOD->pz_Name, pzEqv); - else - fprintf(stderr, zOnlyOne, pOD->pz_Name, pzEqv); - } - - return FAILURE; - } - + if ( (od->fOptState & OPTST_DEFINED) + && (++od->optOccCt > od->optMaxCt) ) + return too_many_occurrences(opts, od); /* * If provided a procedure to call, call it */ - if (pOP != NULL) - (*pOP)(pOpts, pOD); + if (opt_proc != NULL) + (*opt_proc)(opts, od); return SUCCESS; } @@ -354,8 +348,8 @@ int optionProcess(tOptions * opts, int a_ct, char ** a_v) { if (! SUCCESSFUL(validate_struct(opts, a_v[0]))) - exit(EX_SOFTWARE); - + ao_bug(zbad_data_msg); + /* * Establish the real program name, the program full path, * and do all the presetting the first time thru only. @@ -408,7 +402,8 @@ optionProcess(tOptions * opts, int a_ct, char ** a_v) return (int)opts->curOptIdx; } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/autoopts.h b/sntp/libopts/autoopts.h index c4bf544cba..67fb86d7d0 100644 --- a/sntp/libopts/autoopts.h +++ b/sntp/libopts/autoopts.h @@ -5,6 +5,10 @@ * This file defines all the global structures and special values * used in the automated option processing library. * + * @group autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -19,11 +23,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ #ifndef AUTOGEN_AUTOOPTS_H @@ -48,6 +52,17 @@ #undef EXPORT #define EXPORT +#ifndef NUL +#define NUL '\0' +#endif +#define BEL '\a' +#define BS '\b' +#define HT '\t' +#define LF '\n' +#define VT '\v' +#define FF '\f' +#define CR '\r' + #if defined(_WIN32) && !defined(__CYGWIN__) # define DIRCH '\\' #else @@ -120,37 +135,39 @@ typedef int tDirection; #define PROCESSING(d) ((d)>0) #define PRESETTING(d) ((d)<0) +#define CALLED(d) ((d)==0) -/* +/** * When loading a line (or block) of text as an option, the value can - * be processed in any of several modes: - * - * @table @samp - * @item keep - * Every part of the value between the delimiters is saved. - * - * @item uncooked - * Even if the value begins with quote characters, do not do quote processing. - * - * @item cooked - * If the value looks like a quoted string, then process it. - * Double quoted strings are processed the way strings are in "C" programs, - * except they are treated as regular characters if the following character - * is not a well-established escape sequence. - * Single quoted strings (quoted with apostrophies) are handled the way - * strings are handled in shell scripts, *except* that backslash escapes - * are honored before backslash escapes and apostrophies. - * @end table + * be processed in any of several modes. */ typedef enum { + /** + * If the value looks like a quoted string, then process it. Double + * quoted strings are processed the way strings are in "C" programs, + * except they are treated as regular characters if the following + * character is not a well-established escape sequence. Single quoted + * strings (quoted with apostrophies) are handled the way strings are + * handled in shell scripts, *except* that backslash escapes are + * honored before backslash escapes and apostrophies. + */ OPTION_LOAD_COOKED, + + /** + * Even if the value begins with quote characters, do not do quote + * processing. Strip leading and trailing white space. + */ OPTION_LOAD_UNCOOKED, + + /** + * Keep every part of the value between the delimiters. + */ OPTION_LOAD_KEEP } tOptionLoadMode; static tOptionLoadMode option_load_mode; -/* +/** * The pager state is used by optionPagedUsage() procedure. * When it runs, it sets itself up to be called again on exit. * If, however, a routine needs a child process to do some work @@ -159,8 +176,16 @@ static tOptionLoadMode option_load_mode; * to run the pager program before its time. */ typedef enum { - PAGER_STATE_INITIAL, + PAGER_STATE_INITIAL, //@< initial option paging state + + /** + * temp file created and optionPagedUsage is scheduled to run at exit + */ PAGER_STATE_READY, + + /** + * This is a child process used in creating shell script usage. + */ PAGER_STATE_CHILD } tePagerState; @@ -197,6 +222,10 @@ typedef enum { TEXTTO_TABLE COUNT_TT } teTextTo; #undef _TT_ +/** + * option argument types. Used to create usage information for + * particular options. + */ typedef struct { char const * pzStr; char const * pzReq; @@ -231,7 +260,7 @@ ao_realloc(void *p, size_t sz); static char * ao_strdup(char const *str); -/* +/** * DO option handling? * * Options are examined at two times: at immediate handling time and at @@ -261,7 +290,8 @@ ao_strdup(char const *str); || ( ((_flg) & (OPTST_DISABLED|OPTST_DISABLE_IMM)) \ == (OPTST_DISABLED|OPTST_DISABLE_IMM) )) -/* B) handling at "regular" time because it was not immediate +/** + * B) handling at "regular" time because it was not immediate * * 1. OPTST_DISABLED is not set: * IMM must *NOT* be set @@ -282,7 +312,8 @@ ao_strdup(char const *str); || (((_flg) & (OPTST_DISABLED|OPTST_DISABLE_IMM)) == \ OPTST_DISABLED) ) -/* C) handling at "regular" time because it is to be handled twice. +/** + * C) handling at "regular" time because it is to be handled twice. * The immediate bit was already tested and found to be set: * * 3. OPTST_DISABLED is not set: @@ -340,7 +371,7 @@ extern char* strchr(char const *s, int c); extern char* strrchr(char const *s, int c); #endif -/* +/** * Define and initialize all the user visible strings. * We do not do translations. If translations are to be done, then * the client will provide a callback for that purpose. @@ -348,16 +379,22 @@ extern char* strrchr(char const *s, int c); #undef DO_TRANSLATIONS #include "autoopts/usage-txt.h" -/* +/** * File pointer for usage output */ FILE * option_usage_fp; +/** + * If provided in the option structure + */ static char const * program_pkgdatadir; - +/** + * privately exported functions + */ extern tOptProc optionPrintVersion, optionPagedUsage, optionLoadOpt; #endif /* AUTOGEN_AUTOOPTS_H */ -/* +/** + * @} * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/autoopts/options.h b/sntp/libopts/autoopts/options.h index 4c0a26f005..695ad564e3 100644 --- a/sntp/libopts/autoopts/options.h +++ b/sntp/libopts/autoopts/options.h @@ -1,8 +1,8 @@ /* -*- buffer-read-only: t -*- vi: set ro: - * + * * DO NOT EDIT THIS FILE (options.h) - * - * It has been AutoGen-ed January 4, 2013 at 04:15:49 PM by AutoGen 5.17.1pre14 + * + * It has been AutoGen-ed February 21, 2013 at 12:28:36 PM by AutoGen 5.17.2pre16 * From the definitions funcs.def * and the template file options_h * @@ -11,21 +11,33 @@ * * Automated Options Copyright (C) 1992-2013 by Bruce Korb * - * * AutoOpts is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * AutoOpts is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see ."; + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * 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 + * of the user of the license. + * + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" + * + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" + * + * These files have the following sha256 sums: + * + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ #ifndef AUTOOPTS_OPTIONS_H_GUARD #define AUTOOPTS_OPTIONS_H_GUARD 1 +/** \file options.h + * + * @addtogroup autoopts + * @{ + */ #include #include @@ -85,13 +97,22 @@ * * See the relevant generated header file to determine which and what * values for "opt_name" are available. + * @group version + * @{ */ -#define OPTIONS_STRUCT_VERSION 151553 -#define OPTIONS_VERSION_STRING "37:1:12" +/// autoopts structure version +#define OPTIONS_STRUCT_VERSION 155648 +/// autoopts structure version string +#define OPTIONS_VERSION_STRING "38:0:13" +/// minimum version the autoopts library supports #define OPTIONS_MINIMUM_VERSION 102400 +/// minimum version the autoopts library supports as a string #define OPTIONS_MIN_VER_STRING "25:0:0" -#define OPTIONS_DOTTED_VERSION "37.1" +/// the display version of the autoopts library, as a string +#define OPTIONS_DOTTED_VERSION "38.0" +/// convert a version/release number pair to an integer value #define OPTIONS_VER_TO_NUM(_v, _r) (((_v) * 4096) + (_r)) +/// @} /** * Option argument types. This must fit in the OPTST_ARG_TYPE_MASK @@ -99,34 +120,34 @@ * It will be a problem to extend beyond 4 bits. */ typedef enum { - OPARG_TYPE_NONE = 0, /**< does not take an argument */ - OPARG_TYPE_STRING = 1, /**< default type/ vanilla string */ - OPARG_TYPE_ENUMERATION = 2, /**< opt arg is an enum (keyword list) */ - OPARG_TYPE_BOOLEAN = 3, /**< opt arg is boolean-valued */ - OPARG_TYPE_MEMBERSHIP = 4, /**< opt arg sets set membership bits */ - OPARG_TYPE_NUMERIC = 5, /**< opt arg is a long int */ - OPARG_TYPE_HIERARCHY = 6, /**< option arg is hierarchical value */ - OPARG_TYPE_FILE = 7, /**< option arg names a file */ - OPARG_TYPE_TIME = 8, /**< opt arg is a time duration */ - OPARG_TYPE_FLOAT = 9, /**< opt arg is a floating point num */ - OPARG_TYPE_DOUBLE = 10, /**< opt arg is a double prec. float */ - OPARG_TYPE_LONG_DOUBLE = 11, /**< opt arg is a long double prec. */ - OPARG_TYPE_LONG_LONG = 12 /**< opt arg is a long long int */ + OPARG_TYPE_NONE = 0, ///< does not take an argument + OPARG_TYPE_STRING = 1, ///< default type/ vanilla string + OPARG_TYPE_ENUMERATION = 2, ///< opt arg is an enum (keyword list) + OPARG_TYPE_BOOLEAN = 3, ///< opt arg is boolean-valued + OPARG_TYPE_MEMBERSHIP = 4, ///< opt arg sets set membership bits + OPARG_TYPE_NUMERIC = 5, ///< opt arg is a long int + OPARG_TYPE_HIERARCHY = 6, ///< option arg is hierarchical value + OPARG_TYPE_FILE = 7, ///< option arg names a file + OPARG_TYPE_TIME = 8, ///< opt arg is a time duration + OPARG_TYPE_FLOAT = 9, ///< opt arg is a floating point num + OPARG_TYPE_DOUBLE = 10, ///< opt arg is a double prec. float + OPARG_TYPE_LONG_DOUBLE = 11, ///< opt arg is a long double prec. + OPARG_TYPE_LONG_LONG = 12 ///< opt arg is a long long int } teOptArgType; /** * value descriptor for sub options */ typedef struct optionValue { - teOptArgType valType; /**< which argument type */ - char * pzName; /**< name of the sub-option */ + teOptArgType valType; ///< which argument type + char * pzName; ///< name of the sub-option union { - char strVal[1]; /**< OPARG_TYPE_STRING */ - unsigned int enumVal; /**< OPARG_TYPE_ENUMERATION */ - unsigned int boolVal; /**< OPARG_TYPE_BOOLEAN */ - unsigned long setVal; /**< OPARG_TYPE_MEMBERSHIP */ - long longVal; /**< OPARG_TYPE_NUMERIC */ - void* nestVal; /**< OPARG_TYPE_HIERARCHY */ + char strVal[1]; ///< OPARG_TYPE_STRING + unsigned int enumVal; ///< OPARG_TYPE_ENUMERATION + unsigned int boolVal; ///< OPARG_TYPE_BOOLEAN + unsigned long setVal; ///< OPARG_TYPE_MEMBERSHIP + long longVal; ///< OPARG_TYPE_NUMERIC + void* nestVal; ///< OPARG_TYPE_HIERARCHY } v; } tOptionValue; @@ -134,35 +155,45 @@ typedef struct optionValue { * file argument state and handling. */ typedef enum { - FTYPE_MODE_MAY_EXIST = 0x00, /**< may or may not exist */ - FTYPE_MODE_MUST_EXIST = 0x01, /**< must pre-exist */ - FTYPE_MODE_MUST_NOT_EXIST = 0x02, /**< must *not* pre-exist */ - FTYPE_MODE_EXIST_MASK = 0x03, /**< mask for these bits */ - FTYPE_MODE_NO_OPEN = 0x00, /**< leave file closed */ - FTYPE_MODE_OPEN_FD = 0x10, /**< call open(2) */ - FTYPE_MODE_FOPEN_FP = 0x20, /**< call fopen(3) */ - FTYPE_MODE_OPEN_MASK = 0x30 /**< open/fopen/not open */ + FTYPE_MODE_MAY_EXIST = 0x00, ///< may or may not exist + FTYPE_MODE_MUST_EXIST = 0x01, ///< must pre-exist + FTYPE_MODE_MUST_NOT_EXIST = 0x02, ///< must *not* pre-exist + FTYPE_MODE_EXIST_MASK = 0x03, ///< mask for these bits + FTYPE_MODE_NO_OPEN = 0x00, ///< leave file closed + FTYPE_MODE_OPEN_FD = 0x10, ///< call open(2) + FTYPE_MODE_FOPEN_FP = 0x20, ///< call fopen(3) + FTYPE_MODE_OPEN_MASK = 0x30 ///< open/fopen/not open } teOptFileType; /** * the open flag bits or the mode string, depending on the open type. */ typedef union { - int file_flags; /**< open(2) flag bits */ - char const * file_mode; /**< fopen(3) mode string */ + int file_flags; ///< open(2) flag bits + char const * file_mode; ///< fopen(3) mode string } tuFileMode; -typedef struct argList tArgList; +/// initial number of option argument holders to allocate #define MIN_ARG_ALLOC_CT 6 -#define INCR_ARG_ALLOC_CT 8 -struct argList { - int useCt; +/// amount by which to increment the argument holder allocation. +#define INCR_ARG_ALLOC_CT 8 +/** + * an argument list. When an option appears multiple times and + * the values get "stacked". \a apzArgs holds 8 pointers initially + * and is incremented by \a INCR_ARG_ALLOC_CT as needed. + */ +typedef struct { + int useCt; ///< elements in use + + /// allocated elements, mininum \a MIN_ARG_ALLOC_CT + /// steps by \a INCR_ARG_ALLOC_CT int allocCt; - char const * apzArgs[MIN_ARG_ALLOC_CT]; -}; + char const * apzArgs[MIN_ARG_ALLOC_CT]; ///< element array +} tArgList; /** * Bits in the fOptState option descriptor field. + * @{ */ /** integral type for holding opt_state masks */ @@ -170,32 +201,59 @@ typedef uint32_t opt_state_mask_t; #define OPTST_ARG_TYPE_SHIFT 12 /** bits defined for opt_state_mask_t */ +/** opt_state_mask_t - Set via the "SET_OPT()" macro */ #define OPTST_SET 0x0000001U +/** opt_state_mask_t - Set via an RC/INI file */ #define OPTST_PRESET 0x0000002U +/** opt_state_mask_t - Set via a command line option */ #define OPTST_DEFINED 0x0000004U +/** opt_state_mask_t - Reset via command line option */ #define OPTST_RESET 0x0000008U +/** opt_state_mask_t - selected by equiv'ed option */ #define OPTST_EQUIVALENCE 0x0000010U +/** opt_state_mask_t - option is in disabled state */ #define OPTST_DISABLED 0x0000020U +/** opt_state_mask_t - pzOptArg was allocated */ #define OPTST_ALLOC_ARG 0x0000040U +/** opt_state_mask_t - option cannot be preset */ #define OPTST_NO_INIT 0x0000100U +/** opt_state_mask_t - opt value (flag) is any digit */ #define OPTST_NUMBER_OPT 0x0000200U +/** opt_state_mask_t - opt uses optionStackArg proc */ #define OPTST_STACKED 0x0000400U +/** opt_state_mask_t - option defaults to enabled */ #define OPTST_INITENABLED 0x0000800U +/** opt_state_mask_t - bit 1 of arg type enum */ #define OPTST_ARG_TYPE_1 0x0001000U +/** opt_state_mask_t - bit 2 of arg type enum */ #define OPTST_ARG_TYPE_2 0x0002000U +/** opt_state_mask_t - bit 3 of arg type enum */ #define OPTST_ARG_TYPE_3 0x0004000U +/** opt_state_mask_t - bit 4 of arg type enum */ #define OPTST_ARG_TYPE_4 0x0008000U +/** opt_state_mask_t - the option arg not required */ #define OPTST_ARG_OPTIONAL 0x0010000U +/** opt_state_mask_t - process opt on first pass */ #define OPTST_IMM 0x0020000U +/** opt_state_mask_t - process disablement immed. */ #define OPTST_DISABLE_IMM 0x0040000U +/** opt_state_mask_t - compiled out of program */ #define OPTST_OMITTED 0x0080000U +/** opt_state_mask_t - must be set or pre-set */ #define OPTST_MUST_SET 0x0100000U +/** opt_state_mask_t - opt is for doc only */ #define OPTST_DOCUMENT 0x0200000U +/** opt_state_mask_t - process opt twice - imm + reg */ #define OPTST_TWICE 0x0400000U +/** opt_state_mask_t - process disabled option twice */ #define OPTST_DISABLE_TWICE 0x0800000U +/** opt_state_mask_t - scaled integer value */ #define OPTST_SCALED_NUM 0x1000000U +/** opt_state_mask_t - disable from cmd line */ #define OPTST_NO_COMMAND 0x2000000U +/** opt_state_mask_t - support is being removed */ #define OPTST_DEPRECATED 0x4000000U +/** opt_state_mask_t - alias for other option */ #define OPTST_ALIAS 0x8000000U /** bits in SET mask: @@ -267,88 +325,141 @@ typedef uint32_t opt_state_mask_t; /** * Define the processing state flags + * @{ */ /** integral type for holding proc_state masks */ typedef uint32_t proc_state_mask_t; /** bits defined for proc_state_mask_t */ -#define OPTPROC_LONGOPT 0x00001U -#define OPTPROC_SHORTOPT 0x00002U -#define OPTPROC_ERRSTOP 0x00004U -#define OPTPROC_DISABLEDOPT 0x00008U -#define OPTPROC_NO_REQ_OPT 0x00010U -#define OPTPROC_NUM_OPT 0x00020U -#define OPTPROC_INITDONE 0x00040U -#define OPTPROC_NEGATIONS 0x00080U -#define OPTPROC_ENVIRON 0x00100U -#define OPTPROC_NO_ARGS 0x00200U -#define OPTPROC_ARGS_REQ 0x00400U -#define OPTPROC_REORDER 0x00800U -#define OPTPROC_GNUUSAGE 0x01000U -#define OPTPROC_TRANSLATE 0x02000U -#define OPTPROC_MISUSE 0x04000U -#define OPTPROC_IMMEDIATE 0x08000U -#define OPTPROC_NXLAT_OPT_CFG 0x10000U -#define OPTPROC_NXLAT_OPT 0x20000U -#define OPTPROC_VENDOR_OPT 0x40000U -#define OPTPROC_PRESETTING 0x80000U +/** proc_state_mask_t - Process long style options */ +#define OPTPROC_LONGOPT 0x000001U +/** proc_state_mask_t - Process short style "flags" */ +#define OPTPROC_SHORTOPT 0x000002U +/** proc_state_mask_t - Stop on argument errors */ +#define OPTPROC_ERRSTOP 0x000004U +/** proc_state_mask_t - Current option is disabled */ +#define OPTPROC_DISABLEDOPT 0x000008U +/** proc_state_mask_t - no options are required */ +#define OPTPROC_NO_REQ_OPT 0x000010U +/** proc_state_mask_t - there is a number option */ +#define OPTPROC_NUM_OPT 0x000020U +/** proc_state_mask_t - have inits been done? */ +#define OPTPROC_INITDONE 0x000040U +/** proc_state_mask_t - any negation options? */ +#define OPTPROC_NEGATIONS 0x000080U +/** proc_state_mask_t - check environment? */ +#define OPTPROC_ENVIRON 0x000100U +/** proc_state_mask_t - Disallow remaining arguments */ +#define OPTPROC_NO_ARGS 0x000200U +/** proc_state_mask_t - Require args after options */ +#define OPTPROC_ARGS_REQ 0x000400U +/** proc_state_mask_t - reorder operands after opts */ +#define OPTPROC_REORDER 0x000800U +/** proc_state_mask_t - emit usage in GNU style */ +#define OPTPROC_GNUUSAGE 0x001000U +/** proc_state_mask_t - Translate strings in tOptions */ +#define OPTPROC_TRANSLATE 0x002000U +/** proc_state_mask_t - no usage on usage error */ +#define OPTPROC_MISUSE 0x004000U +/** proc_state_mask_t - immediate options active */ +#define OPTPROC_IMMEDIATE 0x008000U +/** proc_state_mask_t - suppress for config only */ +#define OPTPROC_NXLAT_OPT_CFG 0x010000U +/** proc_state_mask_t - suppress xlation always */ +#define OPTPROC_NXLAT_OPT 0x020000U +/** proc_state_mask_t - vendor options active */ +#define OPTPROC_VENDOR_OPT 0x040000U +/** proc_state_mask_t - opt processing in preset state */ +#define OPTPROC_PRESETTING 0x080000U +/** proc_state_mask_t - Ignore pzFullUsage, compute usage text */ +#define OPTPROC_COMPUTE 0x100000U /** bits in NO_XLAT mask: * nxlat_opt_cfg nxlat_opt */ -#define OPTPROC_NO_XLAT_MASK 0x30000U +#define OPTPROC_NO_XLAT_MASK 0x030000U /** all bits in proc_state_mask_t masks */ -#define OPTPROC_MASK_ALL 0xFFFFFU +#define OPTPROC_MASK_ALL 0x1FFFFFU /** no bits in proc_state_mask_t */ -#define OPTPROC_NONE 0x00000U +#define OPTPROC_NONE 0x000000U +/** @} */ #define STMTS(s) do { s; } while (false) -/* - * The following must be #defined instead of typedef-ed - * because "char const" cannot both be applied to a type, - * tho each individually can...so they all are +/** + * Abbreviation for const memory character. */ #define tCC char const -/* - * Define a structure that describes each option and - * a pointer to the procedure that handles it. - * The argument is the count of this flag previously seen. +/** + * Magical values for the program's option pointer + * @{ */ +typedef enum { + OP_VAL_EMIT_USAGE = 1, ///< request for usage + OP_VAL_EMIT_SHELL = 2, ///< emit value for Bourne shell evaluation + OP_VAL_RETURN_VALNAME = 3, ///< return the value as a string + OP_VAL_EMIT_LIMIT = 15 ///< limit for magic values +} opt_proc_vals_t; + +/// \a OPT_VAL_EMIT_USAGE cast as a pointer +#define OPTPROC_EMIT_USAGE ((tOptions *)OP_VAL_EMIT_USAGE) + +/// \a OPT_VAL_EMIT_SHELL cast as a pointer +#define OPTPROC_EMIT_SHELL ((tOptions *)OP_VAL_EMIT_SHELL) + +/// \a OPT_VAL_RETURN_VALNAME cast as a pointer +#define OPTPROC_RETURN_VALNAME ((tOptions *)OP_VAL_RETURN_VALNAME) + +/// \a OPT_VAL_EMIT_LIMIT cast as a pointer +#define OPTPROC_EMIT_LIMIT ((tOptions *)OP_VAL_EMIT_LIMIT) +/** @} */ + +/** group option processing procedure types + * @{ + */ +/** forward declaration for tOptDesc */ +typedef struct opt_desc tOptDesc; +/** forward declaration for tOptiond */ typedef struct options tOptions; -typedef struct optDesc tOptDesc; -typedef struct optNames tOptNames; -#define OPTPROC_EMIT_USAGE ((tOptions *)0x01UL) -#define OPTPROC_EMIT_SHELL ((tOptions *)0x02UL) -#define OPTPROC_RETURN_VALNAME ((tOptions *)0x03UL) -#define OPTPROC_EMIT_LIMIT ((tOptions *)0x0FUL) -/* +/** * The option procedures do the special processing for each * option flag that needs it. */ typedef void (tOptProc)(tOptions * pOpts, tOptDesc * pOptDesc); + +/** + * a pointer to an option processing procedure + */ typedef tOptProc * tpOptProc; -/* +/** * The usage procedure will never return. It calls "exit(2)" * with the "exitCode" argument passed to it. */ // coverity[+kill] typedef void (tUsageProc)(tOptions* pOpts, int exitCode); + +/** + * a pointer to a procedure that prints usage and exits. + */ typedef tUsageProc * tpUsageProc; +/** @} */ -/* +/** * Special definitions. "NOLIMIT" is the 'max' value to use when * a flag may appear multiple times without limit. "NO_EQUIVALENT" * is an illegal value for 'optIndex' (option description index). + * @{ */ -#define NOLIMIT USHRT_MAX -#define OPTION_LIMIT SHRT_MAX +#define NOLIMIT USHRT_MAX ///< no occurrance count limit +#define OPTION_LIMIT SHRT_MAX ///< maximum number of option types +/// option index to indicate no equivalance or alias #define NO_EQUIVALENT (OPTION_LIMIT+1) +/** @} */ /** * Option argument value. Which is valid is determined by: @@ -356,111 +467,192 @@ typedef tUsageProc * tpUsageProc; * which will yield one of the teOptArgType values. */ typedef union { - char const * argString; - uintptr_t argEnum; - uintptr_t argIntptr; - long argInt; - unsigned long argUint; - unsigned int argBool; - FILE * argFp; - int argFd; + char const * argString; ///< as a string + uintptr_t argEnum; ///< as an enumeration value + uintptr_t argIntptr; ///< as an integer big enough to hold pointer + long argInt; ///< as a long integer + unsigned long argUint; ///< as an unsigned long ingeger + unsigned int argBool; ///< as a boolean value + FILE * argFp; ///< as a FILE * pointer + int argFd; ///< as a file descriptor (int) } opt_arg_union_t; +/// Compatibility define: \a pzLastArg is now \a optArg.argString #define pzLastArg optArg.argString +/// The old amorphous argument bucket is now the opt_arg_union_t union. #define optArgBucket_t opt_arg_union_t -/* +/** + * Enumeration of AutoOpts defined options. The enumeration is used in + * marking each option that is defined by AutoOpts so libopts can find + * the correct descriptor. This renders \a option_spec_idx_t redundant. + */ +typedef enum { + AOUSE_USER_DEFINED = 0, ///< user specified option + AOUSE_RESET_OPTION, ///< reset option state option + AOUSE_VERSION, ///< request version + AOUSE_HELP, ///< request usage help + AOUSE_MORE_HELP, ///< request paged usage + AOUSE_USAGE, ///< request short usage + AOUSE_SAVE_OPTS, ///< save option state + AOUSE_LOAD_OPTS, ///< load options from file + AOUSE_VENDOR_OPT ///< specify a vendor option +} opt_usage_t; + +/** * Descriptor structure for each option. * Only the fields marked "PUBLIC" are for public use. */ -struct optDesc { - unsigned short const optIndex; /* PUBLIC */ - unsigned short const optValue; /* PUBLIC */ - unsigned short optActualIndex; /* PUBLIC */ - unsigned short optActualValue; /* PUBLIC */ - - unsigned short const optEquivIndex; /* PUBLIC */ - unsigned short const optMinCt; - unsigned short const optMaxCt; - unsigned short optOccCt; /* PUBLIC */ - - opt_state_mask_t fOptState; /* PUBLIC */ - unsigned int reserved; - opt_arg_union_t optArg; /* PUBLIC */ - void * optCookie; /* PUBLIC */ - - int const * const pOptMust; - int const * const pOptCant; - tpOptProc const pOptProc; - char const * const pzText; - - char const * const pz_NAME; - char const * const pz_Name; - char const * const pz_DisableName; - char const * const pz_DisablePfx; +struct opt_desc { + /// Public, the index of this descriptor + uint16_t const optIndex; + /// Public, the flag character (value) + uint16_t const optValue; + /// Public, the index of the option used to activate option + uint16_t optActualIndex; + /// Public, the flag character of the activating option + uint16_t optActualValue; + + /// Public, the index of the equivalenced-to option. + /// This is NO_EQUIVALENT unless activated. + uint16_t const optEquivIndex; + /// Private, the minimum occurrance count + uint16_t const optMinCt; + /// Private, the maximum occurrance count (NOLIMIT, if unlimited) + uint16_t const optMaxCt; + /// Public, the actual occurrance count + uint16_t optOccCt; + + /// Public, the option processing state + opt_state_mask_t fOptState; + /// Private, how the option is used (opt_usage_t) + uint32_t optUsage; + /// Public, The current option argument value + opt_arg_union_t optArg; + /// Public, data that is actually private to the code that handles + /// this particular option. It is public IFF you have your own + /// handling function. + void * optCookie; + + /// Private, a list of options that must be specified when this option + /// has been specified + int const * const pOptMust; + + /// Private, a list of options that cannot be specified when this option + /// has been specified + int const * const pOptCant; + + /// Private, the function to call for handling this option + tpOptProc const pOptProc; + + /// Private, usage information about this option + char const * const pzText; + + /// Public, the UPPER CASE, shell variable name syntax name of the option + char const * const pz_NAME; + + /// the unmodified name of the option + char const * const pz_Name; + + /// the option name to use to disable the option. Long options names + /// must be active. + char const * const pz_DisableName; + + /// the special prefix that makes the normal option name become the + /// disablement name. + char const * const pz_DisablePfx; }; -/* +/** * Some options need special processing, so we store their - * indexes in a known place: + * indexes in a known place. */ -typedef struct optSpecIndex tOptSpecIndex; -struct optSpecIndex { - const unsigned short more_help; - const unsigned short save_opts; - const unsigned short number_option; - const unsigned short default_opt; -}; +typedef struct { + uint16_t const more_help; ///< passes help text through pager + uint16_t const save_opts; ///< stores option state to a file + uint16_t const number_option; ///< the option "name" is an integer + /// all arguments are options, this is the default option that must + /// take an argument. That argument is the unrecognized option. + uint16_t const default_opt; +} option_spec_idx_t; -/* +/** * The procedure generated for translating option text */ typedef void (tOptionXlateProc)(void); -/* +/** * Everything marked "PUBLIC" is also marked "const". Public access is not * a license to modify. Other fields are used and modified by the library. * They are also subject to change without any notice. * Do not even look at these outside of libopts. */ struct options { - int const structVersion; - unsigned int origArgCt; - char ** origArgVect; - proc_state_mask_t fOptSet; - unsigned int curOptIdx; - char * pzCurOpt; - - char const * const pzProgPath; /* PUBLIC */ - char const * const pzProgName; /* PUBLIC */ - char const * const pzPROGNAME; /* PUBLIC */ - char const * const pzRcName; /* PUBLIC */ - char const * const pzCopyright; /* PUBLIC */ - char const * const pzCopyNotice; /* PUBLIC */ - char const * const pzFullVersion; /* PUBLIC */ + int const structVersion; ///< The version of this struct + unsigned int origArgCt; ///< program argument count + char ** origArgVect; ///< program argument vector + proc_state_mask_t fOptSet; ///< option proc. state flags + unsigned int curOptIdx; ///< current option index + char * pzCurOpt; ///< current option text + + /// Public, the full path of the program + char const * const pzProgPath; + /// Public, the name of the executable, without any path + char const * const pzProgName; + /// Public, the upper-cased, shell variable syntax-ed program name + char const * const pzPROGNAME; + /// the name of the "rc file" (configuration file) + char const * const pzRcName; + /// the copyright text + char const * const pzCopyright; + /// the full copyright notice + char const * const pzCopyNotice; + /// a string with the program name, project name and version + char const * const pzFullVersion; + /// a list of pointers to directories to search for the config file char const * const * const papzHomeList; + /// the title line for usage char const * const pzUsageTitle; + /// some added explanation for what this program is trying to do char const * const pzExplain; + /// a detailed explanation of the program's purpose, for use when + /// full help has been requested char const * const pzDetail; - tOptDesc * const pOptDesc; /* PUBLIC */ - char const * const pzBugAddr; /* PUBLIC */ + /// The public array of option descriptors + tOptDesc * const pOptDesc; + /// the email address for reporting bugs + char const * const pzBugAddr; - void* pExtensions; - void* pSavedState; + /// Reserved for future use + void * pExtensions; + /// A copy of the option state when optionSaveState was called. + void * pSavedState; + /// The procedure to call to print usage text // coverity[+kill] tpUsageProc pUsageProc; - tOptionXlateProc* pTransProc; + /// The procedure to call to translate translatable option messages + tOptionXlateProc * pTransProc; - tOptSpecIndex specOptIdx; + /// Special option indexes. + option_spec_idx_t specOptIdx; + /// the total number of options for the program int const optCt; + /// The number of "presettable" options, though some may be marked + /// "no-preset". Includes all user specified options, plus a few + /// that are specified by AutoOpts. int const presetOptCt; + /// user specified full usage text char const * pzFullUsage; + /// user specifed short usage (usage error triggered) message char const * pzShortUsage; - /* PUBLIC: */ + /// The option argument settings active when optionSaveState was called opt_arg_union_t const * const originalOptArgArray; + /// any saved cookie value void * const * const originalOptArgCookie; + /// the package data directory (e.g. global configuration files) char const * const pzPkgDataDir; + /// email address of the project packager char const * const pzPackager; }; @@ -468,20 +660,33 @@ struct options { * Versions where in various fields first appear: * ($AO_CURRENT * 4096 + $AO_REVISION, but $AO_REVISION must be zero) */ -#define originalOptArgArray_STRUCT_VERSION 131072 /* AO_CURRENT = 32 */ +/** + * The version that first stored the original argument vector + */ +#define originalOptArgArray_STRUCT_VERSION 0x20000 /* AO_CURRENT = 32 */ #define HAS_originalOptArgArray(_opt) \ ((_opt)->structVersion >= originalOptArgArray_STRUCT_VERSION) -#define pzPkgDataDir_STRUCT_VERSION 139264 /* AO_CURRENT = 34 */ +/** + * The version that first stored the package data directory + */ +#define pzPkgDataDir_STRUCT_VERSION 0x22000 /* AO_CURRENT = 34 */ #define HAS_pzPkgDataDir(_opt) \ ((_opt)->structVersion >= pzPkgDataDir_STRUCT_VERSION) -/* +/** + * The version that first stored the option usage in each option descriptor + */ +#define opt_usage_t_STRUCT_VERSION 0x26000 /* AO_CURRENT = 38 */ +#define HAS_opt_usage_t(_opt) \ + ((_opt)->structVersion >= opt_usage_t_STRUCT_VERSION) + +/** * "token list" structure returned by "string_tokenize()" */ typedef struct { - unsigned long tkn_ct; - unsigned char* tkn_list[1]; + unsigned long tkn_ct; ///< number of tokens found + unsigned char* tkn_list[1]; ///< array of pointers to tokens } token_list_t; /* @@ -506,16 +711,19 @@ typedef struct { * is not zero, then there *may* not be a terminating NUL. */ typedef struct { - void * txt_data; /*@< text file data */ - size_t txt_size; /*@< actual file size */ - size_t txt_full_size; /*@< mmaped mem size */ - int txt_fd; /*@< file descriptor */ - int txt_zero_fd; /*@< fd for /dev/zero */ - int txt_errno; /*@< warning code */ - int txt_prot; /*@< "prot" flags */ - int txt_flags; /*@< mapping type */ + void * txt_data; ///< text file data + size_t txt_size; ///< actual file size + size_t txt_full_size; ///< mmaped mem size + int txt_fd; ///< file descriptor + int txt_zero_fd; ///< fd for /dev/zero + int txt_errno; ///< warning code + int txt_prot; ///< "prot" flags + int txt_flags; ///< mapping type } tmap_info_t; +/** + * mmap result wrapper that yields "true" when mmap has failed. + */ #define TEXT_MMAP_FAILED_ADDR(a) ((void*)(a) == (void*)MAP_FAILED) #ifdef __cplusplus @@ -526,29 +734,23 @@ CPLUSPLUS_OPENER #define CPLUSPLUS_CLOSER #endif -/* +/** * The following routines may be coded into AutoOpts client code: */ -/* From: tokenize.c line 162 - * +/** * ao_string_tokenize - tokenize an input string * - * Arguments: - * string string to be tokenized - * - * Returns: token_list_t* - pointer to a structure that lists each token - * * This function will convert one input string into a list of strings. * The list of strings is derived by separating the input based on * white space separation. However, if the input contains either single * or double quote characters, then the text after that character up to * a matching quote will become the string in the list. - * + * * The returned pointer should be deallocated with @code{free(3C)} when * are done using the data. The data are placed in a single block of * allocated memory. Do not deallocate individual token/strings. - * + * * The structure pointed to will contain at least these two fields: * @table @samp * @item tkn_ct @@ -557,7 +759,7 @@ CPLUSPLUS_OPENER * An array of @code{tkn_ct + 1} pointers to substring tokens, with * the last pointer set to NULL. * @end table - * + * * There are two types of quoted strings: single quoted (@code{'}) and * double quoted (@code{"}). Singly quoted strings are fairly raw in that * escape characters (@code{\\}) are simply another character, except when @@ -567,22 +769,20 @@ CPLUSPLUS_OPENER * @code{'} incorporates the single quote into the string * @code{\n} suppresses both the backslash and newline character * @end example - * + * * Double quote strings are formed according to the rules of string * constants in ANSI-C programs. + * + * @param string string to be tokenized + * + * @return token_list_t* - pointer to a structure that lists each token */ extern token_list_t* ao_string_tokenize(char const*); -/* From: configfile.c line 83 - * +/** * configFileLoad - parse a configuration file * - * Arguments: - * fname the file to load - * - * Returns: const tOptionValue* - An allocated, compound value structure - * * This routine will load a named configuration file and parse the * text as a hierarchically valued option. The option descriptor * created from an option definition file is not used via this interface. @@ -590,20 +790,17 @@ extern token_list_t* ao_string_tokenize(char const*); * type "@code{OPARG_TYPE_HIERARCHY}". It may be used in calls to * @code{optionGetValue()}, @code{optionNextValue()} and * @code{optionUnloadNested()}. + * + * @param fname the file to load + * + * @return const tOptionValue* - An allocated, compound value structure */ extern const tOptionValue* configFileLoad(char const*); -/* From: configfile.c line 1083 - * +/** * optionFileLoad - Load the locatable config files, in order * - * Arguments: - * opts program options descriptor - * prog program name - * - * Returns: int - 0 -> SUCCESS, -1 -> FAILURE - * * This function looks in all the specified directories for a configuration * file ("rc" file or "ini" file) and processes any found twice. The first * time through, they are processed in reverse order (last file first). At @@ -611,100 +808,92 @@ extern const tOptionValue* configFileLoad(char const*); * example, if the last named file specifies not processing any more * configuration files, then no more configuration files will be processed. * Such an option in the @strong{first} named directory will have no effect. - * + * * Once the immediate action configurables have been handled, then the * directories are handled in normal, forward order. In that way, later * config files can override the settings of earlier config files. - * + * * See the AutoOpts documentation for a thorough discussion of the * config file format. - * + * * Configuration files not found or not decipherable are simply ignored. + * + * @param opts program options descriptor + * @param prog program name + * + * @return int - 0 -> SUCCESS, -1 -> FAILURE */ extern int optionFileLoad(tOptions*, char const*); -/* From: configfile.c line 215 - * +/** * optionFindNextValue - find a hierarcicaly valued option instance * - * Arguments: - * odesc an option with a nested arg type - * pPrevVal the last entry - * name name of value to find - * value the matching value - * - * Returns: const tOptionValue* - a compound value structure - * * This routine will find the next entry in a nested value option or * configurable. It will search through the list and return the next entry * that matches the criteria. + * + * @param odesc an option with a nested arg type + * @param pPrevVal the last entry + * @param name name of value to find + * @param value the matching value + * + * @return const tOptionValue* - a compound value structure */ extern const tOptionValue* optionFindNextValue(const tOptDesc*, const tOptionValue*, char const*, char const*); -/* From: configfile.c line 142 - * +/** * optionFindValue - find a hierarcicaly valued option instance * - * Arguments: - * odesc an option with a nested arg type - * name name of value to find - * val the matching value - * - * Returns: const tOptionValue* - a compound value structure - * * This routine will find an entry in a nested value option or configurable. * It will search through the list and return a matching entry. + * + * @param odesc an option with a nested arg type + * @param name name of value to find + * @param val the matching value + * + * @return const tOptionValue* - a compound value structure */ extern const tOptionValue* optionFindValue(const tOptDesc*, char const*, char const*); -/* From: restore.c line 165 - * +/** * optionFree - free allocated option processing memory * - * Arguments: - * pOpts program options descriptor - * * AutoOpts sometimes allocates memory and puts pointers to it in the * option state structures. This routine deallocates all such memory. + * + * @param pOpts program options descriptor */ extern void optionFree(tOptions*); -/* From: configfile.c line 284 - * +/** * optionGetValue - get a specific value from a hierarcical list * - * Arguments: - * pOptValue a hierarchcal value - * valueName name of value to get - * - * Returns: const tOptionValue* - a compound value structure - * * This routine will find an entry in a nested value option or configurable. * If "valueName" is NULL, then the first entry is returned. Otherwise, * the first entry with a name that exactly matches the argument will be * returned. If there is no matching value, NULL is returned and errno is * set to ENOENT. If the provided option value is not a hierarchical value, * NULL is also returned and errno is set to EINVAL. + * + * @param pOptValue a hierarchcal value + * @param valueName name of value to get + * + * @return const tOptionValue* - a compound value structure */ extern const tOptionValue* optionGetValue(const tOptionValue*, char const*); -/* From: load.c line 484 - * +/** * optionLoadLine - process a string for an option name and value * - * Arguments: - * opts program options descriptor - * line NUL-terminated text - * * This is a client program callable routine for setting options from, for * example, the contents of a file that they read in. Only one option may * appear in the text. It will be treated as a normal (non-preset) option. - * + * * When passed a pointer to the option struct and a string, it will find * the option named by the first token on the string and set the option * argument to the remainder of the string. The caller must NUL terminate @@ -714,62 +903,53 @@ extern const tOptionValue* optionGetValue(const tOptionValue*, char const*); * input will be "cooked". The "cooking" is identical to the string * formation used in AutoGen definition files (@pxref{basic expression}), * except that you may not use backquotes. + * + * @param opts program options descriptor + * @param line NUL-terminated text */ extern void optionLoadLine(tOptions*, char const*); -/* From: configfile.c line 343 - * +/** * optionNextValue - get the next value from a hierarchical list * - * Arguments: - * pOptValue a hierarchcal list value - * pOldValue a value from this list - * - * Returns: const tOptionValue* - a compound value structure - * * This routine will return the next entry after the entry passed in. At the * end of the list, NULL will be returned. If the entry is not found on the * list, NULL will be returned and "@var{errno}" will be set to EINVAL. * The "@var{pOldValue}" must have been gotten from a prior call to this * routine or to "@code{opitonGetValue()}". + * + * @param pOptValue a hierarchcal list value + * @param pOldValue a value from this list + * + * @return const tOptionValue* - a compound value structure */ extern const tOptionValue* optionNextValue(const tOptionValue*, const tOptionValue*); -/* From: usage.c line 199 - * +/** * optionOnlyUsage - Print usage text for just the options * - * Arguments: - * pOpts program options descriptor - * ex_code exit code for calling exit(3) - * * This routine will print only the usage for each option. * This function may be used when the emitted usage must incorporate * information not available to AutoOpts. + * + * @param pOpts program options descriptor + * @param ex_code exit code for calling exit(3) */ extern void optionOnlyUsage(tOptions*, int); -/* From: autoopts.c line 319 - * +/** * optionProcess - this is the main option processing routine * - * Arguments: - * opts program options descriptor - * a_ct program arg count - * a_v program arg vector - * - * Returns: int - the count of the arguments processed - * * This is the main entry point for processing options. It is intended * that this procedure be called once at the beginning of the execution of * a program. Depending on options selected earlier, it is sometimes * necessary to stop and restart option processing, or to select completely * different sets of options. This can be done easily, but you generally * do not want to do this. - * + * * The number of arguments processed always includes the program name. * If one of the arguments is "--", then it is counted and the processing * stops. If an error was encountered and errors are to be tolerated, then @@ -778,41 +958,41 @@ extern void optionOnlyUsage(tOptions*, int); * @emph{not} be counted among the processed arguments. A hyphen by itself * is treated as an operand. Encountering an operand stops option * processing. + * + * @param opts program options descriptor + * @param a_ct program arg count + * @param a_v program arg vector + * + * @return int - the count of the arguments processed */ extern int optionProcess(tOptions*, int, char**); -/* From: restore.c line 122 - * +/** * optionRestore - restore option state from memory copy * - * Arguments: - * pOpts program options descriptor - * * Copy back the option state from saved memory. * The allocated memory is left intact, so this routine can be * called repeatedly without having to call optionSaveState again. * If you are restoring a state that was saved before the first call * to optionProcess(3AO), then you may change the contents of the * argc/argv parameters to optionProcess. + * + * @param pOpts program options descriptor */ extern void optionRestore(tOptions*); -/* From: save.c line 646 - * +/** * optionSaveFile - saves the option state to a file * - * Arguments: - * pOpts program options descriptor - * * This routine will save the state of option processing to a file. The name * of that file can be specified with the argument to the @code{--save-opts} * option, or by appending the @code{rcfile} attribute to the last * @code{homerc} attribute. If no @code{rcfile} attribute was specified, it * will default to @code{.@i{programname}rc}. If you wish to specify another * file, you should invoke the @code{SET_OPT_SAVE_OPTS(@i{filename})} macro. - * + * * The recommend usage is as follows: * @example * optionProcess(&progOptions, argc, argv); @@ -820,101 +1000,88 @@ extern void optionRestore(tOptions*); * SET_OPT_SAVE_OPTS("myfilename"); * optionSaveFile(&progOptions); * @end example + * + * @param opts program options descriptor */ extern void optionSaveFile(tOptions*); -/* From: restore.c line 69 - * +/** * optionSaveState - saves the option state to memory * - * Arguments: - * pOpts program options descriptor - * * This routine will allocate enough memory to save the current option * processing state. If this routine has been called before, that memory * will be reused. You may only save one copy of the option state. This * routine may be called before optionProcess(3AO). If you do call it * before the first call to optionProcess, then you may also change the * contents of argc/argv after you call optionRestore(3AO) - * + * * In fact, more strongly put: it is safest to only use this function * before having processed any options. In particular, the saving and * restoring of stacked string arguments and hierarchical values is * disabled. The values are not saved. + * + * @param pOpts program options descriptor */ extern void optionSaveState(tOptions*); -/* From: nested.c line 628 - * +/** * optionUnloadNested - Deallocate the memory for a nested value * - * Arguments: - * pOptVal the hierarchical value - * * A nested value needs to be deallocated. The pointer passed in should * have been gotten from a call to @code{configFileLoad()} (See * @pxref{libopts-configFileLoad}). + * + * @param pOptVal the hierarchical value */ extern void optionUnloadNested(tOptionValue const *); -/* From: version.c line 29 - * +/** * optionVersion - return the compiled AutoOpts version number * - * Returns: char const* - the version string in constant memory - * * Returns the full version string compiled into the library. * The returned string cannot be modified. + * + * @return char const* - the version string in constant memory */ extern char const* optionVersion(void); -/* From: streqvcmp.c line 207 - * +/** * strequate - map a list of characters to the same value * - * Arguments: - * ch_list characters to equivalence - * * Each character in the input string get mapped to the first character * in the string. * This function name is mapped to option_strequate so as to not conflict * with the POSIX name space. + * + * @param ch_list characters to equivalence */ extern void strequate(char const*); -/* From: streqvcmp.c line 117 - * +/** * streqvcmp - compare two strings with an equivalence mapping * - * Arguments: - * str1 first string - * str2 second string - * - * Returns: int - the difference between two differing characters - * * Using a character mapping, two strings are compared for "equivalence". * Each input character is mapped to a comparison character and the * mapped-to characters are compared for the two NUL terminated input strings. * This function name is mapped to option_streqvcmp so as to not conflict * with the POSIX name space. + * + * @param str1 first string + * @param str2 second string + * + * @return int - the difference between two differing characters */ extern int streqvcmp(char const*, char const*); -/* From: streqvcmp.c line 154 - * +/** * streqvmap - Set the character mappings for the streqv functions * - * Arguments: - * From Input character - * To Mapped-to character - * ct compare length - * * Set the character mapping. If the count (@code{ct}) is set to zero, then * the map is cleared by setting all entries in the map to their index * value. Otherwise, the "@code{From}" character is mapped to the "@code{To}" @@ -927,48 +1094,48 @@ extern int streqvcmp(char const*, char const*); * @noindent * will alter the mapping so that all English lower case letters * will map to upper case. - * + * * This function name is mapped to option_streqvmap so as to not conflict * with the POSIX name space. + * + * @param from Input character + * @param to Mapped-to character + * @param ct compare length */ extern void streqvmap(char, char, int); -/* From: streqvcmp.c line 76 - * +/** * strneqvcmp - compare two strings with an equivalence mapping * - * Arguments: - * str1 first string - * str2 second string - * ct compare length - * - * Returns: int - the difference between two differing characters - * * Using a character mapping, two strings are compared for "equivalence". * Each input character is mapped to a comparison character and the * mapped-to characters are compared for the two NUL terminated input strings. * The comparison is limited to @code{ct} bytes. * This function name is mapped to option_strneqvcmp so as to not conflict * with the POSIX name space. + * + * @param str1 first string + * @param str2 second string + * @param ct compare length + * + * @return int - the difference between two differing characters */ extern int strneqvcmp(char const*, char const*, int); -/* From: streqvcmp.c line 233 - * +/** * strtransform - convert a string into its mapped-to value * - * Arguments: - * dest output string - * src input string - * * Each character in the input string is mapped and the mapped-to * character is put into the output. * This function name is mapped to option_strtransform so as to not conflict * with the POSIX name space. - * + * * The source and destination may be the same. + * + * @param dest output string + * @param src input string */ extern void strtransform(char*, char const*); @@ -981,7 +1148,7 @@ extern unsigned int ao_string_cook_escape_char(char const*, char*, unsigned int) extern void genshelloptUsage(tOptions*, int); -extern int optionAlias(tOptions*, tOptDesc*, unsigned int); +extern int optionAlias(tOptions *, tOptDesc *, unsigned int); extern void optionBooleanVal(tOptions*, tOptDesc*); @@ -1003,10 +1170,14 @@ extern void optionPagedUsage(tOptions*, tOptDesc*); extern void optionParseShell(tOptions*); +extern void optionPrintParagraphs(char const *, bool, FILE *); + extern void optionPrintVersion(tOptions*, tOptDesc*); extern void optionPutShell(tOptions*); +extern char const * optionQuoteString(char const *, char const *); + extern void optionResetOpt(tOptions*, tOptDesc*); extern void optionSetMembers(tOptions*, tOptDesc*, char const * const *, unsigned int); @@ -1033,7 +1204,8 @@ extern int text_munmap(tmap_info_t*); CPLUSPLUS_CLOSER #endif /* AUTOOPTS_OPTIONS_H_GUARD */ -/* +/** @} + * * Local Variables: * c-file-style: "stroustrup" * indent-tabs-mode: nil diff --git a/sntp/libopts/autoopts/project.h b/sntp/libopts/autoopts/project.h index 573616d264..34a215368d 100644 --- a/sntp/libopts/autoopts/project.h +++ b/sntp/libopts/autoopts/project.h @@ -16,11 +16,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ #ifndef AUTOGEN_PROJECT_H diff --git a/sntp/libopts/autoopts/usage-txt.h b/sntp/libopts/autoopts/usage-txt.h index 58376b7634..e6dc6263e5 100644 --- a/sntp/libopts/autoopts/usage-txt.h +++ b/sntp/libopts/autoopts/usage-txt.h @@ -1,37 +1,39 @@ -/** -*- buffer-read-only: t -*- vi: set ro: - * - * DO NOT EDIT THIS FILE (usage-txt.h) - * - * It has been AutoGen-ed January 4, 2013 at 04:15:47 PM by AutoGen 5.17.1pre14 - * From the definitions usage-txt.def - * and the template file usage-txt.tpl - * @file usage-txt.h +/* -*- buffer-read-only: t -*- vi: set ro: + * + * DO NOT EDIT THIS FILE (usage-txt.h) + * + * It has been AutoGen-ed February 21, 2013 at 12:28:34 PM by AutoGen 5.17.2pre16 + * From the definitions usage-txt.def + * and the template file usage-txt.tpl + * + * This file is part of AutoOpts, a companion to AutoGen. + * AutoOpts is free software. + * 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 + * of the user of the license. + * + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" + * + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" + * + * These files have the following sha256 sums: + * + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd + */ +/** @file usage-txt.h * * This file handles all the bookkeeping required for tracking all the little - * tiny strings used by the AutoOpts library. There are 146 + * tiny strings used by the AutoOpts library. There are 108 * of them. This is not versioned because it is entirely internal to the * library and accessed by client code only in a very well-controlled way: * they may substitute translated strings using a procedure that steps through * all the string pointers. - * - * Copyright (C) 1992-2013 Bruce Korb, all rights reserved. - * This is free software. It is licensed for use, modification and - * redistribution under the terms of the - * GNU Lesser General Public License, version 3 or later - * - * - * AutoOpts is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * AutoOpts is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see ."; */ #ifndef AUTOOPTS_USAGE_TXT_H_GUARD #define AUTOOPTS_USAGE_TXT_H_GUARD 1 @@ -42,13 +44,10 @@ typedef struct { int field_ct; char * utpz_GnuBoolArg; - char * utpz_GnuFileArg; char * utpz_GnuKeyArg; - char * utpz_GnuKeyLArg; char * utpz_GnuNumArg; char * utpz_GnuStrArg; - char * utpz_GnuTimeArg; - char const * apz_str[91]; + char const * apz_str[104]; } usage_text_t; /* @@ -56,7 +55,7 @@ typedef struct { * strings and the text array containing untranslatable strings. */ extern usage_text_t option_xlateable_txt; -extern char const option_lib_text[4660]; +extern char const option_lib_text[4283]; #if defined(AUTOOPTS_INTERNAL) /* @@ -64,323 +63,244 @@ extern char const option_lib_text[4660]; * (for untranslatable strings), or to pointers to the text, rendering * them translatable. */ -#define zAO_Alloc (option_xlateable_txt.apz_str[ 0]) -#define zAO_Bad (option_xlateable_txt.apz_str[ 1]) -#define zAO_Big (option_xlateable_txt.apz_str[ 2]) -#define zAO_Err (option_xlateable_txt.apz_str[ 3]) -#define zAO_Realloc (option_xlateable_txt.apz_str[ 4]) -#define zAO_Sml (option_xlateable_txt.apz_str[ 5]) -#define zAO_Strdup (option_xlateable_txt.apz_str[ 6]) -#define zAO_Ver (option_xlateable_txt.apz_str[ 7]) -#define zAO_Woops (option_xlateable_txt.apz_str[ 8]) -#define zAliasRange (option_xlateable_txt.apz_str[ 9]) -#define zAll (option_xlateable_txt.apz_str[ 10]) -#define zAlt (option_lib_text + 547) -#define zAmbigKey (option_xlateable_txt.apz_str[ 11]) -#define zAmbigList (option_xlateable_txt.apz_str[ 12]) -#define zAmbigOptStr (option_xlateable_txt.apz_str[ 13]) -#define zAmbiguous (option_xlateable_txt.apz_str[ 14]) -#define zArgsMust (option_xlateable_txt.apz_str[ 15]) -#define zAtMost (option_xlateable_txt.apz_str[ 16]) -#define zAuto (option_xlateable_txt.apz_str[ 17]) -#define zBadPipe (option_xlateable_txt.apz_str[ 18]) -#define zBadVerArg (option_xlateable_txt.apz_str[ 19]) -#define zCantFmt (option_xlateable_txt.apz_str[ 20]) -#define zCantSave (option_xlateable_txt.apz_str[ 21]) -#define zCfgAO_Flags (option_xlateable_txt.apz_str[ 22]) -#define zCfgProg (option_xlateable_txt.apz_str[ 23]) -#define zDefaultOpt (option_xlateable_txt.apz_str[ 24]) -#define zDis (option_xlateable_txt.apz_str[ 25]) -#define zDisabledErr (option_xlateable_txt.apz_str[ 26]) -#define zDisabledOpt (option_lib_text + 1225) -#define zDisabledWhy (option_xlateable_txt.apz_str[ 27]) -#define zEnab (option_lib_text + 1270) -#define zEquiv (option_xlateable_txt.apz_str[ 28]) -#define zErrOnly (option_xlateable_txt.apz_str[ 29]) -#define zExamineFmt (option_xlateable_txt.apz_str[ 30]) -#define zFSErrOptLoad (option_xlateable_txt.apz_str[ 31]) -#define zFSErrReadFile (option_xlateable_txt.apz_str[ 32]) -#define zFSOptErrFopen (option_xlateable_txt.apz_str[ 33]) -#define zFSOptErrMayExist (option_xlateable_txt.apz_str[ 34]) -#define zFSOptErrMustExist (option_xlateable_txt.apz_str[ 35]) -#define zFSOptErrNoExist (option_xlateable_txt.apz_str[ 36]) -#define zFSOptErrOpen (option_xlateable_txt.apz_str[ 37]) -#define zFSOptError (option_xlateable_txt.apz_str[ 38]) -#define zFileCannotExist (option_lib_text + 1605) -#define zFileMustExist (option_lib_text + 1636) -#define zFiveSpaces (option_lib_text + 1663) -#define zFlagOkay (option_xlateable_txt.apz_str[ 39]) -#define zFmtFmt (option_lib_text + 1772) -#define zForkFail (option_xlateable_txt.apz_str[ 40]) -#define zFreopenFail (option_xlateable_txt.apz_str[ 41]) -#define zGenshell (option_xlateable_txt.apz_str[ 42]) +#define zalloc_fail (option_xlateable_txt.apz_str[ 0]) +#define zno_opt_arg (option_xlateable_txt.apz_str[ 1]) +#define ztoo_new (option_xlateable_txt.apz_str[ 2]) +#define zwrong_ver (option_xlateable_txt.apz_str[ 3]) +#define zrealloc_fail (option_xlateable_txt.apz_str[ 4]) +#define ztoo_old (option_xlateable_txt.apz_str[ 5]) +#define zao_ver_fmt (option_xlateable_txt.apz_str[ 6]) +#define zao_bug_msg (option_xlateable_txt.apz_str[ 7]) +#define zno_reset (option_xlateable_txt.apz_str[ 8]) +#define zmissing_help_msg (option_xlateable_txt.apz_str[ 9]) +#define zbad_data_msg (option_xlateable_txt.apz_str[ 10]) +#define zbad_arg_type_msg (option_xlateable_txt.apz_str[ 11]) +#define zbad_default_msg (option_xlateable_txt.apz_str[ 12]) +#define zbad_alias_id (option_xlateable_txt.apz_str[ 13]) +#define zambiguous_key (option_xlateable_txt.apz_str[ 14]) +#define zambig_list_msg (option_xlateable_txt.apz_str[ 15]) +#define zambig_opt_fmt (option_xlateable_txt.apz_str[ 16]) +#define zargs_must (option_xlateable_txt.apz_str[ 17]) +#define zat_most (option_xlateable_txt.apz_str[ 18]) +#define zfserr_fmt (option_xlateable_txt.apz_str[ 19]) +#define zinter_proc_pipe (option_xlateable_txt.apz_str[ 20]) +#define zBadVerArg (option_xlateable_txt.apz_str[ 21]) +#define zconflict_fmt (option_xlateable_txt.apz_str[ 22]) +#define zDisabledErr (option_xlateable_txt.apz_str[ 23]) +#define zequiv (option_xlateable_txt.apz_str[ 24]) #define zGnuBoolArg (option_xlateable_txt.utpz_GnuBoolArg) -#define zGnuBreak (option_lib_text + 1970) -#define zGnuFileArg (option_xlateable_txt.utpz_GnuFileArg) #define zGnuKeyArg (option_xlateable_txt.utpz_GnuKeyArg) -#define zGnuKeyLArg (option_xlateable_txt.utpz_GnuKeyLArg) -#define zGnuNestArg (option_lib_text + 1976) #define zGnuNumArg (option_xlateable_txt.utpz_GnuNumArg) -#define zGnuOptArg (option_lib_text + 1982) -#define zGnuOptFmt (option_lib_text + 1989) #define zGnuStrArg (option_xlateable_txt.utpz_GnuStrArg) -#define zGnuTimeArg (option_xlateable_txt.utpz_GnuTimeArg) -#define zIllOptChr (option_xlateable_txt.apz_str[ 43]) -#define zIllOptStr (option_xlateable_txt.apz_str[ 44]) -#define zIllVendOptStr (option_xlateable_txt.apz_str[ 45]) -#define zIntRange (option_xlateable_txt.apz_str[ 46]) -#define zInvalOptDesc (option_xlateable_txt.apz_str[ 47]) -#define zInvalOptName (option_xlateable_txt.apz_str[ 48]) -#define zLowerBits (option_xlateable_txt.apz_str[ 49]) -#define zMembers (option_lib_text + 2267) -#define zMisArg (option_xlateable_txt.apz_str[ 50]) -#define zMultiEquiv (option_xlateable_txt.apz_str[ 51]) -#define zMust (option_lib_text + 2404) -#define zNeedOne (option_xlateable_txt.apz_str[ 52]) -#define zNoArg (option_xlateable_txt.apz_str[ 53]) -#define zNoArgs (option_xlateable_txt.apz_str[ 54]) -#define zNoCreat (option_xlateable_txt.apz_str[ 55]) -#define zNoFlags (option_xlateable_txt.apz_str[ 56]) -#define zNoKey (option_xlateable_txt.apz_str[ 57]) -#define zNoLim (option_lib_text + 2705) -#define zNoPreset (option_lib_text + 2738) -#define zNoResetArg (option_xlateable_txt.apz_str[ 58]) -#define zNoRq_NoShrtTtl (option_xlateable_txt.apz_str[ 59]) -#define zNoRq_ShrtTtl (option_xlateable_txt.apz_str[ 60]) -#define zNoStat (option_xlateable_txt.apz_str[ 61]) -#define zNoState (option_xlateable_txt.apz_str[ 62]) -#define zNone (option_xlateable_txt.apz_str[ 63]) -#define zNotCmdOpt (option_xlateable_txt.apz_str[ 64]) -#define zNotDate (option_xlateable_txt.apz_str[ 65]) -#define zNotDef (option_xlateable_txt.apz_str[ 66]) -#define zNotDuration (option_xlateable_txt.apz_str[ 67]) -#define zNotEnough (option_xlateable_txt.apz_str[ 68]) -#define zNotFile (option_xlateable_txt.apz_str[ 69]) -#define zNotNumber (option_xlateable_txt.apz_str[ 70]) -#define zNrmOptFmt (option_lib_text + 3264) -#define zNumberOpt (option_lib_text + 3272) -#define zOnlyOne (option_xlateable_txt.apz_str[ 71]) -#define zOptsOnly (option_lib_text + 3345) -#define zOutputFail (option_xlateable_txt.apz_str[ 72]) -#define zPathFmt (option_xlateable_txt.apz_str[ 73]) -#define zPlsSendBugs (option_xlateable_txt.apz_str[ 74]) -#define zPreset (option_lib_text + 3461) -#define zPresetFile (option_lib_text + 3497) -#define zPresetIntro (option_xlateable_txt.apz_str[ 75]) -#define zProhib (option_lib_text + 3591) -#define zRange (option_lib_text + 3617) -#define zRangeAbove (option_lib_text + 3630) -#define zRangeErr (option_xlateable_txt.apz_str[ 76]) -#define zRangeExact (option_lib_text + 3710) -#define zRangeLie (option_xlateable_txt.apz_str[ 77]) -#define zRangeOnly (option_xlateable_txt.apz_str[ 78]) -#define zRangeOr (option_lib_text + 3789) -#define zRangeScaled (option_lib_text + 3795) -#define zRangeUpto (option_lib_text + 3841) -#define zReorder (option_xlateable_txt.apz_str[ 79]) -#define zReqFmt (option_xlateable_txt.apz_str[ 80]) -#define zReqOptFmt (option_lib_text + 3977) -#define zReqThese (option_xlateable_txt.apz_str[ 81]) -#define zReq_NoShrtTtl (option_xlateable_txt.apz_str[ 82]) -#define zReq_ShrtTtl (option_xlateable_txt.apz_str[ 83]) -#define zResetNotConfig (option_xlateable_txt.apz_str[ 84]) -#define zSepChars (option_xlateable_txt.apz_str[ 85]) -#define zSetMemberSettings (option_xlateable_txt.apz_str[ 86]) -#define zShrtGnuOptFmt (option_lib_text + 4367) -#define zSixSpaces (option_lib_text + 4370) -#define zStdBoolArg (option_lib_text + 4377) -#define zStdBreak (option_lib_text + 4381) -#define zStdFileArg (option_lib_text + 4389) -#define zStdKeyArg (option_lib_text + 4393) -#define zStdKeyLArg (option_lib_text + 4397) -#define zStdNestArg (option_lib_text + 4401) -#define zStdNoArg (option_lib_text + 4405) -#define zStdNumArg (option_lib_text + 4409) -#define zStdOptArg (option_lib_text + 4413) -#define zStdReqArg (option_lib_text + 4417) -#define zStdStrArg (option_lib_text + 4421) -#define zStdTimeArg (option_lib_text + 4425) -#define zTabHyp (option_lib_text + 4429) -#define zTabHypAnd (option_lib_text + 4436) -#define zTabout (option_lib_text + 4448) -#define zThreeSpaces (option_lib_text + 4456) -#define zTooLarge (option_xlateable_txt.apz_str[ 87]) -#define zTwoSpaces (option_lib_text + 4500) -#define zUpTo (option_lib_text + 4503) -#define zValidKeys (option_xlateable_txt.apz_str[ 88]) -#define zVendIntro (option_xlateable_txt.apz_str[ 89]) -#define zVendOptsAre (option_xlateable_txt.apz_str[ 90]) +#define zIllOptChr (option_xlateable_txt.apz_str[ 25]) +#define zIllOptStr (option_xlateable_txt.apz_str[ 26]) +#define zIllVendOptStr (option_xlateable_txt.apz_str[ 27]) +#define zIntRange (option_xlateable_txt.apz_str[ 28]) +#define zbad_od (option_xlateable_txt.apz_str[ 29]) +#define zInvalOptName (option_xlateable_txt.apz_str[ 30]) +#define zMisArg (option_xlateable_txt.apz_str[ 31]) +#define zmultiway_bug (option_xlateable_txt.apz_str[ 32]) +#define zneed_one (option_xlateable_txt.apz_str[ 33]) +#define zNoArg (option_xlateable_txt.apz_str[ 34]) +#define zNoArgs (option_xlateable_txt.apz_str[ 35]) +#define zNoCreat (option_xlateable_txt.apz_str[ 36]) +#define zNoKey (option_xlateable_txt.apz_str[ 37]) +#define zreset_arg (option_xlateable_txt.apz_str[ 38]) +#define zNoStat (option_xlateable_txt.apz_str[ 39]) +#define zNoState (option_xlateable_txt.apz_str[ 40]) +#define zNotCmdOpt (option_xlateable_txt.apz_str[ 41]) +#define zNotDate (option_xlateable_txt.apz_str[ 42]) +#define zNotDef (option_xlateable_txt.apz_str[ 43]) +#define zNotDuration (option_xlateable_txt.apz_str[ 44]) +#define zneed_more (option_xlateable_txt.apz_str[ 45]) +#define zNotNumber (option_xlateable_txt.apz_str[ 46]) +#define znum_too_large (option_xlateable_txt.apz_str[ 47]) +#define zoffer_usage_fmt (option_xlateable_txt.apz_str[ 48]) +#define zonly_one (option_xlateable_txt.apz_str[ 49]) +#define zstdout_name (option_xlateable_txt.apz_str[ 50]) +#define zstderr_name (option_xlateable_txt.apz_str[ 51]) +#define zwriting (option_xlateable_txt.apz_str[ 52]) +#define zRangeErr (option_xlateable_txt.apz_str[ 53]) +#define zneed_fmt (option_xlateable_txt.apz_str[ 54]) +#define zsave_warn (option_xlateable_txt.apz_str[ 55]) +#define zalt_opt (option_xlateable_txt.apz_str[ 56]) +#define zAuto (option_xlateable_txt.apz_str[ 57]) +#define zDefaultOpt (option_xlateable_txt.apz_str[ 58]) +#define zDis (option_xlateable_txt.apz_str[ 59]) +#define zDisabledOpt (option_xlateable_txt.apz_str[ 60]) +#define zDisabledWhy (option_xlateable_txt.apz_str[ 61]) +#define zEnab (option_xlateable_txt.apz_str[ 62]) +#define ztoo_often_fmt (option_xlateable_txt.apz_str[ 63]) +#define zExamineFmt (option_xlateable_txt.apz_str[ 64]) +#define zFileCannotExist (option_xlateable_txt.apz_str[ 65]) +#define zFileMustExist (option_xlateable_txt.apz_str[ 66]) +#define zFlagOkay (option_xlateable_txt.apz_str[ 67]) +#define zGenshell (option_xlateable_txt.apz_str[ 68]) +#define zLowerBits (option_xlateable_txt.apz_str[ 69]) +#define zMembers (option_xlateable_txt.apz_str[ 70]) +#define zMust (option_xlateable_txt.apz_str[ 71]) +#define zNoFlags (option_xlateable_txt.apz_str[ 72]) +#define zNoLim (option_xlateable_txt.apz_str[ 73]) +#define zNoPreset (option_xlateable_txt.apz_str[ 74]) +#define zNoRq_NoShrtTtl (option_xlateable_txt.apz_str[ 75]) +#define zNoRq_ShrtTtl (option_xlateable_txt.apz_str[ 76]) +#define zNrmOptFmt (option_xlateable_txt.apz_str[ 77]) +#define zNumberOpt (option_xlateable_txt.apz_str[ 78]) +#define zOptsOnly (option_xlateable_txt.apz_str[ 79]) +#define zPathFmt (option_xlateable_txt.apz_str[ 80]) +#define zPlsSendBugs (option_xlateable_txt.apz_str[ 81]) +#define zPreset (option_xlateable_txt.apz_str[ 82]) +#define zPresetIntro (option_xlateable_txt.apz_str[ 83]) +#define zProhib (option_xlateable_txt.apz_str[ 84]) +#define zProhibOne (option_xlateable_txt.apz_str[ 85]) +#define zRange (option_xlateable_txt.apz_str[ 86]) +#define zRangeAbove (option_xlateable_txt.apz_str[ 87]) +#define zRangeExact (option_xlateable_txt.apz_str[ 88]) +#define zRangeLie (option_xlateable_txt.apz_str[ 89]) +#define zRangeOnly (option_xlateable_txt.apz_str[ 90]) +#define zRangeOr (option_xlateable_txt.apz_str[ 91]) +#define zRangeScaled (option_xlateable_txt.apz_str[ 92]) +#define zRangeUpto (option_xlateable_txt.apz_str[ 93]) +#define zReorder (option_xlateable_txt.apz_str[ 94]) +#define zReqOne (option_xlateable_txt.apz_str[ 95]) +#define zReqThese (option_xlateable_txt.apz_str[ 96]) +#define zReq_NoShrtTtl (option_xlateable_txt.apz_str[ 97]) +#define zReq_ShrtTtl (option_xlateable_txt.apz_str[ 98]) +#define zSetMemberSettings (option_xlateable_txt.apz_str[ 99]) +#define zUpTo (option_xlateable_txt.apz_str[100]) +#define zValidKeys (option_xlateable_txt.apz_str[101]) +#define zVendIntro (option_xlateable_txt.apz_str[102]) +#define zVendOptsAre (option_xlateable_txt.apz_str[103]) /* * First, set up the strings. Some of these are writable. These are all in * English. This gets compiled into libopts and is distributed here so that * xgettext (or equivalents) can extract these strings for translation. */ -static char eng_zGnuBoolArg[] = "=T/F"; -static char eng_zGnuFileArg[] = "=file"; -static char eng_zGnuKeyArg[] = "=KWd"; -static char eng_zGnuKeyLArg[] = "=Mbr"; -static char eng_zGnuNumArg[] = "=num"; -static char eng_zGnuStrArg[] = "=str"; -static char eng_zGnuTimeArg[] = "=Tim"; -char const option_lib_text[4660] = -/* 0 */ "malloc of %d bytes failed\n\0" -/* 27 */ "AutoOpts function called without option descriptor\n\0" -/* 79 */ "\tThis exceeds the compiled library version: \0" -/* 125 */ "Automated Options Processing Error!\n" +static char eng_zGnuBoolArg[] = "=T/F"; +static char eng_zGnuKeyArg[] = "=KWd"; +static char eng_zGnuNumArg[] = "=num"; +static char eng_zGnuStrArg[] = "=str"; +char const option_lib_text[4283] = +/* 0 */ "allocation of %d bytes failed\n\0" +/* 31 */ "AutoOpts function called without option descriptor\n\0" +/* 83 */ "\tThis exceeds the compiled library version: \0" +/* 129 */ "Automated Options Processing Error!\n" "\t%s called AutoOpts function with structure version %d:%d:%d.\n\0" -/* 224 */ "realloc of %d bytes at 0x%p failed\n\0" -/* 260 */ "\tThis is less than the minimum library version: \0" -/* 310 */ "strdup of %d byte string failed\n\0" -/* 343 */ "Automated Options version %s\n" +/* 228 */ "realloc of %d bytes at 0x%p failed\n\0" +/* 264 */ "\tThis is less than the minimum library version: \0" +/* 314 */ "Automated Options version %s\n" "\tCopyright (C) 1999-2013 by Bruce Korb - all rights reserved\n\0" -/* 434 */ "AutoOpts lib error: defaulted to option with optional arg\n\0" -/* 493 */ "(AutoOpts bug): Aliasing option is out of range.\0" -/* 543 */ "all\0" -/* 547 */ "\t\t\t\t- an alternate for %s\n\0" -/* 574 */ "%s error: the keyword `%s' is ambiguous for %s\n\0" -/* 623 */ " The following options match:\n\0" -/* 655 */ "%s: ambiguous option name: %s (matches %d options)\n\0" -/* 707 */ " %s%s\n\0" -/* 715 */ "%s: Command line arguments required\n\0" -/* 752 */ "%d %s%s options allowed\n\0" -/* 777 */ "version, usage and configuration options:\0" -/* 819 */ "Error %d (%s) from the pipe(2) syscall\n\0" -/* 859 */ "ERROR: version option argument '%c' invalid. Use:\n" +/* 405 */ "(AutoOpts bug): %s.\n\0" +/* 427 */ "optionResetOpt() called, but reset-option not configured\0" +/* 484 */ "could not locate the 'help' option\0" +/* 519 */ "optionProcess() was called with invalid data\0" +/* 564 */ "invalid argument type specified\0" +/* 596 */ "defaulted to option with optional arg\0" +/* 634 */ "aliasing option is out of range.\0" +/* 667 */ "%s error: the keyword '%s' is ambiguous for %s\n\0" +/* 716 */ " The following options match:\n\0" +/* 748 */ "%s: ambiguous option name: %s (matches %d options)\n\0" +/* 800 */ "%s: Command line arguments required\n\0" +/* 837 */ "%d %s%s options allowed\n\0" +/* 862 */ "%s error %d (%s) calling %s for '%s'\n\0" +/* 900 */ "interprocess pipe\0" +/* 918 */ "error: version option argument '%c' invalid. Use:\n" "\t'v' - version only\n" "\t'c' - version and copyright\n" - "\t'n' - version and copyright notice\n\0" -/* 996 */ "ERROR: %s option conflicts with the %s option\n\0" -/* 1044 */ "%s(optionSaveState): error: cannot allocate %d bytes\n\0" -/* 1098 */ "auto-options\0" -/* 1111 */ "program\0" -/* 1119 */ "\t\t\t\t- default option for unnamed options\n\0" -/* 1161 */ "\t\t\t\t- disabled as --%s\n\0" -/* 1185 */ "%s: The ``%s'' option has been disabled\0" -/* 1225 */ " --- %-14s %s\n\0" -/* 1240 */ "This option has been disabled\0" -/* 1270 */ "\t\t\t\t- enabled by default\n\0" -/* 1296 */ "-equivalence\0" -/* 1309 */ "ERROR: only \0" -/* 1323 */ " - examining environment variables named %s_*\n\0" -/* 1370 */ "File error %d (%s) opening %s for loading options\n\0" -/* 1421 */ "fs error %d (%s) reading file %s\n\0" -/* 1455 */ "fopen-ing file\0" -/* 1470 */ "stat-ing for directory\0" -/* 1493 */ "stat-ing for regular file\0" -/* 1519 */ "stat-ing for non-existant file\0" -/* 1550 */ "open-ing file\0" -/* 1564 */ "fs error %d (%s) on %s %s for option %s\n\0" -/* 1605 */ "\t\t\t\t- file must not pre-exist\n\0" -/* 1636 */ "\t\t\t\t- file must pre-exist\n\0" -/* 1663 */ " \0" -/* 1669 */ "Options are specified by doubled hyphens and their name or by a single\n" + "\t'n' - version and full copyright notice\n\0" +/* 1060 */ "%s error: the '%s' and '%s' options conflict\n\0" +/* 1107 */ "%s: The '%s' option has been disabled.\0" +/* 1146 */ "-equivalence\0" +/* 1159 */ "%s: illegal option -- %c\n\0" +/* 1185 */ "%s: illegal option -- %s\n\0" +/* 1211 */ "%s: unknown vendor extension option -- %s\n\0" +/* 1254 */ " or an integer from %d through %d\n\0" +/* 1290 */ "%s error: invalid option descriptor for %s\n\0" +/* 1335 */ "%s: invalid option name: %s\n\0" +/* 1364 */ "%s: The '%s' option requires an argument.\n\0" +/* 1407 */ "(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n" + "\t'%s' and '%s'\0" +/* 1489 */ "%s error: The %s option is required\n\0" +/* 1527 */ "%s: The '%s' option cannot have an argument.\n\0" +/* 1573 */ "%s: Command line arguments are not allowed.\n\0" +/* 1618 */ "error %d (%s) creating %s\n\0" +/* 1645 */ "%s error: '%s' does not match any %s keywords.\n\0" +/* 1694 */ "%s error: The '%s' option requires an argument.\n\0" +/* 1743 */ "error %d (%s) stat-ing %s\n\0" +/* 1770 */ "%s error: no saved option state\n\0" +/* 1803 */ "'%s' is not a command line option.\n\0" +/* 1839 */ "%s error: '%s' is not a recognizable date/time.\n\0" +/* 1889 */ "'%s' not defined\n\0" +/* 1907 */ "%s error: '%s' is not a recognizable time duration.\n\0" +/* 1961 */ "%s error: The %s option must appear %d times\n\0" +/* 2008 */ "%s error: '%s' is not a recognizable number.\n\0" +/* 2055 */ "%s error: %s exceeds %s keyword count\n\0" +/* 2095 */ "Try '%s %s' for more information.\n\0" +/* 2130 */ "one %s%s option allowed\n\0" +/* 2155 */ "standard output\0" +/* 2171 */ "standard error\0" +/* 2186 */ "write\0" +/* 2192 */ "%s error: %s option value %ld is out of range.\n\0" +/* 2241 */ "%s error: %s option requires the %s option\n\0" +/* 2286 */ "%s warning: cannot save options - %s not regular file\n\0" +/* 2342 */ "\t\t\t\t- an alternate for '%s'\n\0" +/* 2371 */ "Version, usage and configuration options:\0" +/* 2413 */ "\t\t\t\t- default option for unnamed options\n\0" +/* 2455 */ "\t\t\t\t- disabled as '--%s'\n\0" +/* 2481 */ " --- %-14s %s\n\0" +/* 2496 */ "This option has been disabled\0" +/* 2526 */ "\t\t\t\t- enabled by default\n\0" +/* 2552 */ "%s error: only \0" +/* 2569 */ " - examining environment variables named %s_*\n\0" +/* 2616 */ "\t\t\t\t- file must not pre-exist\n\0" +/* 2647 */ "\t\t\t\t- file must pre-exist\n\0" +/* 2674 */ "Options are specified by doubled hyphens and their name or by a single\n" "hyphen and the flag character.\n\0" -/* 1772 */ "%%-%ds %%s\n\0" -/* 1784 */ "fs error %d (%s) on fork - cannot obtain %s usage\n\0" -/* 1835 */ "fs error %d (%s) on freopen\n\0" -/* 1864 */ "\n" +/* 2777 */ "\n" "= = = = = = = =\n\n" "This incarnation of genshell will produce\n" "a shell script to parse the options for %s:\n\n\0" -/* 1970 */ "\n" - "%s\n\n\0" -/* 1976 */ "=Cplx\0" -/* 1982 */ "[=arg]\0" -/* 1989 */ "--%2$s%1$s\0" -/* 2000 */ "%s: illegal option -- %c\n\0" -/* 2026 */ "%s: illegal option -- %s\n\0" -/* 2052 */ "%s: unknown vendor extension option -- %s\n\0" -/* 2095 */ " or an integer from %d through %d\n\0" -/* 2131 */ "AutoOpts ERROR: invalid option descriptor for %s\n\0" -/* 2182 */ "%s: invalid option name: %s\n\0" -/* 2211 */ " or an integer mask with any of the lower %d bits set\n\0" -/* 2267 */ "\t\t\t\t- is a set membership option\n\0" -/* 2301 */ "%s: option `%s' requires an argument\n\0" -/* 2339 */ "Equivalenced option '%s' was equivalenced to both\n" - "\t'%s' and '%s'\0" -/* 2404 */ "\t\t\t\t- must appear between %d and %d times\n\0" -/* 2447 */ "ERROR: The %s option is required\n\0" -/* 2482 */ "%s: option `%s' cannot have an argument\n\0" -/* 2523 */ "%s: Command line arguments not allowed\n\0" -/* 2563 */ "error %d (%s) creating %s\n\0" -/* 2590 */ "Options are specified by single or double hyphens and their name.\n\0" -/* 2657 */ "%s error: `%s' does not match any %s keywords\n\0" -/* 2705 */ "\t\t\t\t- may appear multiple times\n\0" -/* 2738 */ "\t\t\t\t- may not be preset\n\0" -/* 2763 */ "The 'reset-option' option requires an argument\n\0" -/* 2811 */ " Arg Option-Name Description\n\0" -/* 2846 */ " Flg Arg Option-Name Description\n\0" -/* 2884 */ "error %d (%s) stat-ing %s\n\0" -/* 2911 */ "%s(optionRestore): error: no saved option state\n\0" -/* 2960 */ "none\0" -/* 2965 */ "'%s' is not a command line option\n\0" -/* 3000 */ "%s error: `%s' is not a recognizable date/time\n\0" -/* 3049 */ "'%s' not defined\n\0" -/* 3067 */ "%s error: `%s' is not a recognizable time duration\n\0" -/* 3120 */ "ERROR: The %s option must appear %d times\n\0" -/* 3164 */ "error: cannot load options from non-regular file %s\n\0" -/* 3218 */ "%s error: `%s' is not a recognizable number\n\0" -/* 3264 */ " %3s %s\0" -/* 3272 */ "The '-#' option may omit the hash char\n\0" -/* 3320 */ "one %s%s option allowed\n\0" -/* 3345 */ "All arguments are named options.\n\0" -/* 3379 */ "Write failure to output file\0" -/* 3408 */ " - reading file %s\0" -/* 3427 */ "\n" - "please send bug reports to: %s\n\0" -/* 3461 */ "\t\t\t\t- may NOT appear - preset only\n\0" -/* 3497 */ "# preset/initialization file\n" - "# %s#\n\0" -/* 3535 */ "\n" +/* 2883 */ " or an integer mask with any of the lower %d bits set\n\0" +/* 2939 */ "\t\t\t\t- is a set membership option\n\0" +/* 2973 */ "\t\t\t\t- must appear between %d and %d times\n\0" +/* 3016 */ "Options are specified by single or double hyphens and their name.\n\0" +/* 3083 */ "\t\t\t\t- may appear multiple times\n\0" +/* 3116 */ "\t\t\t\t- may not be preset\n\0" +/* 3141 */ " Arg Option-Name Description\n\0" +/* 3176 */ " Flg Arg Option-Name Description\n\0" +/* 3214 */ " %3s %s\0" +/* 3222 */ "The '-#' option may omit the hash char\n\0" +/* 3270 */ "All arguments are named options.\n\0" +/* 3304 */ " - reading file %s\0" +/* 3323 */ "\n" + "please send bug reports to: <%s>\n\0" +/* 3359 */ "\t\t\t\t- may NOT appear - preset only\n\0" +/* 3395 */ "\n" "The following option preset mechanisms are supported:\n\0" -/* 3591 */ "prohibits these options:\n\0" -/* 3617 */ "%s%ld to %ld\0" -/* 3630 */ "%sgreater than or equal to %ld\0" -/* 3661 */ "%s error: %s option value %ld is out of range.\n\0" -/* 3710 */ "%s%ld exactly\0" -/* 3724 */ "%sIt must lie in one of the ranges:\n\0" -/* 3761 */ "%sIt must be in the range:\n\0" -/* 3789 */ ", or\n\0" -/* 3795 */ "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n\0" -/* 3841 */ "%sless than or equal to %ld\0" -/* 3869 */ "Operands and options may be intermixed. They will be reordered.\n\0" -/* 3935 */ "ERROR: %s option requires the %s option\n\0" -/* 3977 */ " %3s %-14s %s\0" -/* 3991 */ "requires these options:\n\0" -/* 4016 */ " Arg Option-Name Req? Description\n\0" -/* 4056 */ " Flg Arg Option-Name Req? Description\n\0" -/* 4099 */ "The --reset-option has not been configured.\n\0" -/* 4144 */ "-_^\0" -/* 4148 */ "or you may use a numeric representation. Preceding these with a '!' will\n" - "clear the bits, specifying 'none' will clear all bits, and 'all' will set them\n" - "all. Multiple entries may be passed as an option argument list.\n\0" -/* 4367 */ "%s\0" -/* 4370 */ " \0" -/* 4377 */ "T/F\0" -/* 4381 */ "\n" - "%s\n\n" - "%s\0" -/* 4389 */ "Fil\0" -/* 4393 */ "KWd\0" -/* 4397 */ "Mbr\0" -/* 4401 */ "Cpx\0" -/* 4405 */ "no \0" -/* 4409 */ "Num\0" -/* 4413 */ "opt\0" -/* 4417 */ "YES\0" -/* 4421 */ "Str\0" -/* 4425 */ "Tim\0" -/* 4429 */ "\t\t\t\t- \0" -/* 4436 */ "\t\t\t\t-- and \0" -/* 4448 */ "\t\t\t\t%s\n\0" -/* 4456 */ " \0" -/* 4460 */ "%s error: %s exceeds %s keyword count\n\0" -/* 4500 */ " \0" -/* 4503 */ "\t\t\t\t- may appear up to %d times\n\0" -/* 4536 */ "The valid \"%s\" option keywords are:\n\0" -/* 4573 */ "The next option supports vendor supported extra options:\0" -/* 4630 */ "These additional options are:"; +/* 3451 */ "prohibits these options:\n\0" +/* 3477 */ "prohibits the option '%s'\n\0" +/* 3504 */ "%s%ld to %ld\0" +/* 3517 */ "%sgreater than or equal to %ld\0" +/* 3548 */ "%s%ld exactly\0" +/* 3562 */ "%sit must lie in one of the ranges:\n\0" +/* 3599 */ "%sit must be in the range:\n\0" +/* 3627 */ ", or\n\0" +/* 3633 */ "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n\0" +/* 3679 */ "%sless than or equal to %ld\0" +/* 3707 */ "Operands and options may be intermixed. They will be reordered.\n\0" +/* 3773 */ "requires the option '%s'\n\0" +/* 3799 */ "requires these options:\n\0" +/* 3824 */ " Arg Option-Name Req? Description\n\0" +/* 3864 */ " Flg Arg Option-Name Req? Description\n\0" +/* 3907 */ "or you may use a numeric representation. Preceding these with a '!'\n" + "will clear the bits, specifying 'none' will clear all bits, and 'all'\n" + "will set them all. Multiple entries may be passed as an option\n" + "argument list.\n\0" +/* 4126 */ "\t\t\t\t- may appear up to %d times\n\0" +/* 4159 */ "The valid \"%s\" option keywords are:\n\0" +/* 4196 */ "The next option supports vendor supported extra options:\0" +/* 4253 */ "These additional options are:"; /* * Now, define (and initialize) the structure that contains @@ -388,309 +308,350 @@ char const option_lib_text[4660] = * Aren't you glad you don't maintain this by hand? */ usage_text_t option_xlateable_txt = { - 98, - eng_zGnuBoolArg, eng_zGnuFileArg, eng_zGnuKeyArg, eng_zGnuKeyLArg, - eng_zGnuNumArg, eng_zGnuStrArg, eng_zGnuTimeArg, + 108, + eng_zGnuBoolArg, eng_zGnuKeyArg, eng_zGnuNumArg, eng_zGnuStrArg, { - option_lib_text + 0, option_lib_text + 27, option_lib_text + 79, - option_lib_text + 125, option_lib_text + 224, option_lib_text + 260, - option_lib_text + 310, option_lib_text + 343, option_lib_text + 434, - option_lib_text + 493, option_lib_text + 543, option_lib_text + 574, - option_lib_text + 623, option_lib_text + 655, option_lib_text + 707, - option_lib_text + 715, option_lib_text + 752, option_lib_text + 777, - option_lib_text + 819, option_lib_text + 859, option_lib_text + 996, - option_lib_text + 1044, option_lib_text + 1098, option_lib_text + 1111, - option_lib_text + 1119, option_lib_text + 1161, option_lib_text + 1185, - option_lib_text + 1240, option_lib_text + 1296, option_lib_text + 1309, - option_lib_text + 1323, option_lib_text + 1370, option_lib_text + 1421, - option_lib_text + 1455, option_lib_text + 1470, option_lib_text + 1493, - option_lib_text + 1519, option_lib_text + 1550, option_lib_text + 1564, - option_lib_text + 1669, option_lib_text + 1784, option_lib_text + 1835, - option_lib_text + 1864, option_lib_text + 2000, option_lib_text + 2026, - option_lib_text + 2052, option_lib_text + 2095, option_lib_text + 2131, - option_lib_text + 2182, option_lib_text + 2211, option_lib_text + 2301, - option_lib_text + 2339, option_lib_text + 2447, option_lib_text + 2482, - option_lib_text + 2523, option_lib_text + 2563, option_lib_text + 2590, - option_lib_text + 2657, option_lib_text + 2763, option_lib_text + 2811, - option_lib_text + 2846, option_lib_text + 2884, option_lib_text + 2911, - option_lib_text + 2960, option_lib_text + 2965, option_lib_text + 3000, - option_lib_text + 3049, option_lib_text + 3067, option_lib_text + 3120, - option_lib_text + 3164, option_lib_text + 3218, option_lib_text + 3320, - option_lib_text + 3379, option_lib_text + 3408, option_lib_text + 3427, - option_lib_text + 3535, option_lib_text + 3661, option_lib_text + 3724, - option_lib_text + 3761, option_lib_text + 3869, option_lib_text + 3935, - option_lib_text + 3991, option_lib_text + 4016, option_lib_text + 4056, - option_lib_text + 4099, option_lib_text + 4144, option_lib_text + 4148, - option_lib_text + 4460, option_lib_text + 4536, option_lib_text + 4573, - option_lib_text + 4630 + option_lib_text + 0, option_lib_text + 31, option_lib_text + 83, + option_lib_text + 129, option_lib_text + 228, option_lib_text + 264, + option_lib_text + 314, option_lib_text + 405, option_lib_text + 427, + option_lib_text + 484, option_lib_text + 519, option_lib_text + 564, + option_lib_text + 596, option_lib_text + 634, option_lib_text + 667, + option_lib_text + 716, option_lib_text + 748, option_lib_text + 800, + option_lib_text + 837, option_lib_text + 862, option_lib_text + 900, + option_lib_text + 918, option_lib_text + 1060, option_lib_text + 1107, + option_lib_text + 1146, option_lib_text + 1159, option_lib_text + 1185, + option_lib_text + 1211, option_lib_text + 1254, option_lib_text + 1290, + option_lib_text + 1335, option_lib_text + 1364, option_lib_text + 1407, + option_lib_text + 1489, option_lib_text + 1527, option_lib_text + 1573, + option_lib_text + 1618, option_lib_text + 1645, option_lib_text + 1694, + option_lib_text + 1743, option_lib_text + 1770, option_lib_text + 1803, + option_lib_text + 1839, option_lib_text + 1889, option_lib_text + 1907, + option_lib_text + 1961, option_lib_text + 2008, option_lib_text + 2055, + option_lib_text + 2095, option_lib_text + 2130, option_lib_text + 2155, + option_lib_text + 2171, option_lib_text + 2186, option_lib_text + 2192, + option_lib_text + 2241, option_lib_text + 2286, option_lib_text + 2342, + option_lib_text + 2371, option_lib_text + 2413, option_lib_text + 2455, + option_lib_text + 2481, option_lib_text + 2496, option_lib_text + 2526, + option_lib_text + 2552, option_lib_text + 2569, option_lib_text + 2616, + option_lib_text + 2647, option_lib_text + 2674, option_lib_text + 2777, + option_lib_text + 2883, option_lib_text + 2939, option_lib_text + 2973, + option_lib_text + 3016, option_lib_text + 3083, option_lib_text + 3116, + option_lib_text + 3141, option_lib_text + 3176, option_lib_text + 3214, + option_lib_text + 3222, option_lib_text + 3270, option_lib_text + 3304, + option_lib_text + 3323, option_lib_text + 3359, option_lib_text + 3395, + option_lib_text + 3451, option_lib_text + 3477, option_lib_text + 3504, + option_lib_text + 3517, option_lib_text + 3548, option_lib_text + 3562, + option_lib_text + 3599, option_lib_text + 3627, option_lib_text + 3633, + option_lib_text + 3679, option_lib_text + 3707, option_lib_text + 3773, + option_lib_text + 3799, option_lib_text + 3824, option_lib_text + 3864, + option_lib_text + 3907, option_lib_text + 4126, option_lib_text + 4159, + option_lib_text + 4196, option_lib_text + 4253 } }; #endif /* AUTOOPTS_INTERNAL */ #ifdef XGETTEXT_SCAN_DO_NOT_COMPILE do not compile this section. -/* TRANSLATORS: The following dummy function was crated solely so that +/* TRANSLATORS: The following dummy functions were crated solely so that * xgettext can extract the correct strings. These strings are actually - * referenced where the preceding "#line" directive states, though you - * will not see the literal string there. The literal string is defined - * above and referenced via a #define name that redirects into the - * "option_xlateable_txt" structure above. + * referenced where the preceding "#line" directive states, though you will + * not see the literal string there. The literal string is defined above in + * the @code{option_lib_text} table and referenced via a #define name that + * redirects into the @code{option_xlateable_txt} structure above. When + * translating is activated, the pointers in @code{option_xlateable_txt} are + * updated to point to translated strings. */ static void dummy_func(void) { -#line 51 "../autoopts.c" - puts(_("malloc of %d bytes failed\n")); -#line 52 "../init.c" + /* LIBOPTS-MESSAGES: */ +#line 60 "../autoopts.c" + puts(_("allocation of %d bytes failed\n")); +#line 86 "../autoopts.c" + puts(_("allocation of %d bytes failed\n")); +#line 53 "../init.c" puts(_("AutoOpts function called without option descriptor\n")); -#line 85 "../init.c" +#line 89 "../init.c" puts(_("\tThis exceeds the compiled library version: ")); -#line 83 "../init.c" +#line 87 "../init.c" puts(_("Automated Options Processing Error!\n" "\t%s called AutoOpts function with structure version %d:%d:%d.\n")); -#line 64 "../autoopts.c" +#line 73 "../autoopts.c" puts(_("realloc of %d bytes at 0x%p failed\n")); -#line 87 "../init.c" +#line 91 "../init.c" puts(_("\tThis is less than the minimum library version: ")); -#line 77 "../autoopts.c" - puts(_("strdup of %d byte string failed\n")); -#line 120 "../version.c" +#line 121 "../version.c" puts(_("Automated Options version %s\n" "\tCopyright (C) 1999-2013 by Bruce Korb - all rights reserved\n")); -#line 585 "../find.c" - puts(_("AutoOpts lib error: defaulted to option with optional arg\n")); -#line 53 "../alias.c" - puts(_("(AutoOpts bug): Aliasing option is out of range.")); -#line 486 "../enum.c" - puts(_("all")); -#line 228 "../enum.c" - puts(_("%s error: the keyword `%s' is ambiguous for %s\n")); -#line 104 "../find.c" +#line 310 "../usage.c" + puts(_("(AutoOpts bug): %s.\n")); +#line 90 "../reset.c" + puts(_("optionResetOpt() called, but reset-option not configured")); +#line 329 "../usage.c" + puts(_("could not locate the 'help' option")); +#line 351 "../autoopts.c" + puts(_("optionProcess() was called with invalid data")); +#line 770 "../usage.c" + puts(_("invalid argument type specified")); +#line 589 "../find.c" + puts(_("defaulted to option with optional arg")); +#line 76 "../alias.c" + puts(_("aliasing option is out of range.")); +#line 229 "../enum.c" + puts(_("%s error: the keyword '%s' is ambiguous for %s\n")); +#line 108 "../find.c" puts(_(" The following options match:\n")); -#line 286 "../find.c" +#line 290 "../find.c" puts(_("%s: ambiguous option name: %s (matches %d options)\n")); -#line 107 "../find.c" - puts(_(" %s%s\n")); -#line 112 "../find.c" - puts(_(" %s%s\n")); -#line 157 "../check.c" +#line 161 "../check.c" puts(_("%s: Command line arguments required\n")); -#line 78 "../alias.c" - puts(_("%d %s%s options allowed\n")); -#line 215 "../autoopts.c" +#line 43 "../alias.c" puts(_("%d %s%s options allowed\n")); -#line 872 "../usage.c" - puts(_("version, usage and configuration options:")); -#line 266 "../makeshell.c" - puts(_("Error %d (%s) from the pipe(2) syscall\n")); -#line 160 "../version.c" - puts(_("ERROR: version option argument '%c' invalid. Use:\n" +#line 81 "../makeshell.c" + puts(_("%s error %d (%s) calling %s for '%s'\n")); +#line 293 "../makeshell.c" + puts(_("interprocess pipe")); +#line 168 "../version.c" + puts(_("error: version option argument '%c' invalid. Use:\n" "\t'v' - version only\n" "\t'c' - version and copyright\n" - "\t'n' - version and copyright notice\n")); -#line 56 "../check.c" - puts(_("ERROR: %s option conflicts with the %s option\n")); -#line 108 "../restore.c" - puts(_("%s(optionSaveState): error: cannot allocate %d bytes\n")); -#line 593 "../configfile.c" - puts(_("auto-options")); -#line 592 "../configfile.c" - puts(_("program")); -#line 674 "../configfile.c" - puts(_("program")); -#line 679 "../configfile.c" - puts(_("program")); -#line 654 "../usage.c" - puts(_("\t\t\t\t- default option for unnamed options\n")); -#line 569 "../usage.c" - puts(_("\t\t\t\t- disabled as --%s\n")); -#line 210 "../find.c" - puts(_("%s: The ``%s'' option has been disabled")); -#line 417 "../find.c" - puts(_("%s: The ``%s'' option has been disabled")); -#line 839 "../usage.c" - puts(_("This option has been disabled")); -#line 73 "../alias.c" + "\t'n' - version and full copyright notice\n")); +#line 58 "../check.c" + puts(_("%s error: the '%s' and '%s' options conflict\n")); +#line 214 "../find.c" + puts(_("%s: The '%s' option has been disabled.")); +#line 421 "../find.c" + puts(_("%s: The '%s' option has been disabled.")); +#line 38 "../alias.c" puts(_("-equivalence")); -#line 210 "../autoopts.c" - puts(_("-equivalence")); -#line 75 "../alias.c" - puts(_("ERROR: only ")); -#line 212 "../autoopts.c" - puts(_("ERROR: only ")); -#line 916 "../usage.c" - puts(_(" - examining environment variables named %s_*\n")); -#line 1170 "../configfile.c" - puts(_("File error %d (%s) opening %s for loading options\n")); -#line 98 "../text_mmap.c" - puts(_("fs error %d (%s) reading file %s\n")); -#line 135 "../file.c" - puts(_("fopen-ing file")); -#line 74 "../file.c" - puts(_("stat-ing for directory")); -#line 86 "../file.c" - puts(_("stat-ing for regular file")); -#line 48 "../file.c" - puts(_("stat-ing for non-existant file")); -#line 108 "../file.c" - puts(_("open-ing file")); -#line 47 "../file.c" - puts(_("fs error %d (%s) on %s %s for option %s\n")); -#line 73 "../file.c" - puts(_("fs error %d (%s) on %s %s for option %s\n")); -#line 85 "../file.c" - puts(_("fs error %d (%s) on %s %s for option %s\n")); -#line 107 "../file.c" - puts(_("fs error %d (%s) on %s %s for option %s\n")); -#line 134 "../file.c" - puts(_("fs error %d (%s) on %s %s for option %s\n")); -#line 273 "../usage.c" - puts(_("Options are specified by doubled hyphens and their name or by a single\n" - "hyphen and the flag character.\n")); -#line 272 "../makeshell.c" - puts(_("fs error %d (%s) on fork - cannot obtain %s usage\n")); -#line 802 "../makeshell.c" - puts(_("fs error %d (%s) on freopen\n")); -#line 880 "../makeshell.c" - puts(_("\n" - "= = = = = = = =\n\n" - "This incarnation of genshell will produce\n" - "a shell script to parse the options for %s:\n\n")); -#line 456 "../find.c" +#line 460 "../find.c" puts(_("%s: illegal option -- %c\n")); -#line 106 "../reset.c" +#line 110 "../reset.c" puts(_("%s: illegal option -- %c\n")); -#line 264 "../find.c" +#line 268 "../find.c" puts(_("%s: illegal option -- %s\n")); -#line 758 "../find.c" +#line 746 "../find.c" puts(_("%s: illegal option -- %s\n")); -#line 114 "../reset.c" +#line 118 "../reset.c" puts(_("%s: illegal option -- %s\n")); -#line 328 "../find.c" +#line 332 "../find.c" puts(_("%s: unknown vendor extension option -- %s\n")); -#line 153 "../enum.c" +#line 154 "../enum.c" puts(_(" or an integer from %d through %d\n")); -#line 163 "../enum.c" +#line 164 "../enum.c" puts(_(" or an integer from %d through %d\n")); -#line 484 "../usage.c" - puts(_("AutoOpts ERROR: invalid option descriptor for %s\n")); -#line 805 "../usage.c" - puts(_("AutoOpts ERROR: invalid option descriptor for %s\n")); -#line 375 "../find.c" +#line 769 "../usage.c" + puts(_("%s error: invalid option descriptor for %s\n")); +#line 1097 "../usage.c" + puts(_("%s error: invalid option descriptor for %s\n")); +#line 379 "../find.c" puts(_("%s: invalid option name: %s\n")); -#line 160 "../enum.c" - puts(_(" or an integer mask with any of the lower %d bits set\n")); -#line 514 "../find.c" - puts(_("%s: option `%s' requires an argument\n")); -#line 162 "../autoopts.c" - puts(_("Equivalenced option '%s' was equivalenced to both\n" +#line 518 "../find.c" + puts(_("%s: The '%s' option requires an argument.\n")); +#line 171 "../autoopts.c" + puts(_("(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n" "\t'%s' and '%s'")); -#line 90 "../check.c" - puts(_("ERROR: The %s option is required\n")); -#line 620 "../find.c" - puts(_("%s: option `%s' cannot have an argument\n")); -#line 147 "../check.c" - puts(_("%s: Command line arguments not allowed\n")); -#line 510 "../save.c" +#line 94 "../check.c" + puts(_("%s error: The %s option is required\n")); +#line 623 "../find.c" + puts(_("%s: The '%s' option cannot have an argument.\n")); +#line 151 "../check.c" + puts(_("%s: Command line arguments are not allowed.\n")); +#line 531 "../save.c" puts(_("error %d (%s) creating %s\n")); -#line 275 "../usage.c" - puts(_("Options are specified by single or double hyphens and their name.\n")); -#line 228 "../enum.c" - puts(_("%s error: `%s' does not match any %s keywords\n")); -#line 89 "../reset.c" - puts(_("The 'reset-option' option requires an argument\n")); -#line 1031 "../usage.c" - puts(_(" Arg Option-Name Description\n")); -#line 967 "../usage.c" - puts(_(" Flg Arg Option-Name Description\n")); -#line 1025 "../usage.c" - puts(_(" Flg Arg Option-Name Description\n")); -#line 177 "../save.c" +#line 229 "../enum.c" + puts(_("%s error: '%s' does not match any %s keywords.\n")); +#line 93 "../reset.c" + puts(_("%s error: The '%s' option requires an argument.\n")); +#line 184 "../save.c" puts(_("error %d (%s) stat-ing %s\n")); -#line 231 "../save.c" +#line 238 "../save.c" puts(_("error %d (%s) stat-ing %s\n")); -#line 149 "../restore.c" - puts(_("%s(optionRestore): error: no saved option state\n")); -#line 491 "../enum.c" - puts(_("none")); -#line 252 "../autoopts.c" - puts(_("'%s' is not a command line option\n")); -#line 110 "../time.c" - puts(_("%s error: `%s' is not a recognizable date/time\n")); -#line 126 "../save.c" +#line 143 "../restore.c" + puts(_("%s error: no saved option state\n")); +#line 246 "../autoopts.c" + puts(_("'%s' is not a command line option.\n")); +#line 114 "../time.c" + puts(_("%s error: '%s' is not a recognizable date/time.\n")); +#line 132 "../save.c" puts(_("'%s' not defined\n")); -#line 49 "../time.c" - puts(_("%s error: `%s' is not a recognizable time duration\n")); -#line 89 "../check.c" - puts(_("ERROR: The %s option must appear %d times\n")); -#line 1180 "../configfile.c" - puts(_("error: cannot load options from non-regular file %s\n")); -#line 727 "../makeshell.c" - puts(_("error: cannot load options from non-regular file %s\n")); -#line 250 "../save.c" - puts(_("error: cannot load options from non-regular file %s\n")); -#line 149 "../numeric.c" - puts(_("%s error: `%s' is not a recognizable number\n")); -#line 80 "../alias.c" - puts(_("one %s%s option allowed\n")); -#line 217 "../autoopts.c" +#line 53 "../time.c" + puts(_("%s error: '%s' is not a recognizable time duration.\n")); +#line 92 "../check.c" + puts(_("%s error: The %s option must appear %d times\n")); +#line 157 "../numeric.c" + puts(_("%s error: '%s' is not a recognizable number.\n")); +#line 195 "../enum.c" + puts(_("%s error: %s exceeds %s keyword count\n")); +#line 366 "../usage.c" + puts(_("Try '%s %s' for more information.\n")); +#line 45 "../alias.c" puts(_("one %s%s option allowed\n")); -#line 177 "../makeshell.c" - puts(_("Write failure to output file")); -#line 902 "../makeshell.c" - puts(_("Write failure to output file")); -#line 232 "../usage.c" - puts(_("Write failure to output file")); -#line 307 "../usage.c" - puts(_("Write failure to output file")); -#line 166 "../version.c" - puts(_("Write failure to output file")); -#line 701 "../usage.c" +#line 195 "../makeshell.c" + puts(_("standard output")); +#line 930 "../makeshell.c" + puts(_("standard output")); +#line 304 "../usage.c" + puts(_("standard output")); +#line 451 "../usage.c" + puts(_("standard output")); +#line 647 "../usage.c" + puts(_("standard output")); +#line 175 "../version.c" + puts(_("standard output")); +#line 304 "../usage.c" + puts(_("standard error")); +#line 451 "../usage.c" + puts(_("standard error")); +#line 647 "../usage.c" + puts(_("standard error")); +#line 175 "../version.c" + puts(_("standard error")); +#line 195 "../makeshell.c" + puts(_("write")); +#line 930 "../makeshell.c" + puts(_("write")); +#line 303 "../usage.c" + puts(_("write")); +#line 450 "../usage.c" + puts(_("write")); +#line 646 "../usage.c" + puts(_("write")); +#line 174 "../version.c" + puts(_("write")); +#line 60 "../numeric.c" + puts(_("%s error: %s option value %ld is out of range.\n")); +#line 44 "../check.c" + puts(_("%s error: %s option requires the %s option\n")); +#line 131 "../save.c" + puts(_("%s warning: cannot save options - %s not regular file\n")); +#line 183 "../save.c" + puts(_("%s warning: cannot save options - %s not regular file\n")); +#line 237 "../save.c" + puts(_("%s warning: cannot save options - %s not regular file\n")); +#line 256 "../save.c" + puts(_("%s warning: cannot save options - %s not regular file\n")); +#line 530 "../save.c" + puts(_("%s warning: cannot save options - %s not regular file\n")); + /* END-LIBOPTS-MESSAGES */ + + /* USAGE-TEXT: */ +#line 895 "../usage.c" + puts(_("\t\t\t\t- an alternate for '%s'\n")); +#line 1164 "../usage.c" + puts(_("Version, usage and configuration options:")); +#line 946 "../usage.c" + puts(_("\t\t\t\t- default option for unnamed options\n")); +#line 859 "../usage.c" + puts(_("\t\t\t\t- disabled as '--%s'\n")); +#line 1133 "../usage.c" + puts(_(" --- %-14s %s\n")); +#line 1131 "../usage.c" + puts(_("This option has been disabled")); +#line 886 "../usage.c" + puts(_("\t\t\t\t- enabled by default\n")); +#line 40 "../alias.c" + puts(_("%s error: only ")); +#line 1208 "../usage.c" + puts(_(" - examining environment variables named %s_*\n")); +#line 168 "../file.c" + puts(_("\t\t\t\t- file must not pre-exist\n")); +#line 172 "../file.c" + puts(_("\t\t\t\t- file must pre-exist\n")); +#line 416 "../usage.c" + puts(_("Options are specified by doubled hyphens and their name or by a single\n" + "hyphen and the flag character.\n")); +#line 908 "../makeshell.c" + puts(_("\n" + "= = = = = = = =\n\n" + "This incarnation of genshell will produce\n" + "a shell script to parse the options for %s:\n\n")); +#line 161 "../enum.c" + puts(_(" or an integer mask with any of the lower %d bits set\n")); +#line 919 "../usage.c" + puts(_("\t\t\t\t- is a set membership option\n")); +#line 940 "../usage.c" + puts(_("\t\t\t\t- must appear between %d and %d times\n")); +#line 418 "../usage.c" + puts(_("Options are specified by single or double hyphens and their name.\n")); +#line 926 "../usage.c" + puts(_("\t\t\t\t- may appear multiple times\n")); +#line 913 "../usage.c" + puts(_("\t\t\t\t- may not be preset\n")); +#line 1323 "../usage.c" + puts(_(" Arg Option-Name Description\n")); +#line 1259 "../usage.c" + puts(_(" Flg Arg Option-Name Description\n")); +#line 1317 "../usage.c" + puts(_(" Flg Arg Option-Name Description\n")); +#line 1318 "../usage.c" + puts(_(" %3s %s")); +#line 1324 "../usage.c" + puts(_(" %3s %s")); +#line 423 "../usage.c" + puts(_("The '-#' option may omit the hash char\n")); +#line 419 "../usage.c" + puts(_("All arguments are named options.\n")); +#line 993 "../usage.c" puts(_(" - reading file %s")); -#line 302 "../usage.c" +#line 445 "../usage.c" puts(_("\n" - "please send bug reports to: %s\n")); -#line 104 "../version.c" + "please send bug reports to: <%s>\n")); +#line 100 "../version.c" puts(_("\n" - "please send bug reports to: %s\n")); -#line 126 "../version.c" + "please send bug reports to: <%s>\n")); +#line 129 "../version.c" puts(_("\n" - "please send bug reports to: %s\n")); -#line 673 "../usage.c" + "please send bug reports to: <%s>\n")); +#line 925 "../usage.c" + puts(_("\t\t\t\t- may NOT appear - preset only\n")); +#line 965 "../usage.c" puts(_("\n" "The following option preset mechanisms are supported:\n")); -#line 914 "../usage.c" +#line 1206 "../usage.c" puts(_("\n" "The following option preset mechanisms are supported:\n")); -#line 54 "../numeric.c" - puts(_("%s error: %s option value %ld is out of range.\n")); -#line 62 "../numeric.c" - puts(_("%sIt must lie in one of the ranges:\n")); -#line 62 "../numeric.c" - puts(_("%sIt must be in the range:\n")); -#line 283 "../usage.c" +#line 704 "../usage.c" + puts(_("prohibits these options:\n")); +#line 699 "../usage.c" + puts(_("prohibits the option '%s'\n")); +#line 81 "../numeric.c" + puts(_("%s%ld to %ld")); +#line 79 "../numeric.c" + puts(_("%sgreater than or equal to %ld")); +#line 75 "../numeric.c" + puts(_("%s%ld exactly")); +#line 68 "../numeric.c" + puts(_("%sit must lie in one of the ranges:\n")); +#line 68 "../numeric.c" + puts(_("%sit must be in the range:\n")); +#line 88 "../numeric.c" + puts(_(", or\n")); +#line 66 "../numeric.c" + puts(_("%sis scalable with a suffix: k/K/m/M/g/G/t/T\n")); +#line 77 "../numeric.c" + puts(_("%sless than or equal to %ld")); +#line 426 "../usage.c" puts(_("Operands and options may be intermixed. They will be reordered.\n")); -#line 43 "../check.c" - puts(_("ERROR: %s option requires the %s option\n")); -#line 401 "../usage.c" +#line 674 "../usage.c" + puts(_("requires the option '%s'\n")); +#line 677 "../usage.c" puts(_("requires these options:\n")); -#line 1043 "../usage.c" +#line 1335 "../usage.c" puts(_(" Arg Option-Name Req? Description\n")); -#line 1037 "../usage.c" +#line 1329 "../usage.c" puts(_(" Flg Arg Option-Name Req? Description\n")); -#line 84 "../reset.c" - puts(_("The --reset-option has not been configured.\n")); -#line 117 "../init.c" - puts(_("-_^")); -#line 161 "../enum.c" - puts(_("or you may use a numeric representation. Preceding these with a '!' will\n" - "clear the bits, specifying 'none' will clear all bits, and 'all' will set them\n" - "all. Multiple entries may be passed as an option argument list.\n")); -#line 194 "../enum.c" - puts(_("%s error: %s exceeds %s keyword count\n")); -#line 71 "../enum.c" +#line 162 "../enum.c" + puts(_("or you may use a numeric representation. Preceding these with a '!'\n" + "will clear the bits, specifying 'none' will clear all bits, and 'all'\n" + "will set them all. Multiple entries may be passed as an option\n" + "argument list.\n")); +#line 932 "../usage.c" + puts(_("\t\t\t\t- may appear up to %d times\n")); +#line 72 "../enum.c" puts(_("The valid \"%s\" option keywords are:\n")); -#line 876 "../usage.c" +#line 1168 "../usage.c" puts(_("The next option supports vendor supported extra options:")); -#line 512 "../usage.c" +#line 795 "../usage.c" puts(_("These additional options are:")); + /* END-USAGE-TEXT */ } #endif /* XGETTEXT_SCAN_DO_NOT_COMPILE */ #endif /* AUTOOPTS_USAGE_TXT_H_GUARD */ diff --git a/sntp/libopts/boolean.c b/sntp/libopts/boolean.c index cf3b116c37..e2dff14cdf 100644 --- a/sntp/libopts/boolean.c +++ b/sntp/libopts/boolean.c @@ -2,8 +2,12 @@ /** * \file boolean.c * - * Automated Options Paged Usage module. + * Handle options with true/false values for arguments. * + * @addtogroup autoopts + * @{ + */ +/* * This routine will run run-on options through a pager so the * user may examine, print or edit them at their leisure. * @@ -21,11 +25,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /*=export_func optionBooleanVal @@ -86,7 +90,8 @@ optionBooleanVal(tOptions * pOpts, tOptDesc * pOD ) } pOD->optArg.argBool = res; } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/check.c b/sntp/libopts/check.c index 9860df1eae..3196b00093 100644 --- a/sntp/libopts/check.c +++ b/sntp/libopts/check.c @@ -1,11 +1,12 @@ /** * @file check.c * - * @brief consistency checks. - * - * This file contains the routines that deal with processing quoted strings - * into an internal format. + * @brief option consistency checks. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -20,40 +21,42 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /** * Check for conflicts based on "must" and "cannot" attributes. */ static bool -has_conflict(tOptions * pOpts, tOptDesc * pOD) +has_conflict(tOptions * pOpts, tOptDesc * od) { - if (pOD->pOptMust != NULL) { - int const * pMust = pOD->pOptMust; + if (od->pOptMust != NULL) { + int const * must = od->pOptMust; - while (*pMust != NO_EQUIVALENT) { - tOptDesc * p = pOpts->pOptDesc + *(pMust++); + while (*must != NO_EQUIVALENT) { + tOptDesc * p = pOpts->pOptDesc + *(must++); if (UNUSED_OPT(p)) { - const tOptDesc * pN = pOpts->pOptDesc + pMust[-1]; - fprintf(stderr, zReqFmt, pOD->pz_Name, pN->pz_Name); + const tOptDesc * ood = pOpts->pOptDesc + must[-1]; + fprintf(stderr, zneed_fmt, pOpts->pzProgName, + od->pz_Name, ood->pz_Name); return true; } } } - if (pOD->pOptCant != NULL) { - int const * pCant = pOD->pOptCant; + if (od->pOptCant != NULL) { + int const * cant = od->pOptCant; - while (*pCant != NO_EQUIVALENT) { - tOptDesc * p = pOpts->pOptDesc + *(pCant++); + while (*cant != NO_EQUIVALENT) { + tOptDesc * p = pOpts->pOptDesc + *(cant++); if (SELECTED_OPT(p)) { - const tOptDesc* pN = pOpts->pOptDesc + pCant[-1]; - fprintf(stderr, zCantFmt, pOD->pz_Name, pN->pz_Name); + const tOptDesc * ood = pOpts->pOptDesc + cant[-1]; + fprintf(stderr, zconflict_fmt, pOpts->pzProgName, + od->pz_Name, ood->pz_Name); return true; } } @@ -86,8 +89,9 @@ occurs_enough(tOptions * pOpts, tOptDesc * pOD) return true; if (pOD->optMinCt > 1) - fprintf(stderr, zNotEnough, pOD->pz_Name, pOD->optMinCt); - else fprintf(stderr, zNeedOne, pOD->pz_Name); + fprintf(stderr, zneed_more, pOpts->pzProgName, pOD->pz_Name, + pOD->optMinCt); + else fprintf(stderr, zneed_one, pOpts->pzProgName, pOD->pz_Name); return false; } @@ -154,7 +158,7 @@ is_consistent(tOptions * pOpts) */ else if ((pOpts->fOptSet & OPTPROC_ARGS_REQ) != 0) { if (pOpts->origArgCt <= pOpts->curOptIdx) { - fprintf(stderr, zArgsMust, pOpts->pzProgName); + fprintf(stderr, zargs_must, pOpts->pzProgName); return false; } } @@ -162,3 +166,12 @@ is_consistent(tOptions * pOpts) return true; } + +/** @} + * + * Local Variables: + * mode: C + * c-file-style: "stroustrup" + * indent-tabs-mode: nil + * End: + * end of autoopts/check.c */ diff --git a/sntp/libopts/compat/compat.h b/sntp/libopts/compat/compat.h index 73ee3892ff..e7b30ea3ab 100644 --- a/sntp/libopts/compat/compat.h +++ b/sntp/libopts/compat/compat.h @@ -1,48 +1,30 @@ -/* -*- Mode: C -*- */ - -/** - * \file compat.h --- fake the preprocessor into handlng portability +/* -*- Mode: C -*- * * compat.h is free software. - * This file is part of AutoGen. + * This file is part of AutoGen and AutoOpts. * * AutoGen Copyright (C) 1992-2013 by Bruce Korb - all rights reserved * - * AutoGen is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * AutoGen is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . + * 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 + * of the user of the license. * - * As a special exception, Bruce Korb gives permission for additional - * uses of the text contained in the release of compat.h. + * The GNU Lesser General Public License, version 3 or later + * See the files "COPYING.lgplv3" and "COPYING.gplv3" * - * The exception is that, if you link the compat.h library with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the compat.h library code into it. + * The Modified Berkeley Software Distribution License + * See the file "COPYING.mbsd" * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. + * These files have the following sha256 sums: * - * This exception applies only to the code released by Bruce Korb under - * the name compat.h. If you copy code from other sources under the - * General Public License into a copy of compat.h, as the General Public - * License permits, the exception does not apply to the code that you add - * in this way. To avoid misleading anyone as to the status of such - * modified files, you must delete this exception notice from them. - * - * If you write modifications of your own for compat.h, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd + */ + +/** + * \file compat.h + * fake the preprocessor into handlng stuff portability */ #ifndef COMPAT_H_GUARD #define COMPAT_H_GUARD 1 diff --git a/sntp/libopts/compat/windows-config.h b/sntp/libopts/compat/windows-config.h index e21ba6ed05..194d2280eb 100644 --- a/sntp/libopts/compat/windows-config.h +++ b/sntp/libopts/compat/windows-config.h @@ -1,6 +1,6 @@ /** - * \file autoopts.c + * \file windows-config.h * * This file contains all of the routines that must be linked into * an executable to use the generated option processing. The optional @@ -21,11 +21,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ #ifndef WINDOWS_CONFIG_HACKERY @@ -41,64 +41,25 @@ #endif /* - * Miscellaneous functions that Microsoft maps - * to other names - * - * #define inline __inline - * #define vsnprintf _vsnprintf + * Miscellaneous functions that Microsoft maps to other names */ #define snprintf _snprintf -/* - * #define stricmp _stricmp - * #define strcasecmp _stricmp - * #define isascii __isascii - * #define finite _finite - * #define random rand - * #define srandom srand - */ #define SIZEOF_INT 4 #define SIZEOF_CHARP 4 #define SIZEOF_LONG 4 #define SIZEOF_SHORT 2 -typedef unsigned long uintptr_t; - -/* - * # define HAVE_NET_IF_H - * # define QSORT_USES_VOID_P - * # define HAVE_SETVBUF - * # define HAVE_VSPRINTF - * # define HAVE_SNPRINTF - * # define HAVE_VSNPRINTF - * # define HAVE_PROTOTYPES /* from ntpq.mak * / - * # define HAVE_MEMMOVE - * # define HAVE_TERMIOS_H - * # define HAVE_ERRNO_H - * # define HAVE_STDARG_H - * # define HAVE_NO_NICE - * # define HAVE_MKTIME - * # define TIME_WITH_SYS_TIME - * # define HAVE_IO_COMPLETION_PORT - * # define ISC_PLATFORM_NEEDNTOP - * # define ISC_PLATFORM_NEEDPTON - * # define NEED_S_CHAR_TYPEDEF - * # define USE_PROTOTYPES /* for ntp_types.h * / - * - * #define ULONG_CONST(a) a ## UL - */ - #define HAVE_LIMITS_H 1 #define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_FCNTL_H 1 /* - * VS.NET's version of wspiapi.h has a bug in it - * where it assigns a value to a variable inside - * an if statement. It should be comparing them. - * We prevent inclusion since we are not using this - * code so we don't have to see the warning messages + * VS.NET's version of wspiapi.h has a bug in it where it assigns a value + * to a variable inside an if statement. It should be comparing them. + * We prevent inclusion since we are not using this code so we don't have + * to see the warning messages */ #ifndef _WSPIAPI_H_ #define _WSPIAPI_H_ @@ -125,7 +86,7 @@ typedef unsigned long uintptr_t; #define strdup _strdup #define stat _stat /* struct stat from */ #define unlink _unlink -#define fchmod( _x, _y ); +#define fchmod( _x, _y ) #define ssize_t SSIZE_T #include @@ -151,4 +112,33 @@ typedef unsigned long uintptr_t; # define S_ISDIR(mode) (((mode) & S_IFDIR) == S_IFDIR) #endif +/* C99 exact size integer support. */ +#if defined(HAVE_INTTYPES_H) +# include + +#elif defined(HAVE_STDINT_H) +# include +# define MISSING_INTTYPES_H 1 + +#elif ! defined(ADDED_EXACT_SIZE_INTEGERS) +# define ADDED_EXACT_SIZE_INTEGERS 1 +# define MISSING_INTTYPES_H 1 + + typedef __int8 int8_t; + typedef unsigned __int8 uint8_t; + + typedef __int16 int16_t; + typedef unsigned __int16 uint16_t; + + typedef __int32 int32_t; + typedef unsigned __int32 uint32_t; + + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; + + typedef unsigned long uintptr_t; + typedef long intptr_t; +#endif + #endif /* WINDOWS_CONFIG_HACKERY */ +/* windows-config.h ends here */ diff --git a/sntp/libopts/configfile.c b/sntp/libopts/configfile.c index b08169e0f0..ab883f92e1 100644 --- a/sntp/libopts/configfile.c +++ b/sntp/libopts/configfile.c @@ -3,6 +3,10 @@ * * configuration/rc/ini file handling. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -17,11 +21,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /* = = = START-STATIC-FORWARD = = = */ @@ -1167,18 +1171,15 @@ optionLoadOpt(tOptions * opts, tOptDesc * odesc) if ((opts->fOptSet & OPTPROC_ERRSTOP) == 0) return; - fprintf(stderr, zFSErrOptLoad, errno, strerror(errno), - odesc->optArg.argString); - exit(EX_NOINPUT); + fserr_exit(opts->pzProgName, "stat", odesc->optArg.argString); /* NOT REACHED */ } if (! S_ISREG(sb.st_mode)) { if ((opts->fOptSet & OPTPROC_ERRSTOP) == 0) return; - - fprintf(stderr, zNotFile, odesc->optArg.argString); - exit(EX_NOINPUT); + errno = EINVAL; + fserr_exit(opts->pzProgName, "stat", odesc->optArg.argString); /* NOT REACHED */ } @@ -1351,7 +1352,8 @@ parse_value(char * txt, tOptionValue * typ) return txt + len; } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/cook.c b/sntp/libopts/cook.c index 98ce81ce20..7c08b87dd4 100644 --- a/sntp/libopts/cook.c +++ b/sntp/libopts/cook.c @@ -4,6 +4,10 @@ * This file contains the routines that deal with processing quoted strings * into an internal format. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -18,11 +22,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /* = = = START-STATIC-FORWARD = = = */ @@ -310,7 +314,9 @@ ao_string_cook(char * pzScan, int * lnct_p) } /* switch (*(pzD++) = *(pzS++)) */ } /* for (;;) */ } -/* + +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/enum.c b/sntp/libopts/enum.c index f1f70ea50a..6529083b0c 100644 --- a/sntp/libopts/enum.c +++ b/sntp/libopts/enum.c @@ -2,8 +2,13 @@ /** * \file enumeration.c * - * Automated Options Paged Usage module. + * Handle options with enumeration names and bit mask bit names + * for their arguments. * + * @addtogroup autoopts + * @{ + */ +/* * This routine will run run-on options through a pager so the * user may examine, print or edit them at their leisure. * @@ -21,11 +26,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ static char const * pz_enum_err_fmt; @@ -36,13 +41,9 @@ enum_err(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, int name_ct); static uintptr_t -find_name(char const * pzName, tOptions * pOpts, tOptDesc * pOD, +find_name(char const * name, tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, unsigned int name_ct); -static void -set_memb_usage(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, - unsigned int name_ct); - static void set_memb_shell(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, unsigned int name_ct); @@ -168,14 +169,14 @@ enum_err(tOptions * pOpts, tOptDesc * pOD, * Convert a name or number into a binary number. * "~0" and "-1" will be converted to the largest value in the enumeration. * - * @param pzName the keyword name (number) to convert + * @param name the keyword name (number) to convert * @param pOpts the program's option descriptor * @param pOD the option descriptor for this option * @param paz_names the list of keywords for this option * @param name_ct the count of keywords */ static uintptr_t -find_name(char const * pzName, tOptions * pOpts, tOptDesc * pOD, +find_name(char const * name, tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, unsigned int name_ct) { /* @@ -183,23 +184,23 @@ find_name(char const * pzName, tOptions * pOpts, tOptDesc * pOD, * The result gets stashed in a char* pointer. */ uintptr_t res = name_ct; - size_t len = strlen((char*)pzName); + size_t len = strlen((char*)name); uintptr_t idx; - if (IS_DEC_DIGIT_CHAR(*pzName)) { - char * pz = (char *)(void *)pzName; + if (IS_DEC_DIGIT_CHAR(*name)) { + char * pz = (char *)(void *)name; unsigned long val = strtoul(pz, &pz, 0); if ((*pz == NUL) && (val < name_ct)) return (uintptr_t)val; - pz_enum_err_fmt = zTooLarge; + pz_enum_err_fmt = znum_too_large; option_usage_fp = stderr; enum_err(pOpts, pOD, paz_names, (int)name_ct); return name_ct; } - if (IS_INVERSION_CHAR(*pzName) && (pzName[2] == NUL)) { - if ( ((pzName[0] == '~') && (pzName[1] == '0')) - || ((pzName[0] == '-') && (pzName[1] == '1'))) + if (IS_INVERSION_CHAR(*name) && (name[2] == NUL)) { + if ( ((name[0] == '~') && (name[1] == '0')) + || ((name[0] == '-') && (name[1] == '1'))) return (uintptr_t)(name_ct - 1); goto oops; } @@ -209,7 +210,7 @@ find_name(char const * pzName, tOptions * pOpts, tOptDesc * pOD, * Multiple partial matches means we have an ambiguous match. */ for (idx = 0; idx < name_ct; idx++) { - if (strncmp((char*)paz_names[idx], (char*)pzName, len) == 0) { + if (strncmp((char*)paz_names[idx], (char*)name, len) == 0) { if (paz_names[idx][len] == NUL) return idx; /* full match */ @@ -225,7 +226,7 @@ find_name(char const * pzName, tOptions * pOpts, tOptDesc * pOD, oops: - pz_enum_err_fmt = (res == name_ct) ? zNoKey : zAmbigKey; + pz_enum_err_fmt = (res == name_ct) ? zNoKey : zambiguous_key; option_usage_fp = stderr; enum_err(pOpts, pOD, paz_names, (int)name_ct); return name_ct; @@ -334,17 +335,6 @@ optionEnumerationVal(tOptions * pOpts, tOptDesc * pOD, return res; } -static void -set_memb_usage(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, - unsigned int name_ct) -{ - /* - * print the list of enumeration names. - */ - (void)pOpts; - enum_err(OPTPROC_EMIT_USAGE, pOD, paz_names, (int)name_ct ); -} - static void set_memb_shell(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names, unsigned int name_ct) @@ -444,7 +434,7 @@ optionSetMembers(tOptions * pOpts, tOptDesc * pOD, */ switch ((uintptr_t)pOpts) { case (uintptr_t)OPTPROC_EMIT_USAGE: - set_memb_usage(pOpts, pOD, paz_names, name_ct); + enum_err(OPTPROC_EMIT_USAGE, pOD, paz_names, name_ct); return; case (uintptr_t)OPTPROC_EMIT_SHELL: @@ -536,10 +526,11 @@ optionSetMembers(tOptions * pOpts, tOptDesc * pOD, } } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" * indent-tabs-mode: nil * End: - * end of autoopts/enumeration.c */ + * end of autoopts/enum.c */ diff --git a/sntp/libopts/env.c b/sntp/libopts/env.c index 3167a15005..dacb55121c 100644 --- a/sntp/libopts/env.c +++ b/sntp/libopts/env.c @@ -7,6 +7,10 @@ * routines are in separately compiled modules so that they will not * necessarily be linked in. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -21,11 +25,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /* = = = START-STATIC-FORWARD = = = */ @@ -253,7 +257,8 @@ env_presets(tOptions * pOpts, teEnvPresetType type) } } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/file.c b/sntp/libopts/file.c index a14ca315df..9218b5f43a 100644 --- a/sntp/libopts/file.c +++ b/sntp/libopts/file.c @@ -2,6 +2,12 @@ /** * \file file.c * + * Handle options that have file names for arguments. + * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -16,11 +22,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /** @@ -44,9 +50,7 @@ check_existence(teOptFileType ftype, tOptions * pOpts, tOptDesc * pOD) if ((stat(fname, &sb) == 0) || (errno != ENOENT)) { if (errno == 0) errno = EINVAL; - fprintf(stderr, zFSOptError, errno, strerror(errno), - zFSOptErrNoExist, fname, pOD->pz_Name); - pOpts->pUsageProc(pOpts, EXIT_FAILURE); + fserr_exit(pOpts->pzProgName, "stat", fname); /* NOTREACHED */ } /* FALLTHROUGH */ @@ -69,25 +73,20 @@ check_existence(teOptFileType ftype, tOptions * pOpts, tOptDesc * pOD) memcpy(p, fname, l); p[l] = NUL; - if ((stat(p, &sb) != 0) || (errno = EINVAL, ! S_ISDIR(sb.st_mode))) { - fprintf(stderr, zFSOptError, errno, strerror(errno), - zFSOptErrMayExist, fname, pOD->pz_Name); - pOpts->pUsageProc(pOpts, EXIT_FAILURE); + if ((stat(p, &sb) != 0) || (errno = EINVAL, ! S_ISDIR(sb.st_mode))) + fserr_exit(pOpts->pzProgName, "stat", p); /* NOTREACHED */ - } + AGFREE(p); break; } case FTYPE_MODE_MUST_EXIST: if ( (stat(fname, &sb) != 0) - || (errno = EINVAL, ! S_ISREG(sb.st_mode)) ) { - fprintf(stderr, zFSOptError, errno, strerror(errno), - zFSOptErrMustExist, fname, - pOD->pz_Name); - pOpts->pUsageProc(pOpts, EXIT_FAILURE); + || (errno = EINVAL, ! S_ISREG(sb.st_mode)) ) + fserr_exit(pOpts->pzProgName, "stat", fname); /* NOTREACHED */ - } + break; } } @@ -103,12 +102,9 @@ static void open_file_fd(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode) { int fd = open(pOD->optArg.argString, mode.file_flags); - if (fd < 0) { - fprintf(stderr, zFSOptError, errno, strerror(errno), - zFSOptErrOpen, pOD->optArg.argString, pOD->pz_Name); - pOpts->pUsageProc(pOpts, EXIT_FAILURE); + if (fd < 0) + fserr_exit(pOpts->pzProgName, "open", pOD->optArg.argString); /* NOTREACHED */ - } if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0) pOD->optCookie = (void *)pOD->optArg.argString; @@ -129,13 +125,10 @@ open_file_fd(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode) static void fopen_file_fp(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode) { - FILE* fp = fopen(pOD->optArg.argString, mode.file_mode); - if (fp == NULL) { - fprintf(stderr, zFSOptError, errno, strerror(errno), - zFSOptErrFopen, pOD->optArg.argString, pOD->pz_Name); - pOpts->pUsageProc(pOpts, EXIT_FAILURE); + FILE * fp = fopen(pOD->optArg.argString, mode.file_mode); + if (fp == NULL) + fserr_exit(pOpts->pzProgName, "fopen", pOD->optArg.argString); /* NOTREACHED */ - } if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0) pOD->optCookie = (void *)pOD->optArg.argString; @@ -172,11 +165,11 @@ optionFileCheck(tOptions * pOpts, tOptDesc * pOD, switch (ftype & FTYPE_MODE_EXIST_MASK) { case FTYPE_MODE_MUST_NOT_EXIST: - fputs(zFileCannotExist, option_usage_fp); + fputs(zFileCannotExist + tab_skip_ct, option_usage_fp); break; case FTYPE_MODE_MUST_EXIST: - fputs(zFileMustExist, option_usage_fp); + fputs(zFileMustExist + tab_skip_ct, option_usage_fp); break; } return; @@ -197,7 +190,9 @@ optionFileCheck(tOptions * pOpts, tOptDesc * pOD, case FTYPE_MODE_FOPEN_FP: fopen_file_fp(pOpts, pOD, mode); break; } } -/* + +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/find.c b/sntp/libopts/find.c index 4d70bf8cd2..e3534291d1 100644 --- a/sntp/libopts/find.c +++ b/sntp/libopts/find.c @@ -6,6 +6,10 @@ * This file contains the routines that deal with processing quoted strings * into an internal format. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -20,11 +24,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /* = = = START-STATIC-FORWARD = = = */ @@ -101,15 +105,15 @@ opt_ambiguities(tOptions * opts, char const * name, int nm_len) tOptDesc * pOD = opts->pOptDesc; int idx = 0; - fputs(zAmbigList, stderr); + fputs(zambig_list_msg, stderr); do { if (strneqvcmp(name, pOD->pz_Name, nm_len) == 0) - fprintf(stderr, zAmbiguous, hyph, pOD->pz_Name); + fprintf(stderr, zambig_file, hyph, pOD->pz_Name); else if ( (pOD->pz_DisableName != NULL) && (strneqvcmp(name, pOD->pz_DisableName, nm_len) == 0) ) - fprintf(stderr, zAmbiguous, hyph, pOD->pz_DisableName); + fprintf(stderr, zambig_file, hyph, pOD->pz_DisableName); } while (pOD++, (++idx < opts->optCt)); } @@ -283,7 +287,7 @@ static tSuccess opt_ambiguous(tOptions * opts, char const * name, int match_ct) { if ((opts->fOptSet & OPTPROC_ERRSTOP) != 0) { - fprintf(stderr, zAmbigOptStr, opts->pzProgPath, name, match_ct); + fprintf(stderr, zambig_opt_fmt, opts->pzProgPath, name, match_ct); if (match_ct <= 4) opt_ambiguities(opts, name, (int)strlen(name)); (*opts->pUsageProc)(opts, EXIT_FAILURE); @@ -582,8 +586,7 @@ get_opt_arg_may(tOptions * pOpts, tOptState * o_st) default: case TOPT_DEFAULT: - fputs(zAO_Woops, stderr ); - exit(EX_SOFTWARE); + ao_bug(zbad_default_msg); } /* @@ -642,33 +645,18 @@ get_opt_arg(tOptions * opts, tOptState * o_st) o_st->flags |= (o_st->pOD->fOptState & OPTST_PERSISTENT_MASK); /* - * Figure out what to do about option arguments. An argument may be - * required, not associated with the option, or be optional. We detect the - * latter by examining for an option marker on the next possible argument. - * Disabled mode option selection also disables option arguments. + * Disabled options and options specified to not have arguments + * are handled with the "none" procedure. Otherwise, check the + * optional flag and call either the "may" or "must" function. */ - { - enum { ARG_NONE, ARG_MAY, ARG_MUST } arg_type = ARG_NONE; - - if ((o_st->flags & OPTST_DISABLED) != 0) - arg_type = ARG_NONE; - - else if (OPTST_GET_ARGTYPE(o_st->flags) == OPARG_TYPE_NONE) - arg_type = ARG_NONE; - - else if (o_st->flags & OPTST_ARG_OPTIONAL) - arg_type = ARG_MAY; - - else - arg_type = ARG_MUST; - - switch (arg_type) { - case ARG_MUST: return get_opt_arg_must(opts, o_st); - case ARG_MAY: return get_opt_arg_may( opts, o_st); - case ARG_NONE: return get_opt_arg_none(opts, o_st); - default: exit(EX_SOFTWARE); - } - } + if ( ((o_st->flags & OPTST_DISABLED) != 0) + || (OPTST_GET_ARGTYPE(o_st->flags) == OPARG_TYPE_NONE)) + return get_opt_arg_none(opts, o_st); + + if (o_st->flags & OPTST_ARG_OPTIONAL) + return get_opt_arg_may( opts, o_st); + + return get_opt_arg_must(opts, o_st); } /** @@ -773,7 +761,8 @@ find_opt(tOptions * opts, tOptState * o_st) return opt_find_long(opts, opts->pzCurOpt, o_st); } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/genshell.c b/sntp/libopts/genshell.c index 9e81af0905..3bbe837faa 100644 --- a/sntp/libopts/genshell.c +++ b/sntp/libopts/genshell.c @@ -1,12 +1,12 @@ /* -*- buffer-read-only: t -*- vi: set ro: - * + * * DO NOT EDIT THIS FILE (genshell.c) - * - * It has been AutoGen-ed January 4, 2013 at 04:15:46 PM by AutoGen 5.17.1pre14 + * + * It has been AutoGen-ed February 21, 2013 at 12:28:33 PM by AutoGen 5.17.2pre16 * From the definitions genshell.def * and the template file options * - * Generated from AutoOpts 37:1:12 templates. + * Generated from AutoOpts 38:0:13 templates. * * AutoOpts is a copyrighted work. This source file is not encumbered * by AutoOpts licensing, but is provided under the licensing terms chosen @@ -21,22 +21,21 @@ * * Copyright (C) 1999-2012 Bruce Korb, all rights reserved. * This is free software. It is licensed for use, modification and - * redistribution under the terms of the - * GNU General Public License, version 3 or later - * + * redistribution under the terms of the GNU Lesser General Public License, + * version 3 or later * * genshellopt is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * genshellopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see ."; */ #ifndef __doxygen__ @@ -52,11 +51,8 @@ extern "C" { #endif extern FILE * option_usage_fp; - -/* TRANSLATORS: choose the translation for option names wisely because you - cannot ever change your mind. */ #define zCopyright (genshellopt_opt_strs+0) -#define zLicenseDescrip (genshellopt_opt_strs+260) +#define zLicenseDescrip (genshellopt_opt_strs+264) extern tUsageProc genshelloptUsage; @@ -67,66 +63,63 @@ extern tUsageProc genshelloptUsage; /* * genshellopt option static const strings */ -static char const genshellopt_opt_strs[1690] = +static char const genshellopt_opt_strs[1710] = /* 0 */ "genshellopt 1\n" "Copyright (C) 1999-2012 Bruce Korb, all rights reserved.\n" "This is free software. It is licensed for use, modification and\n" - "redistribution under the terms of the\n" - "GNU General Public License, version 3 or later\n" - " \n\0" -/* 260 */ "genshellopt is free software: you can redistribute it and/or modify it\n" - "under the terms of the GNU General Public License as published by the Free\n" - "Software Foundation, either version 3 of the License, or (at your option)\n" - "any later version.\n\n" + "redistribution under the terms of the GNU Lesser General Public License,\n" + "version 3 or later \n\0" +/* 264 */ "genshellopt is free software: you can redistribute it and/or modify it\n" + "under the terms of the GNU Lesser General Public License as published by\n" + "the Free Software Foundation, either version 3 of the License, or (at your\n" + "option) any later version.\n\n" "genshellopt is distributed in the hope that it will be useful, but WITHOUT\n" "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n" - "FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n" - "more details.\n\n" - "You should have received a copy of the GNU General Public License along\n" - "with this program. If not, see .\n\0" -/* 871 */ "Output Script File\0" -/* 890 */ "SCRIPT\0" -/* 897 */ "script\0" -/* 904 */ "Shell name (follows \"#!\" magic)\0" -/* 936 */ "SHELL\0" -/* 942 */ "no-shell\0" -/* 951 */ "no\0" -/* 954 */ "Display extended usage information and exit\0" -/* 998 */ "help\0" -/* 1003 */ "Extended usage information passed thru pager\0" -/* 1048 */ "more-help\0" -/* 1058 */ "Output version information and exit\0" -/* 1094 */ "version\0" -/* 1102 */ "GENSHELLOPT\0" -/* 1114 */ "genshellopt - Generate Shell Option Processing Script - Ver. 1\n" - "USAGE: %s [ - [] | --[{=| }] ]...\n\0" -/* 1235 */ "autogen-users@lists.sourceforge.net\0" -/* 1271 */ "\n" - "Note that ``shell'' is only useful if the output file does not already\n" - "exist. If it does, then the shell name and optional first argument will be\n" + "FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\n" + "License for more details.\n\n" + "You should have received a copy of the GNU Lesser General Public License\n" + "along with this program. If not, see .\";\n\0" +/* 898 */ "Output Script File\0" +/* 917 */ "SCRIPT\0" +/* 924 */ "script\0" +/* 931 */ "Shell name (follows \"#!\" magic)\0" +/* 963 */ "SHELL\0" +/* 969 */ "no-shell\0" +/* 978 */ "no\0" +/* 981 */ "display extended usage information and exit\0" +/* 1025 */ "help\0" +/* 1030 */ "extended usage information passed thru pager\0" +/* 1075 */ "more-help\0" +/* 1085 */ "output version information and exit\0" +/* 1121 */ "version\0" +/* 1129 */ "GENSHELLOPT\0" +/* 1141 */ "genshellopt - Generate Shell Option Processing Script - Ver. 1\n" + "Usage: %s [ - [] | --[{=| }] ]...\n\0" +/* 1262 */ "autogen-users@lists.sourceforge.net\0" +/* 1298 */ "Note that 'shell' is only useful if the output file does not already exist.\n" + "If it does, then the shell name and optional first argument will be\n" "extracted from the script file.\n\0" -/* 1452 */ "\n" - "If the script file already exists and contains Automated Option Processing\n" +/* 1475 */ "If the script file already exists and contains Automated Option Processing\n" "text, the second line of the file through the ending tag will be replaced\n" - "by the newly generated text. The first ``#!'' line will be regenerated.\n\0" -/* 1676 */ "genshellopt 1"; + "by the newly generated text. The first '#!' line will be regenerated.\n\0" +/* 1696 */ "genshellopt 1"; /* * script option description: */ -#define SCRIPT_DESC (genshellopt_opt_strs+871) -#define SCRIPT_NAME (genshellopt_opt_strs+890) -#define SCRIPT_name (genshellopt_opt_strs+897) +#define SCRIPT_DESC (genshellopt_opt_strs+898) +#define SCRIPT_NAME (genshellopt_opt_strs+917) +#define SCRIPT_name (genshellopt_opt_strs+924) #define SCRIPT_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * shell option description: */ -#define SHELL_DESC (genshellopt_opt_strs+904) -#define SHELL_NAME (genshellopt_opt_strs+936) -#define NOT_SHELL_name (genshellopt_opt_strs+942) -#define NOT_SHELL_PFX (genshellopt_opt_strs+951) +#define SHELL_DESC (genshellopt_opt_strs+931) +#define SHELL_NAME (genshellopt_opt_strs+963) +#define NOT_SHELL_name (genshellopt_opt_strs+969) +#define NOT_SHELL_PFX (genshellopt_opt_strs+978) #define SHELL_name (NOT_SHELL_name + 3) #define SHELL_FLAGS (OPTST_INITENABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) @@ -134,11 +127,11 @@ static char const genshellopt_opt_strs[1690] = /* * Help/More_Help/Version option descriptions: */ -#define HELP_DESC (genshellopt_opt_strs+954) -#define HELP_name (genshellopt_opt_strs+998) +#define HELP_DESC (genshellopt_opt_strs+981) +#define HELP_name (genshellopt_opt_strs+1025) #ifdef HAVE_WORKING_FORK -#define MORE_HELP_DESC (genshellopt_opt_strs+1003) -#define MORE_HELP_name (genshellopt_opt_strs+1048) +#define MORE_HELP_DESC (genshellopt_opt_strs+1030) +#define MORE_HELP_name (genshellopt_opt_strs+1075) #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT) #else #define MORE_HELP_DESC NULL @@ -151,8 +144,8 @@ static char const genshellopt_opt_strs[1690] = # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT) #endif -#define VER_DESC (genshellopt_opt_strs+1058) -#define VER_name (genshellopt_opt_strs+1094) +#define VER_DESC (genshellopt_opt_strs+1085) +#define VER_name (genshellopt_opt_strs+1121) /* * Declare option callback procedures */ @@ -200,7 +193,7 @@ static tOptDesc optDesc[GENSHELL_OPTION_CT] = { /* equiv idx value */ NO_EQUIVALENT, VALUE_GENSHELL_OPT_VERSION, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ VER_FLAGS, 0, + /* opt state flags */ VER_FLAGS, AOUSE_VERSION, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, @@ -214,7 +207,7 @@ static tOptDesc optDesc[GENSHELL_OPTION_CT] = { /* equiv idx value */ NO_EQUIVALENT, VALUE_GENSHELL_OPT_HELP, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0, + /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, AOUSE_HELP, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, @@ -226,7 +219,7 @@ static tOptDesc optDesc[GENSHELL_OPTION_CT] = { /* equiv idx value */ NO_EQUIVALENT, VALUE_GENSHELL_OPT_MORE_HELP, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ MORE_HELP_FLAGS, 0, + /* opt state flags */ MORE_HELP_FLAGS, AOUSE_MORE_HELP, /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, @@ -240,15 +233,15 @@ static tOptDesc optDesc[GENSHELL_OPTION_CT] = { * * Define the genshellopt Option Environment */ -#define zPROGNAME (genshellopt_opt_strs+1102) -#define zUsageTitle (genshellopt_opt_strs+1114) +#define zPROGNAME (genshellopt_opt_strs+1129) +#define zUsageTitle (genshellopt_opt_strs+1141) #define zRcName NULL #define apzHomeList NULL -#define zBugsAddr (genshellopt_opt_strs+1235) -#define zExplain (genshellopt_opt_strs+1271) -#define zDetail (genshellopt_opt_strs+1452) -#define zFullVersion (genshellopt_opt_strs+1676) -/* extracted from optcode.tlib near line 353 */ +#define zBugsAddr (genshellopt_opt_strs+1262) +#define zExplain (genshellopt_opt_strs+1298) +#define zDetail (genshellopt_opt_strs+1475) +#define zFullVersion (genshellopt_opt_strs+1696) +/* extracted from optcode.tlib near line 364 */ #if defined(ENABLE_NLS) # define OPTPROC_BASE OPTPROC_TRANSLATE @@ -258,9 +251,7 @@ static tOptDesc optDesc[GENSHELL_OPTION_CT] = { # define translate_option_strings NULL #endif /* ENABLE_NLS */ - #define genshellopt_full_usage (NULL) - #define genshellopt_short_usage (NULL) #endif /* not defined __doxygen__ */ @@ -283,7 +274,7 @@ doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc) (void)pOptDesc; (void)pOptions; } -/* extracted from optmain.tlib near line 1188 */ +/* extracted from optmain.tlib near line 1254 */ /** * The directory containing the data associated with genshellopt. @@ -352,6 +343,11 @@ tOptions genshelloptOptions = { }; #if ENABLE_NLS +/* + * This code is designed to translate translatable option text for the + * genshellopt program. These translations happen upon entry + * to optionProcess(). + */ #include #include #include @@ -430,9 +426,8 @@ translate_option_strings(void) * Do the translations. The first pointer follows the field count * field. The field count field is the size of a pointer. */ - tOptDesc * od = opts->pOptDesc; - char ** ppz = (char**)(void*)&(option_xlateable_txt); - int ix = option_xlateable_txt.field_ct; + char ** ppz = (char**)(void*)&(option_xlateable_txt); + int ix = option_xlateable_txt.field_ct; do { ppz++; /* skip over field_ct */ @@ -447,27 +442,383 @@ translate_option_strings(void) coerce_it((void*)&(opts->pzUsageTitle)); coerce_it((void*)&(opts->pzExplain)); coerce_it((void*)&(opts->pzDetail)); - coerce_it((void*)&(opts->pzPackager)); - - for (ix = opts->optCt; ix > 0; ix--, od++) - coerce_it((void*)&(od->pzText)); - } - - if ((opts->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) { - tOptDesc * od = opts->pOptDesc; - int ix; - - for (ix = opts->optCt; ix > 0; ix--, od++) { - coerce_it((void*)&(od->pz_Name)); - coerce_it((void*)&(od->pz_DisableName)); - coerce_it((void*)&(od->pz_DisablePfx)); + { + tOptDesc * od = opts->pOptDesc; + for (ix = opts->optCt; ix > 0; ix--, od++) + coerce_it((void*)&(od->pzText)); } - genshelloptOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; } } - #endif /* ENABLE_NLS */ +#ifdef DO_NOT_COMPILE_THIS_CODE_IT_IS_FOR_GETTEXT +static void bogus_function(void) { + /* TRANSLATORS: + + The following dummy function was crated solely so that xgettext can extract + the correct strings. These strings are actually referenced by a field name + in the genshelloptOptions structure noted in the comments below. The + literal text is defined in genshellopt_opt_strs. + + NOTE: the strings below are segmented with respect to the source string + genshellopt_opt_strs. The strings above are handed off for translation + at run time a paragraph at a time. Consequently, they are presented here + for translation a paragraph at a time. + + ALSO: often the description for an option will reference another option + by name. These are set off with apostrophe quotes (I hope). Do not + translate option names. + */ + /* referenced via genshelloptOptions.pzCopyright */ + puts(_("genshellopt 1\n\ +Copyright (C) 1999-2012 Bruce Korb, all rights reserved.\n\ +This is free software. It is licensed for use, modification and\n\ +redistribution under the terms of the GNU Lesser General Public License,\n\ +version 3 or later \n")); + + /* referenced via genshelloptOptions.pzCopyNotice */ + puts(_("genshellopt is free software: you can redistribute it and/or modify it\n\ +under the terms of the GNU Lesser General Public License as published by\n\ +the Free Software Foundation, either version 3 of the License, or (at your\n\ +option) any later version.\n\n")); + puts(_("genshellopt is distributed in the hope that it will be useful, but WITHOUT\n\ +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n\ +FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\n\ +License for more details.\n\n")); + puts(_("You should have received a copy of the GNU Lesser General Public License\n\ +along with this program. If not, see .\";\n")); + + /* referenced via genshelloptOptions.pOptDesc->pzText */ + puts(_("Output Script File")); + + /* referenced via genshelloptOptions.pOptDesc->pzText */ + puts(_("Shell name (follows \"#!\" magic)")); + + /* referenced via genshelloptOptions.pOptDesc->pzText */ + puts(_("display extended usage information and exit")); + + /* referenced via genshelloptOptions.pOptDesc->pzText */ + puts(_("extended usage information passed thru pager")); + + /* referenced via genshelloptOptions.pOptDesc->pzText */ + puts(_("output version information and exit")); + + /* referenced via genshelloptOptions.pzUsageTitle */ + puts(_("genshellopt - Generate Shell Option Processing Script - Ver. 1\n\ +Usage: %s [ - [] | --[{=| }] ]...\n")); + + /* referenced via genshelloptOptions.pzExplain */ + puts(_("Note that 'shell' is only useful if the output file does not already exist.\n\ +If it does, then the shell name and optional first argument will be\n\ +extracted from the script file.\n")); + + /* referenced via genshelloptOptions.pzDetail */ + puts(_("If the script file already exists and contains Automated Option Processing\n\ +text, the second line of the file through the ending tag will be replaced\n\ +by the newly generated text. The first '#!' line will be regenerated.\n")); + + /* referenced via genshelloptOptions.pzFullVersion */ + puts(_("genshellopt 1")); + + /* referenced via genshelloptOptions.pzFullUsage */ + puts(_("<<>>")); + + /* referenced via genshelloptOptions.pzShortUsage */ + puts(_("<<>>")); + + /* LIBOPTS-MESSAGES: */ +#line 60 "../autoopts.c" + puts(_("allocation of %d bytes failed\n")); +#line 86 "../autoopts.c" + puts(_("allocation of %d bytes failed\n")); +#line 53 "../init.c" + puts(_("AutoOpts function called without option descriptor\n")); +#line 89 "../init.c" + puts(_("\tThis exceeds the compiled library version: ")); +#line 87 "../init.c" + puts(_("Automated Options Processing Error!\n" + "\t%s called AutoOpts function with structure version %d:%d:%d.\n")); +#line 73 "../autoopts.c" + puts(_("realloc of %d bytes at 0x%p failed\n")); +#line 91 "../init.c" + puts(_("\tThis is less than the minimum library version: ")); +#line 121 "../version.c" + puts(_("Automated Options version %s\n" + "\tCopyright (C) 1999-2013 by Bruce Korb - all rights reserved\n")); +#line 310 "../usage.c" + puts(_("(AutoOpts bug): %s.\n")); +#line 90 "../reset.c" + puts(_("optionResetOpt() called, but reset-option not configured")); +#line 329 "../usage.c" + puts(_("could not locate the 'help' option")); +#line 351 "../autoopts.c" + puts(_("optionProcess() was called with invalid data")); +#line 770 "../usage.c" + puts(_("invalid argument type specified")); +#line 589 "../find.c" + puts(_("defaulted to option with optional arg")); +#line 76 "../alias.c" + puts(_("aliasing option is out of range.")); +#line 229 "../enum.c" + puts(_("%s error: the keyword '%s' is ambiguous for %s\n")); +#line 108 "../find.c" + puts(_(" The following options match:\n")); +#line 290 "../find.c" + puts(_("%s: ambiguous option name: %s (matches %d options)\n")); +#line 161 "../check.c" + puts(_("%s: Command line arguments required\n")); +#line 43 "../alias.c" + puts(_("%d %s%s options allowed\n")); +#line 81 "../makeshell.c" + puts(_("%s error %d (%s) calling %s for '%s'\n")); +#line 293 "../makeshell.c" + puts(_("interprocess pipe")); +#line 168 "../version.c" + puts(_("error: version option argument '%c' invalid. Use:\n" + "\t'v' - version only\n" + "\t'c' - version and copyright\n" + "\t'n' - version and full copyright notice\n")); +#line 58 "../check.c" + puts(_("%s error: the '%s' and '%s' options conflict\n")); +#line 214 "../find.c" + puts(_("%s: The '%s' option has been disabled.")); +#line 421 "../find.c" + puts(_("%s: The '%s' option has been disabled.")); +#line 38 "../alias.c" + puts(_("-equivalence")); +#line 460 "../find.c" + puts(_("%s: illegal option -- %c\n")); +#line 110 "../reset.c" + puts(_("%s: illegal option -- %c\n")); +#line 268 "../find.c" + puts(_("%s: illegal option -- %s\n")); +#line 746 "../find.c" + puts(_("%s: illegal option -- %s\n")); +#line 118 "../reset.c" + puts(_("%s: illegal option -- %s\n")); +#line 332 "../find.c" + puts(_("%s: unknown vendor extension option -- %s\n")); +#line 154 "../enum.c" + puts(_(" or an integer from %d through %d\n")); +#line 164 "../enum.c" + puts(_(" or an integer from %d through %d\n")); +#line 769 "../usage.c" + puts(_("%s error: invalid option descriptor for %s\n")); +#line 1097 "../usage.c" + puts(_("%s error: invalid option descriptor for %s\n")); +#line 379 "../find.c" + puts(_("%s: invalid option name: %s\n")); +#line 518 "../find.c" + puts(_("%s: The '%s' option requires an argument.\n")); +#line 171 "../autoopts.c" + puts(_("(AutoOpts bug): Equivalenced option '%s' was equivalenced to both\n" + "\t'%s' and '%s'")); +#line 94 "../check.c" + puts(_("%s error: The %s option is required\n")); +#line 623 "../find.c" + puts(_("%s: The '%s' option cannot have an argument.\n")); +#line 151 "../check.c" + puts(_("%s: Command line arguments are not allowed.\n")); +#line 531 "../save.c" + puts(_("error %d (%s) creating %s\n")); +#line 229 "../enum.c" + puts(_("%s error: '%s' does not match any %s keywords.\n")); +#line 93 "../reset.c" + puts(_("%s error: The '%s' option requires an argument.\n")); +#line 184 "../save.c" + puts(_("error %d (%s) stat-ing %s\n")); +#line 238 "../save.c" + puts(_("error %d (%s) stat-ing %s\n")); +#line 143 "../restore.c" + puts(_("%s error: no saved option state\n")); +#line 246 "../autoopts.c" + puts(_("'%s' is not a command line option.\n")); +#line 114 "../time.c" + puts(_("%s error: '%s' is not a recognizable date/time.\n")); +#line 132 "../save.c" + puts(_("'%s' not defined\n")); +#line 53 "../time.c" + puts(_("%s error: '%s' is not a recognizable time duration.\n")); +#line 92 "../check.c" + puts(_("%s error: The %s option must appear %d times\n")); +#line 157 "../numeric.c" + puts(_("%s error: '%s' is not a recognizable number.\n")); +#line 195 "../enum.c" + puts(_("%s error: %s exceeds %s keyword count\n")); +#line 366 "../usage.c" + puts(_("Try '%s %s' for more information.\n")); +#line 45 "../alias.c" + puts(_("one %s%s option allowed\n")); +#line 195 "../makeshell.c" + puts(_("standard output")); +#line 930 "../makeshell.c" + puts(_("standard output")); +#line 304 "../usage.c" + puts(_("standard output")); +#line 451 "../usage.c" + puts(_("standard output")); +#line 647 "../usage.c" + puts(_("standard output")); +#line 175 "../version.c" + puts(_("standard output")); +#line 304 "../usage.c" + puts(_("standard error")); +#line 451 "../usage.c" + puts(_("standard error")); +#line 647 "../usage.c" + puts(_("standard error")); +#line 175 "../version.c" + puts(_("standard error")); +#line 195 "../makeshell.c" + puts(_("write")); +#line 930 "../makeshell.c" + puts(_("write")); +#line 303 "../usage.c" + puts(_("write")); +#line 450 "../usage.c" + puts(_("write")); +#line 646 "../usage.c" + puts(_("write")); +#line 174 "../version.c" + puts(_("write")); +#line 60 "../numeric.c" + puts(_("%s error: %s option value %ld is out of range.\n")); +#line 44 "../check.c" + puts(_("%s error: %s option requires the %s option\n")); +#line 131 "../save.c" + puts(_("%s warning: cannot save options - %s not regular file\n")); +#line 183 "../save.c" + puts(_("%s warning: cannot save options - %s not regular file\n")); +#line 237 "../save.c" + puts(_("%s warning: cannot save options - %s not regular file\n")); +#line 256 "../save.c" + puts(_("%s warning: cannot save options - %s not regular file\n")); +#line 530 "../save.c" + puts(_("%s warning: cannot save options - %s not regular file\n")); + /* END-LIBOPTS-MESSAGES */ + + /* USAGE-TEXT: */ +#line 895 "../usage.c" + puts(_("\t\t\t\t- an alternate for '%s'\n")); +#line 1164 "../usage.c" + puts(_("Version, usage and configuration options:")); +#line 946 "../usage.c" + puts(_("\t\t\t\t- default option for unnamed options\n")); +#line 859 "../usage.c" + puts(_("\t\t\t\t- disabled as '--%s'\n")); +#line 1133 "../usage.c" + puts(_(" --- %-14s %s\n")); +#line 1131 "../usage.c" + puts(_("This option has been disabled")); +#line 886 "../usage.c" + puts(_("\t\t\t\t- enabled by default\n")); +#line 40 "../alias.c" + puts(_("%s error: only ")); +#line 1208 "../usage.c" + puts(_(" - examining environment variables named %s_*\n")); +#line 168 "../file.c" + puts(_("\t\t\t\t- file must not pre-exist\n")); +#line 172 "../file.c" + puts(_("\t\t\t\t- file must pre-exist\n")); +#line 416 "../usage.c" + puts(_("Options are specified by doubled hyphens and their name or by a single\n" + "hyphen and the flag character.\n")); +#line 908 "../makeshell.c" + puts(_("\n" + "= = = = = = = =\n\n" + "This incarnation of genshell will produce\n" + "a shell script to parse the options for %s:\n\n")); +#line 161 "../enum.c" + puts(_(" or an integer mask with any of the lower %d bits set\n")); +#line 919 "../usage.c" + puts(_("\t\t\t\t- is a set membership option\n")); +#line 940 "../usage.c" + puts(_("\t\t\t\t- must appear between %d and %d times\n")); +#line 418 "../usage.c" + puts(_("Options are specified by single or double hyphens and their name.\n")); +#line 926 "../usage.c" + puts(_("\t\t\t\t- may appear multiple times\n")); +#line 913 "../usage.c" + puts(_("\t\t\t\t- may not be preset\n")); +#line 1323 "../usage.c" + puts(_(" Arg Option-Name Description\n")); +#line 1259 "../usage.c" + puts(_(" Flg Arg Option-Name Description\n")); +#line 1317 "../usage.c" + puts(_(" Flg Arg Option-Name Description\n")); +#line 1318 "../usage.c" + puts(_(" %3s %s")); +#line 1324 "../usage.c" + puts(_(" %3s %s")); +#line 423 "../usage.c" + puts(_("The '-#' option may omit the hash char\n")); +#line 419 "../usage.c" + puts(_("All arguments are named options.\n")); +#line 993 "../usage.c" + puts(_(" - reading file %s")); +#line 445 "../usage.c" + puts(_("\n" + "please send bug reports to: <%s>\n")); +#line 100 "../version.c" + puts(_("\n" + "please send bug reports to: <%s>\n")); +#line 129 "../version.c" + puts(_("\n" + "please send bug reports to: <%s>\n")); +#line 925 "../usage.c" + puts(_("\t\t\t\t- may NOT appear - preset only\n")); +#line 965 "../usage.c" + puts(_("\n" + "The following option preset mechanisms are supported:\n")); +#line 1206 "../usage.c" + puts(_("\n" + "The following option preset mechanisms are supported:\n")); +#line 704 "../usage.c" + puts(_("prohibits these options:\n")); +#line 699 "../usage.c" + puts(_("prohibits the option '%s'\n")); +#line 81 "../numeric.c" + puts(_("%s%ld to %ld")); +#line 79 "../numeric.c" + puts(_("%sgreater than or equal to %ld")); +#line 75 "../numeric.c" + puts(_("%s%ld exactly")); +#line 68 "../numeric.c" + puts(_("%sit must lie in one of the ranges:\n")); +#line 68 "../numeric.c" + puts(_("%sit must be in the range:\n")); +#line 88 "../numeric.c" + puts(_(", or\n")); +#line 66 "../numeric.c" + puts(_("%sis scalable with a suffix: k/K/m/M/g/G/t/T\n")); +#line 77 "../numeric.c" + puts(_("%sless than or equal to %ld")); +#line 426 "../usage.c" + puts(_("Operands and options may be intermixed. They will be reordered.\n")); +#line 674 "../usage.c" + puts(_("requires the option '%s'\n")); +#line 677 "../usage.c" + puts(_("requires these options:\n")); +#line 1335 "../usage.c" + puts(_(" Arg Option-Name Req? Description\n")); +#line 1329 "../usage.c" + puts(_(" Flg Arg Option-Name Req? Description\n")); +#line 162 "../enum.c" + puts(_("or you may use a numeric representation. Preceding these with a '!'\n" + "will clear the bits, specifying 'none' will clear all bits, and 'all'\n" + "will set them all. Multiple entries may be passed as an option\n" + "argument list.\n")); +#line 932 "../usage.c" + puts(_("\t\t\t\t- may appear up to %d times\n")); +#line 72 "../enum.c" + puts(_("The valid \"%s\" option keywords are:\n")); +#line 1168 "../usage.c" + puts(_("The next option supports vendor supported extra options:")); +#line 795 "../usage.c" + puts(_("These additional options are:")); + /* END-USAGE-TEXT */ +} +#endif /* uncompilable code */ #ifdef __cplusplus } #endif diff --git a/sntp/libopts/genshell.h b/sntp/libopts/genshell.h index c6ae4ed757..90aef35f09 100644 --- a/sntp/libopts/genshell.h +++ b/sntp/libopts/genshell.h @@ -1,12 +1,12 @@ /* -*- buffer-read-only: t -*- vi: set ro: - * + * * DO NOT EDIT THIS FILE (genshell.h) - * - * It has been AutoGen-ed January 4, 2013 at 04:15:46 PM by AutoGen 5.17.1pre14 + * + * It has been AutoGen-ed February 21, 2013 at 12:28:33 PM by AutoGen 5.17.2pre16 * From the definitions genshell.def * and the template file options * - * Generated from AutoOpts 37:1:12 templates. + * Generated from AutoOpts 38:0:13 templates. * * AutoOpts is a copyrighted work. This header file is not encumbered * by AutoOpts licensing, but is provided under the licensing terms chosen @@ -21,22 +21,21 @@ * * Copyright (C) 1999-2012 Bruce Korb, all rights reserved. * This is free software. It is licensed for use, modification and - * redistribution under the terms of the - * GNU General Public License, version 3 or later - * + * redistribution under the terms of the GNU Lesser General Public License, + * version 3 or later * * genshellopt is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * genshellopt is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see ."; */ /* * This file contains the programmatic interface to the Automated @@ -55,7 +54,7 @@ * tolerable version is at least as old as what was current when the header * template was released. */ -#define AO_TEMPLATE_VERSION 151553 +#define AO_TEMPLATE_VERSION 155648 #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) # error option template version mismatches autoopts/options.h header @@ -127,7 +126,7 @@ typedef enum { genshelloptOptions.pzCurOpt = NULL ) #define START_GENSHELL_OPT RESTART_GENSHELL_OPT(1) #define GENSHELL_USAGE(c) (*genshelloptOptions.pUsageProc)(&genshelloptOptions, c) -/* extracted from opthead.tlib near line 497 */ +/* extracted from opthead.tlib near line 498 */ #ifdef __cplusplus extern "C" { diff --git a/sntp/libopts/init.c b/sntp/libopts/init.c index 17bd87bb76..25dc07bd05 100644 --- a/sntp/libopts/init.c +++ b/sntp/libopts/init.c @@ -3,6 +3,10 @@ * * initialize the libopts data structures. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -17,16 +21,13 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ -static char const ao_ver_string[] = - STR(AO_CURRENT)":"STR(AO_REVISION)":"STR(AO_AGE)"\n"; - /* = = = START-STATIC-FORWARD = = = */ static tSuccess do_presets(tOptions * opts); @@ -49,7 +50,7 @@ LOCAL tSuccess validate_struct(tOptions * opts, char const * pname) { if (opts == NULL) { - fputs(zAO_Bad, stderr); + fputs(zno_opt_arg, stderr); return FAILURE; } @@ -58,7 +59,8 @@ validate_struct(tOptions * opts, char const * pname) * is available, then go do it. */ if ( ((opts->fOptSet & OPTPROC_TRANSLATE) != 0) - && (opts->pTransProc != NULL) ) { + && (opts->pTransProc != NULL) + && (option_xlateable_txt.field_ct != 0) ) { /* * If option names are not to be translated at all, then do not do * it for configuration parsing either. (That is the bit that really @@ -67,7 +69,6 @@ validate_struct(tOptions * opts, char const * pname) if ((opts->fOptSet & OPTPROC_NO_XLAT_MASK) == OPTPROC_NXLAT_OPT) opts->fOptSet |= OPTPROC_NXLAT_OPT_CFG; (*opts->pTransProc)(); - opts->fOptSet &= ~OPTPROC_TRANSLATE; } /* @@ -80,11 +81,14 @@ validate_struct(tOptions * opts, char const * pname) || (opts->structVersion < OPTIONS_MINIMUM_VERSION ) ) ) { - fprintf(stderr, zAO_Err, pname, NUM_TO_VER(opts->structVersion)); + 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(zAO_Big, stderr); + fputs(ztoo_new, stderr); else - fputs(zAO_Sml, stderr); + fputs(ztoo_old, stderr); fwrite(ao_ver_string, sizeof(ao_ver_string) - 1, 1, stderr); return FAILURE; @@ -283,7 +287,8 @@ ao_initialize(tOptions * opts, int a_ct, char ** a_v) return true; } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/load.c b/sntp/libopts/load.c index 48fb03ae52..7f69cdad00 100644 --- a/sntp/libopts/load.c +++ b/sntp/libopts/load.c @@ -1,10 +1,15 @@ /** * \file load.c + * * This file contains the routines that deal with processing text strings * for options, either from a NUL-terminated string passed in or from an * rc/ini file. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -19,11 +24,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /* = = = START-STATIC-FORWARD = = = */ @@ -516,7 +521,8 @@ optionLoadLine(tOptions * opts, char const * line) loadOptionLine(opts, &st, pz, DIRECTION_PROCESS, OPTION_LOAD_COOKED); AGFREE(pz); } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/m4/libopts.m4 b/sntp/libopts/m4/libopts.m4 index e1ff2ba651..ea54394112 100644 --- a/sntp/libopts/m4/libopts.m4 +++ b/sntp/libopts/m4/libopts.m4 @@ -1,8 +1,8 @@ dnl -*- buffer-read-only: t -*- vi: set ro: -dnl +dnl dnl DO NOT EDIT THIS FILE (libopts.m4) -dnl -dnl It has been AutoGen-ed January 4, 2013 at 04:15:39 PM by AutoGen 5.17.1pre14 +dnl +dnl It has been AutoGen-ed February 21, 2013 at 12:28:26 PM by AutoGen 5.17.2pre16 dnl From the definitions libopts.def dnl and the template file conftest.tpl dnl @@ -11,7 +11,6 @@ dnl AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[ AC_REQUIRE([AC_HEADER_STDC]) AC_HEADER_DIRENT - # ================= # AC_CHECK_HEADERS # ================= @@ -19,26 +18,21 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[ sys/mman.h sys/param.h sys/poll.h sys/procset.h \ sys/select.h sys/socket.h sys/stropts.h sys/time.h \ sys/un.h sys/wait.h dlfcn.h errno.h \ - fcntl.h libgen.h memory.h netinet/in.h \ - setjmp.h stdbool.h sysexits.h unistd.h \ - utime.h]) - + fcntl.h libgen.h libintl.h memory.h \ + netinet/in.h setjmp.h stdbool.h sysexits.h \ + unistd.h utime.h]) AC_CHECK_HEADERS([stdarg.h varargs.h], [lo_have_arg_hdr=true;break], [lo_have_arg_hdr=false]) - AC_CHECK_HEADERS([string.h strings.h], [lo_have_str_hdr=true;break], [lo_have_str_hdr=false]) - AC_CHECK_HEADERS([limits.h sys/limits.h values.h], [lo_have_lim_hdr=true;break], [lo_have_lim_hdr=false]) - AC_CHECK_HEADERS([inttypes.h stdint.h], [lo_have_typ_hdr=true;break], [lo_have_typ_hdr=false]) - # ---------------------------------------------------------------------- # check for various programs used during the build. # On OS/X, "wchar.h" needs "runetype.h" to work properly. @@ -49,7 +43,6 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[ # include #endif ]) - # -------------------------------------------- # Verify certain entries from AC_CHECK_HEADERS # -------------------------------------------- @@ -60,20 +53,17 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[ ]AC_MSG_ERROR([you must have ${f}.h on your system])[ } done - + test "X${ac_cv_header_inttypes_h-no}" = Xyes || \ + echo '#include ' > inttypes.h ${lo_have_arg_hdr} || \ ]AC_MSG_ERROR([you must have stdarg.h or varargs.h on your system])[ - ${lo_have_str_hdr} || \ ]AC_MSG_ERROR([you must have string.h or strings.h on your system])[ - ${lo_have_lim_hdr} || \ ]AC_MSG_ERROR( [you must have one of limits.h, sys/limits.h or values.h])[ - ${lo_have_typ_hdr} || \ ]AC_MSG_ERROR([you must have inttypes.h or stdint.h on your system]) - # ---------------------------------------------------------------------- # Checks for typedefs # ---------------------------------------------------------------------- @@ -93,7 +83,6 @@ AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[ AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(long, 8) AC_CHECK_SIZEOF(short, 2) - # ---------------------------------------------------------------------- # AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind. # ---------------------------------------------------------------------- @@ -240,6 +229,7 @@ int main() { else CPPFLAGS="${libopts_save_CPPFLAGS}" LIBS="${libopts_save_LIBS}" + AC_MSG_ERROR([the regex library does not work]) fi ]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX diff --git a/sntp/libopts/makeshell.c b/sntp/libopts/makeshell.c index 28710f8ccf..f22e9f0b84 100644 --- a/sntp/libopts/makeshell.c +++ b/sntp/libopts/makeshell.c @@ -5,6 +5,10 @@ * This module will interpret the options set in the tOptions * structure and create a Bourne shell script capable of parsing them. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -19,11 +23,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ tOptions * optionParseShellOptions = NULL; @@ -65,12 +69,26 @@ static void emit_long(tOptions * opts); static char * -load_old_output(char const * fname); +load_old_output(char const * fname, char const * pname); static void -open_out(char const * fname); +open_out(char const * fname, char const * pname); /* = = = END-STATIC-FORWARD = = = */ +LOCAL void +fserr_warn(char const * prog, char const * op, char const * fname) +{ + fprintf(stderr, zfserr_fmt, prog, errno, strerror(errno), + op, fname); +} + +LOCAL void +fserr_exit(char const * prog, char const * op, char const * fname) +{ + fserr_warn(prog, op, fname); + exit(EXIT_FAILURE); +} + /*=export_func optionParseShell * private: * @@ -103,8 +121,8 @@ optionParseShell(tOptions * opts) * Check for a specified output file */ if (HAVE_GENSHELL_OPT(SCRIPT)) - open_out(GENSHELL_OPT_ARG(SCRIPT)); - + open_out(GENSHELL_OPT_ARG(SCRIPT), opts->pzProgName); + emit_usage(opts); emit_setup(opts); @@ -173,10 +191,8 @@ optionParseShell(tOptions * opts) #endif fclose(stdout); - if (ferror(stdout)) { - fputs(zOutputFail, stderr); - exit(EXIT_FAILURE); - } + if (ferror(stdout)) + fserr_exit(opts->pzProgName, zwriting, zstdout_name); AGFREE(script_text); script_leader = NULL; @@ -185,6 +201,18 @@ optionParseShell(tOptions * opts) } #ifdef HAVE_WORKING_FORK +/** + * Print the value of "var" to a file descriptor. + * The "fdin" is the read end of a pipe to a forked process that + * is writing usage text to it. We read that text in and re-emit + * to standard out, formatting it so that it is assigned to a + * shell variable. + * + * @param[in] prog The capitalized, c-variable-formatted program name + * @param[in] var a similarly formatted type name + * (LONGUSAGE, USAGE or VERSION) + * @param[in] fdin the input end of a pipe + */ static void emit_var_text(char const * prog, char const * var, int fdin) { @@ -208,11 +236,11 @@ emit_var_text(char const * prog, char const * var, int fdin) fputc(NL, stdout); nlct--; } - fputs(apostrophy, stdout); + fputs(apostrophe, stdout); break; case EOF: - goto endCharLoop; + goto done; default: while (nlct > 0) { @@ -222,7 +250,7 @@ emit_var_text(char const * prog, char const * var, int fdin) fputc(ch, stdout); break; } - } endCharLoop:; + } done:; fclose(fp); @@ -230,7 +258,6 @@ emit_var_text(char const * prog, char const * var, int fdin) fputs(END_SET_TEXT, stdout); } - #endif /** @@ -262,16 +289,13 @@ text_to_var(tOptions * opts, teTextTo which, tOptDesc * od) fflush(stdout); fflush(stderr); - if (pipe(fdpair) != 0) { - fprintf(stderr, zBadPipe, errno, strerror(errno)); - exit(EXIT_FAILURE); - } + if (pipe(fdpair) != 0) + fserr_exit(opts->pzProgName, "pipe", zinter_proc_pipe); switch (fork()) { case -1: - fprintf(stderr, zForkFail, errno, strerror(errno), opts->pzProgName); - exit(EXIT_FAILURE); - break; + fserr_exit(opts->pzProgName, "fork", opts->pzProgName); + /* NOTREACHED */ case 0: /* @@ -314,7 +338,10 @@ text_to_var(tOptions * opts, teTextTo which, tOptDesc * od) #endif } - +/** + * capture usage text in shell variables. + * + */ static void emit_usage(tOptions * opts) { @@ -540,7 +567,6 @@ emit_action(tOptions * opts, tOptDesc * od) fputs(zOptionEndSelect, stdout); } - static void emit_inaction(tOptions * opts, tOptDesc * od) { @@ -558,7 +584,12 @@ emit_inaction(tOptions * opts, tOptDesc * od) fputs(zOptionEndSelect, stdout); } - +/** + * recognize flag options. These go at the end. + * At the end, emit code to handle options we don't recognize. + * + * @param[in] opts the program options + */ static void emit_flag(tOptions * opts) { @@ -569,100 +600,101 @@ emit_flag(tOptions * opts) for (;opt_ct > 0; od++, --opt_ct) { - if (SKIP_OPT(od)) + if (SKIP_OPT(od) || ! IS_GRAPHIC_CHAR(od->optValue)) continue; - if (IS_GRAPHIC_CHAR(od->optValue)) { - printf(zOptionFlag, od->optValue); - emit_action(opts, od); - } + printf(zOptionFlag, od->optValue); + emit_action(opts, od); } printf(UNK_OPT_FMT, FLAG_STR, opts->pzPROGNAME); } - -/* - * Emit the match text for a long option +/** + * Emit the match text for a long option. The passed in \a name may be + * either the enablement name or the disablement name. + * + * @param[in] name The current name to check. + * @param[in] cod current option descriptor + * @param[in] opts the program options */ static void emit_match_expr(char const * name, tOptDesc * cod, tOptions * opts) { - tOptDesc * od = opts->pOptDesc; - int oCt = opts->optCt; - int min = 1; - char name_bf[ 256 ]; - char * pz = name_bf; + char name_bf[32]; + unsigned int min_match_ct = 2; + unsigned int max_match_ct = strlen(name) - 1; - for (;;) { - int matchCt = 0; + if (max_match_ct >= sizeof(name_bf) - 1) + goto leave; + + { + tOptDesc * od = opts->pOptDesc; + int ct = opts->optCt; - /* - * Omit the current option, Documentation opts and compiled out opts. - */ - if ((od == cod) || SKIP_OPT(od)){ - if (--oCt <= 0) - break; - od++; - continue; - } + for (; ct-- > 0; od++) { + unsigned int match_ct = 0; - /* - * Check each character of the name case insensitively. - * They must not be the same. They cannot be, because it would - * not compile correctly if they were. - */ - while ( toupper(od->pz_Name[matchCt]) - == toupper(name[matchCt])) - matchCt++; + /* + * Omit the current option, Doc opts and compiled out opts. + */ + if ((od == cod) || SKIP_OPT(od)) + continue; - if (matchCt > min) - min = matchCt; + /* + * Check each character of the name case insensitively. + * They must not be the same. They cannot be, because it would + * not compile correctly if they were. + */ + while (toupper(od->pz_Name[match_ct]) == toupper(name[match_ct])) + match_ct++; - /* - * Check the disablement name, too. - */ - if (od->pz_DisableName != NULL) { - matchCt = 0; - while ( toupper(od->pz_DisableName[matchCt]) - == toupper(name[matchCt])) - matchCt++; - if (matchCt > min) - min = matchCt; + if (match_ct > min_match_ct) + min_match_ct = match_ct; + + /* + * Check the disablement name, too. + */ + if (od->pz_DisableName == NULL) + continue; + + match_ct = 0; + while ( toupper(od->pz_DisableName[match_ct]) + == toupper(name[match_ct])) + match_ct++; + if (match_ct > min_match_ct) + min_match_ct = match_ct; } - if (--oCt <= 0) - break; - od++; } /* - * IF the 'min' is all or one short of the name length, - * THEN the entire string must be matched. + * Don't bother emitting partial matches if there is only one possible + * partial match. */ - if ( (name[min ] == NUL) - || (name[min+1] == NUL) ) - printf(zOptionFullName, name); + if (min_match_ct < max_match_ct) { + char * pz = name_bf + min_match_ct; + int nm_ix = min_match_ct; - else { - int matchCt = 0; - for (; matchCt <= min; matchCt++) - *pz++ = name[matchCt]; + memcpy(name_bf, name, min_match_ct); for (;;) { *pz = NUL; printf(zOptionPartName, name_bf); - *pz++ = name[matchCt++]; - if (name[matchCt] == NUL) { + *pz++ = name[nm_ix++]; + if (name[nm_ix] == NUL) { *pz = NUL; - printf(zOptionFullName, name_bf); break; } } } -} +leave: + printf(zOptionFullName, name); +} /** * Emit GNU-standard long option handling code. + * + * @param[in] opts the program options */ static void emit_long(tOptions * opts) @@ -704,7 +736,7 @@ emit_long(tOptions * opts) * @param[in] fname the output file name */ static char * -load_old_output(char const * fname) +load_old_output(char const * fname, char const * pname) { /* * IF we cannot stat the file, @@ -723,10 +755,8 @@ load_old_output(char const * fname) * If we opened it, we should be able to stat it and it needs * to be a regular file */ - if ((fstat(fileno(fp), &stbf) != 0) || (! S_ISREG(stbf.st_mode))) { - fprintf(stderr, zNotFile, fname); - exit(EXIT_FAILURE); - } + if ((fstat(fileno(fp), &stbf) != 0) || (! S_ISREG(stbf.st_mode))) + fserr_exit(pname, "fstat", fname); scan = text = AGALOC(stbf.st_size + 1, "f data"); @@ -764,11 +794,11 @@ load_old_output(char const * fname) * @param[in] fname the output file name */ static void -open_out(char const * fname) +open_out(char const * fname, char const * pname) { do { - char * txt = script_text = load_old_output(fname); + char * txt = script_text = load_old_output(fname, pname); char * scn; if (txt == NULL) @@ -784,7 +814,8 @@ open_out(char const * fname) scn = strstr(scn, END_MARK); if (scn == NULL) { /* - * The file is corrupt. + * The file is corrupt. Set the trailer to be everything + * after the start mark. The user will need to fix it up. */ script_trailer = txt + strlen(txt) + START_MARK_LEN + 1; break; @@ -798,13 +829,10 @@ open_out(char const * fname) script_leader = txt; } while (false); - if (freopen(fname, "w" FOPEN_BINARY_FLAG, stdout) != stdout) { - fprintf(stderr, zFreopenFail, errno, strerror(errno)); - exit(EXIT_FAILURE); - } + if (freopen(fname, "w" FOPEN_BINARY_FLAG, stdout) != stdout) + fserr_exit(pname, "freopen", fname); } - /*=export_func genshelloptUsage * private: * what: The usage function for the genshellopt generated program @@ -898,16 +926,15 @@ genshelloptUsage(tOptions * opts, int exit_cd) } fflush(stdout); - if (ferror(stdout)) { - fputs(zOutputFail, stderr); - exit(EXIT_FAILURE); - } + if (ferror(stdout)) + fserr_exit(opts->pzProgName, zwriting, zstdout_name); exit(EXIT_SUCCESS); #endif } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/nested.c b/sntp/libopts/nested.c index 257ce84405..e5991639ec 100644 --- a/sntp/libopts/nested.c +++ b/sntp/libopts/nested.c @@ -2,6 +2,12 @@ /** * \file nested.c * + * Handle options with arguments that contain nested values. + * + * @addtogroup autoopts + * @{ + */ +/* * Automated Options Nested Values module. * * This file is part of AutoOpts, a companion to AutoGen. @@ -18,11 +24,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ typedef struct { @@ -545,7 +551,7 @@ scan_xml(char const * xml_name, tOptionValue * res_val) if (scan == NULL) goto bail_scan_xml; } - + /* * "scan" now points to where the scan is to resume after returning. * It either points after "/>" at the end of the XML element header, @@ -905,7 +911,8 @@ emit_special_char(FILE * fp, int ch) fprintf(fp, XML_HEX_BYTE_FMT, (ch & 0xFF)); } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/numeric.c b/sntp/libopts/numeric.c index 6b7a0b7e16..260f539c75 100644 --- a/sntp/libopts/numeric.c +++ b/sntp/libopts/numeric.c @@ -2,6 +2,12 @@ /** * \file numeric.c * + * Handle options with numeric (integer) arguments. + * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -16,11 +22,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /*=export_func optionShowRange @@ -40,7 +46,7 @@ optionShowRange(tOptions * pOpts, tOptDesc * pOD, void * rng_table, int rng_ct) { const struct {long const rmin, rmax;} * rng = rng_table; - char const * pz_indent = BULLET_STR; + char const * pz_indent = zTabHyp + tab_skip_ct; /* * The range is shown only for full usage requests and an error @@ -60,7 +66,9 @@ optionShowRange(tOptions * pOpts, tOptDesc * pOD, void * rng_table, int rng_ct) fprintf(option_usage_fp, zRangeScaled, pz_indent); fprintf(option_usage_fp, (rng_ct > 1) ? zRangeLie : zRangeOnly, pz_indent); - pz_indent = (pOpts != OPTPROC_EMIT_USAGE) ? ONE_TAB_STR : DEEP_INDENT_STR; + pz_indent = (pOpts != OPTPROC_EMIT_USAGE) + ? ONE_TAB_STR + : (zTabSpace + tab_skip_ct); for (;;) { if (rng->rmax == LONG_MIN) @@ -89,14 +97,14 @@ optionShowRange(tOptions * pOpts, tOptDesc * pOD, void * rng_table, int rng_ct) * private: * * what: process an option with a numeric value. - * arg: + tOptions* + pOpts + program options descriptor + - * arg: + tOptDesc* + pOptDesc + 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* pOpts, tOptDesc* pOD ) +optionNumericVal(tOptions * opts, tOptDesc * od) { char* pz; long val; @@ -104,20 +112,20 @@ optionNumericVal(tOptions* pOpts, tOptDesc* pOD ) /* * Numeric options may have a range associated with it. * If it does, the usage procedure requests that it be - * emitted by passing a NULL pOD pointer. Also bail out + * emitted by passing a NULL od pointer. Also bail out * if there is no option argument or if we are being reset. */ - if ( (pOD == NULL) - || (pOD->optArg.argString == NULL) - || ((pOD->fOptState & OPTST_RESET) != 0)) + if ( (od == NULL) + || (od->optArg.argString == NULL) + || ((od->fOptState & OPTST_RESET) != 0)) return; errno = 0; - val = strtol(pOD->optArg.argString, &pz, 0); - if ((pz == pOD->optArg.argString) || (errno != 0)) + val = strtol(od->optArg.argString, &pz, 0); + if ((pz == od->optArg.argString) || (errno != 0)) goto bad_number; - if ((pOD->fOptState & OPTST_SCALED_NUM) != 0) + if ((od->fOptState & OPTST_SCALED_NUM) != 0) switch (*(pz++)) { case NUL: pz--; break; case 't': val *= 1000; @@ -136,25 +144,26 @@ optionNumericVal(tOptions* pOpts, tOptDesc* pOD ) if (*pz != NUL) goto bad_number; - if (pOD->fOptState & OPTST_ALLOC_ARG) { - AGFREE(pOD->optArg.argString); - pOD->fOptState &= ~OPTST_ALLOC_ARG; + if (od->fOptState & OPTST_ALLOC_ARG) { + AGFREE(od->optArg.argString); + od->fOptState &= ~OPTST_ALLOC_ARG; } - pOD->optArg.argInt = val; + od->optArg.argInt = val; return; bad_number: - fprintf( stderr, zNotNumber, pOpts->pzProgName, pOD->optArg.argString ); - if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) - (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE); + fprintf( stderr, zNotNumber, opts->pzProgName, od->optArg.argString ); + if ((opts->fOptSet & OPTPROC_ERRSTOP) != 0) + (*(opts->pUsageProc))(opts, EXIT_FAILURE); errno = EINVAL; - pOD->optArg.argInt = ~0; + od->optArg.argInt = ~0; } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/option-value-type.c b/sntp/libopts/option-value-type.c index 06e32e5d44..566a5d9315 100644 --- a/sntp/libopts/option-value-type.c +++ b/sntp/libopts/option-value-type.c @@ -1,11 +1,11 @@ /* -*- buffer-read-only: t -*- vi: set ro: - * + * * DO NOT EDIT THIS FILE (stdin.c) - * - * It has been AutoGen-ed January 4, 2013 at 04:15:45 PM by AutoGen 5.17.1pre14 + * + * It has been AutoGen-ed February 21, 2013 at 12:28:32 PM by AutoGen 5.17.2pre16 * From the definitions stdin * and the template file str2enum - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 3. Neither the name ``Bruce Korb'' nor the name of any other * contributor may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * str2enum IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/sntp/libopts/option-value-type.h b/sntp/libopts/option-value-type.h index ac1fb9e4d4..0c010fa87d 100644 --- a/sntp/libopts/option-value-type.h +++ b/sntp/libopts/option-value-type.h @@ -1,11 +1,11 @@ /* -*- buffer-read-only: t -*- vi: set ro: - * + * * DO NOT EDIT THIS FILE (stdin.h) - * - * It has been AutoGen-ed January 4, 2013 at 04:15:45 PM by AutoGen 5.17.1pre14 + * + * It has been AutoGen-ed February 21, 2013 at 12:28:32 PM by AutoGen 5.17.2pre16 * From the definitions stdin * and the template file str2enum - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 3. Neither the name ``Bruce Korb'' nor the name of any other * contributor may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * str2enum IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -35,7 +35,9 @@ #ifndef STR2ENUM_OPTION_VALUE_TYPE_H_GUARD #define STR2ENUM_OPTION_VALUE_TYPE_H_GUARD 1 #include -#include +#ifndef MISSING_INTTYPES_H +# include +#endif typedef enum { VTP_INVALID_CMD = 0, diff --git a/sntp/libopts/option-xat-attribute.c b/sntp/libopts/option-xat-attribute.c index f5374716d3..4bff2c9377 100644 --- a/sntp/libopts/option-xat-attribute.c +++ b/sntp/libopts/option-xat-attribute.c @@ -1,11 +1,11 @@ /* -*- buffer-read-only: t -*- vi: set ro: - * + * * DO NOT EDIT THIS FILE (stdin.c) - * - * It has been AutoGen-ed January 4, 2013 at 04:15:43 PM by AutoGen 5.17.1pre14 + * + * It has been AutoGen-ed February 21, 2013 at 12:28:31 PM by AutoGen 5.17.2pre16 * From the definitions stdin * and the template file str2enum - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 3. Neither the name ``Bruce Korb'' nor the name of any other * contributor may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * str2enum IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/sntp/libopts/option-xat-attribute.h b/sntp/libopts/option-xat-attribute.h index 11204161a3..b62786e752 100644 --- a/sntp/libopts/option-xat-attribute.h +++ b/sntp/libopts/option-xat-attribute.h @@ -1,11 +1,11 @@ /* -*- buffer-read-only: t -*- vi: set ro: - * + * * DO NOT EDIT THIS FILE (stdin.h) - * - * It has been AutoGen-ed January 4, 2013 at 04:15:43 PM by AutoGen 5.17.1pre14 + * + * It has been AutoGen-ed February 21, 2013 at 12:28:31 PM by AutoGen 5.17.2pre16 * From the definitions stdin * and the template file str2enum - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -17,7 +17,7 @@ * 3. Neither the name ``Bruce Korb'' nor the name of any other * contributor may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * str2enum IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -35,7 +35,9 @@ #ifndef STR2ENUM_OPTION_XAT_ATTRIBUTE_H_GUARD #define STR2ENUM_OPTION_XAT_ATTRIBUTE_H_GUARD 1 #include -#include +#ifndef MISSING_INTTYPES_H +# include +#endif typedef enum { XAT_INVALID_CMD = 0, diff --git a/sntp/libopts/pgusage.c b/sntp/libopts/pgusage.c index 9e923d94b6..3bc7fc31e2 100644 --- a/sntp/libopts/pgusage.c +++ b/sntp/libopts/pgusage.c @@ -4,6 +4,10 @@ * * Automated Options Paged Usage module. * + * @addtogroup autoopts + * @{ + */ +/* * This routine will run run-on options through a pager so the * user may examine, print or edit them at their leisure. * @@ -21,11 +25,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /*=export_func optionPagedUsage @@ -122,7 +126,8 @@ optionPagedUsage(tOptions * opts, tOptDesc * od) #endif } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/proto.h b/sntp/libopts/proto.h index 20fec4bc1f..7e268f8d90 100644 --- a/sntp/libopts/proto.h +++ b/sntp/libopts/proto.h @@ -1,11 +1,17 @@ /* -*- buffer-read-only: t -*- vi: set ro: * * Prototypes for autoopts - * Generated Fri Jan 4 16:15:56 PST 2013 + * Generated Thu Feb 21 12:28:43 PST 2013 */ #ifndef AUTOOPTS_PROTO_H_GUARD #define AUTOOPTS_PROTO_H_GUARD 1 +/* + * Extracted from alias.c + */ +static tSuccess +too_many_occurrences(tOptions * opts, tOptDesc * od); + /* * Extracted from autoopts.c */ @@ -19,7 +25,7 @@ static char * ao_strdup(char const *str); static tSuccess -handle_opt(tOptions * pOpts, tOptState * o_st); +handle_opt(tOptions * opts, tOptState * o_st); static tSuccess next_opt(tOptions * opts, tOptState * o_st); @@ -93,6 +99,15 @@ loadOptionLine( tDirection direction, tOptionLoadMode load_mode ); +/* + * Extracted from makeshell.c + */ +static void +fserr_warn(char const * prog, char const * op, char const * fname); + +static void +fserr_exit(char const * prog, char const * op, char const * fname); + /* * Extracted from nested.c */ @@ -126,4 +141,7 @@ addArgListEntry(void** ppAL, void* entry); static void set_usage_flags(tOptions * opts, char const * flg_txt); +static void +ao_bug(char const * msg); + #endif /* AUTOOPTS_PROTO_H_GUARD */ diff --git a/sntp/libopts/putshell.c b/sntp/libopts/putshell.c index bafd4edd65..d210392946 100644 --- a/sntp/libopts/putshell.c +++ b/sntp/libopts/putshell.c @@ -6,6 +6,10 @@ * structure and print them to standard out in a fashion that * will allow them to be interpreted by the Bourne or Korn shells. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -20,16 +24,23 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ +#define APOSTROPHE '\'' /* = = = START-STATIC-FORWARD = = = */ +static size_t +string_size(char const * scan, size_t nl_len); + +static char const * +print_quoted_apostrophes(char const * str); + static void -print_quot_str(char const * pzStr); +print_quot_str(char const * str); static void print_enumeration(tOptions * pOpts, tOptDesc * pOD); @@ -41,20 +52,179 @@ static void print_stacked_arg(tOptions * pOpts, tOptDesc * pOD); static void -print_reordering(tOptions * pOpts); +print_reordering(tOptions * opts); /* = = = END-STATIC-FORWARD = = = */ -/* - * Make sure embedded single quotes come out okay. The initial quote has - * been emitted and the closing quote will be upon return. +/** + * Count the number of bytes required to represent a string as a + * compilable string. + * + * @param[in] scan the text to be rewritten as a C program text string. + * @param[in] nl_len the number of bytes used for each embedded newline. + * + * @returns the count, including the terminating NUL byte. + */ +static size_t +string_size(char const * scan, size_t nl_len) +{ + /* + * Start by counting the start and end quotes, plus the NUL. + */ + size_t res_ln = 3; + + for (;;) { + char ch = *(scan++); + if ((ch >= ' ') && (ch <= '~')) { + + /* + * a backslash allowance for double quotes and baskslashes + */ + res_ln += ((ch == '"') || (ch == '\\')) ? 2 : 1; + } + + /* + * When not a normal character, then count the characters + * required to represent whatever it is. + */ + else switch (ch) { + case NUL: + return res_ln; + + case NL: + res_ln += nl_len; + break; + + case HT: + case BEL: + case BS: + case FF: + case CR: + case VT: + res_ln += 2; + break; + + default: + res_ln += 4; /* text len for \xNN */ + } + } +} + +/*=export_func optionQuoteString + * private: + * + * what: Print a string as quoted text suitable for a C compiler. + * arg: + char const * + text + a block of text to quote + + * arg: + char const * + nl + line splice text + + * + * ret_type: char const * + * ret_desc: the allocated input string as a quoted string + * + * doc: + * This is for internal use by autogen and autoopts. + * It takes an input string and produces text the C compiler can process + * to produce an exact copy of the original string. + * The caller must deallocate the result. Standard C strings and + * K&R strings are distinguished by the "nl" string. +=*/ +char const * +optionQuoteString(char const * text, char const * nl) +{ + size_t nl_len = strlen(nl); + char * out; + char * res = out = AGALOC(string_size(text, nl_len), "quot str"); + *(out++) = '"'; + + for (;;) { + unsigned char ch = (unsigned char)*text; + if ((ch >= ' ') && (ch <= '~')) { + if ((ch == '"') || (ch == '\\')) + /* + * We must escape these characters in the output string + */ + *(out++) = '\\'; + *(out++) = (char)ch; + + } else switch (ch) { +# define add_esc_ch(_ch) { *(out++) = '\\'; *(out++) = (_ch); } + case BEL: add_esc_ch('a'); break; + case BS: add_esc_ch('b'); break; + case HT: add_esc_ch('t'); break; + case VT: add_esc_ch('v'); break; + case FF: add_esc_ch('f'); break; + case CR: add_esc_ch('r'); break; + + case LF: + /* + * Place contiguous new-lines on a single line. + * The current character is a NL, check the next one. + */ + while (*++text == NL) + add_esc_ch('n'); + + /* + * Insert a splice before starting next line + */ + if (*text != NUL) { + memcpy(out, nl, nl_len); + out += nl_len; + + continue; /* text is already at the next character */ + } + + add_esc_ch('n'); + /* FALLTHROUGH */ + + case NUL: + /* + * End of string. Terminate the quoted output. If necessary, + * deallocate the text string. Return the scan resumption point. + */ + *(out++) = '"'; + *out = NUL; + return res; + + default: + /* + * sprintf is safe here, because we already computed + * the amount of space we will be using. + */ + sprintf(out, MK_STR_OCT_FMT, ch); + out += 4; + } + + text++; +# undef add_esc_ch + } +} + +/** + * Print out escaped apostorophes. + * + * @param[in] str the apostrophies to print + */ +static char const * +print_quoted_apostrophes(char const * str) +{ + while (*str == APOSTROPHE) { + fputs(QUOT_APOS, stdout); + str++; + } + return str; +} + +/** + * Print a single quote (apostrophe quoted) string. + * Other than somersaults for apostrophes, nothing else needs quoting. + * + * @param[in] str the string to print */ static void -print_quot_str(char const * pzStr) +print_quot_str(char const * str) { /* * Handle empty strings to make the rest of the logic simpler. */ - if ((pzStr == NULL) || (*pzStr == NUL)) { + if ((str == NULL) || (*str == NUL)) { fputs(EMPTY_ARG, stdout); return; } @@ -63,46 +233,42 @@ print_quot_str(char const * pzStr) * Emit any single quotes/apostrophes at the start of the string and * bail if that is all we need to do. */ - while (*pzStr == '\'') { - fputs(QUOT_APOS, stdout); - pzStr++; - } - if (*pzStr == NUL) + str = print_quoted_apostrophes(str); + if (*str == NUL) return; /* * Start the single quote string */ - fputc('\'', stdout); + fputc(APOSTROPHE, stdout); for (;;) { - char const * pz = strchr(pzStr, '\''); + char const * pz = strchr(str, APOSTROPHE); if (pz == NULL) break; /* * Emit the string up to the single quote (apostrophe) we just found. */ - (void)fwrite(pzStr, (size_t)(pz - pzStr), (size_t)1, stdout); - fputc('\'', stdout); - pzStr = pz; + (void)fwrite(str, (size_t)(pz - str), (size_t)1, stdout); /* - * Emit an escaped apostrophe for every one we find. - * If that ends the string, do not re-open the single quotes. + * Close the current string, emit the apostrophes and re-open the + * string (IFF there is more text to print). */ - while (*++pzStr == '\'') fputs("\\'", stdout); - if (*pzStr == NUL) + fputc(APOSTROPHE, stdout); + str = print_quoted_apostrophes(pz); + if (*str == NUL) return; - fputc('\'', stdout); + fputc(APOSTROPHE, stdout); } /* * If we broke out of the loop, we must still emit the remaining text * and then close the single quote string. */ - fputs(pzStr, stdout); - fputc('\'', stdout); + fputs(str, stdout); + fputc(APOSTROPHE, stdout); } static void @@ -162,9 +328,9 @@ print_membership(tOptions * pOpts, tOptDesc * pOD) static void print_stacked_arg(tOptions * pOpts, tOptDesc * pOD) { - tArgList* pAL = (tArgList*)pOD->optCookie; - tCC** ppz = pAL->apzArgs; - int ct = pAL->useCt; + tArgList* pAL = (tArgList*)pOD->optCookie; + char const ** ppz = pAL->apzArgs; + int ct = pAL->useCt; printf(zOptCookieCt, pOpts->pzPROGNAME, pOD->pz_NAME, ct); @@ -177,34 +343,24 @@ print_stacked_arg(tOptions * pOpts, tOptDesc * pOD) } } +/** + * emit the arguments as readily parsed text. + * The program options are set by emitting the shell "set" command. + * + * @param[in] opts the program options structure + */ static void -print_reordering(tOptions * pOpts) +print_reordering(tOptions * opts) { - unsigned int optIx; + unsigned int ix; fputs(set_dash, stdout); - for (optIx = pOpts->curOptIdx; - optIx < pOpts->origArgCt; - optIx++) { - - char* pzArg = pOpts->origArgVect[ optIx ]; - - if (strchr(pzArg, '\'') == NULL) - printf(arg_fmt, pzArg); - - else { - fputs(" '", stdout); - for (;;) { - char ch = *(pzArg++); - switch (ch) { - case '\'': fputs(apostrophy, stdout); break; - case NUL: goto arg_done; - default: fputc(ch, stdout); break; - } - } arg_done:; - fputc('\'', stdout); - } + for (ix = opts->curOptIdx; + ix < opts->origArgCt; + ix++) { + fputc(' ', stdout); + print_quot_str(opts->origArgVect[ ix ]); } fputs(init_optct, stdout); } @@ -350,7 +506,8 @@ optionPutShell(tOptions* pOpts) fflush(stdout); } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/reset.c b/sntp/libopts/reset.c index 79967bfddb..2abe7ccf91 100644 --- a/sntp/libopts/reset.c +++ b/sntp/libopts/reset.c @@ -2,6 +2,12 @@ /** * \file reset.c * + * Reset the option state to the compiled state. + * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -16,11 +22,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ static void @@ -65,7 +71,7 @@ optionResetEverything(tOptions * pOpts) * For example, --reset=foo will cause the --foo option to be reset. =*/ void -optionResetOpt( tOptions* pOpts, tOptDesc* pOD ) +optionResetOpt(tOptions * pOpts, tOptDesc * pOD) { static bool reset_active = false; @@ -80,13 +86,11 @@ optionResetOpt( tOptions* pOpts, tOptDesc* pOD ) return; if ( (! HAS_originalOptArgArray(pOpts)) - || (pOpts->originalOptArgCookie == NULL)) { - fputs(zResetNotConfig, stderr); - _exit(EX_SOFTWARE); - } + || (pOpts->originalOptArgCookie == NULL)) + ao_bug(zno_reset); if ((pzArg == NULL) || (*pzArg == NUL)) { - fputs(zNoResetArg, stderr); + fprintf(stderr, zreset_arg, pOpts->pzProgName, pOD->pz_Name); pOpts->pUsageProc(pOpts, EXIT_FAILURE); /* NOTREACHED */ assert(0 == 1); @@ -127,7 +131,8 @@ optionResetOpt( tOptions* pOpts, tOptDesc* pOD ) optionReset(pOpts, opt_state.pOD); reset_active = false; } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/restore.c b/sntp/libopts/restore.c index 2a3d9e1814..09ecb33264 100644 --- a/sntp/libopts/restore.c +++ b/sntp/libopts/restore.c @@ -6,6 +6,10 @@ * and restore it. If saved prior to the initial optionProcess call, * then the initial state will be restored. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -20,11 +24,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /* @@ -98,16 +102,6 @@ optionSaveState(tOptions * pOpts) size_t sz = sizeof(*pOpts) + ((size_t)pOpts->optCt * sizeof(tOptDesc)); p = AGALOC(sz, "saved option state"); - if (p == NULL) { - tCC* pzName = pOpts->pzProgName; - if (pzName == NULL) { - pzName = pOpts->pzPROGNAME; - if (pzName == NULL) - pzName = zNil; - } - fprintf(stderr, zCantSave, pzName, sz); - exit(EXIT_FAILURE); - } pOpts->pSavedState = p; } @@ -140,7 +134,7 @@ optionRestore(tOptions* pOpts) tOptions* p = (tOptions*)pOpts->pSavedState; if (p == NULL) { - tCC* pzName = pOpts->pzProgName; + char const * pzName = pOpts->pzProgName; if (pzName == NULL) { pzName = pOpts->pzPROGNAME; if (pzName == NULL) @@ -218,7 +212,9 @@ optionFree(tOptions* pOpts) goto free_saved_state; } } -/* + +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/save.c b/sntp/libopts/save.c index 471130b0f4..3ae046feaa 100644 --- a/sntp/libopts/save.c +++ b/sntp/libopts/save.c @@ -6,6 +6,10 @@ * store them into an ".rc" file for re-interpretation the next * time the invoking program is run. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -20,22 +24,22 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /* = = = START-STATIC-FORWARD = = = */ static char const * -find_dir_name(tOptions * pOpts, int * p_free); +find_dir_name(tOptions * opts, int * p_free); static char const * -find_file_name(tOptions * pOpts, int * p_free_name); +find_file_name(tOptions * opts, int * p_free_name); static void -prt_entry(FILE * fp, tOptDesc * p, char const * pzLA); +prt_entry(FILE * fp, tOptDesc * od, char const * l_arg); static void prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp); @@ -50,7 +54,7 @@ static void prt_nested(FILE * fp, tOptDesc * p); static FILE * -open_sv_file(tOptions* pOpts); +open_sv_file(tOptions * opts); static void prt_no_arg_opt(FILE * fp, tOptDesc * p, tOptDesc * pOD); @@ -62,22 +66,24 @@ static void prt_enum_arg(FILE * fp, tOptDesc * pOD); static void -prt_set_arg(FILE * fp, tOptDesc * pOD); +prt_set_arg(FILE * fp, tOptDesc * od); static void -prt_file_arg(FILE * fp, tOptDesc * pOD, tOptions* pOpts); +prt_file_arg(FILE * fp, tOptDesc * od, tOptions * opts); /* = = = END-STATIC-FORWARD = = = */ +/** + */ static char const * -find_dir_name(tOptions * pOpts, int * p_free) +find_dir_name(tOptions * opts, int * p_free) { char const * pzDir; - if ( (pOpts->specOptIdx.save_opts == NO_EQUIVALENT) - || (pOpts->specOptIdx.save_opts == 0)) + if ( (opts->specOptIdx.save_opts == NO_EQUIVALENT) + || (opts->specOptIdx.save_opts == 0)) return NULL; - pzDir = pOpts->pOptDesc[ pOpts->specOptIdx.save_opts ].optArg.argString; + pzDir = opts->pOptDesc[ opts->specOptIdx.save_opts ].optArg.argString; if ((pzDir != NULL) && (*pzDir != NUL)) return pzDir; @@ -86,7 +92,7 @@ find_dir_name(tOptions * pOpts, int * p_free) * we can stash the RC (INI) file. */ { - char const * const* papz = pOpts->papzHomeList; + char const * const* papz = opts->papzHomeList; if (papz == NULL) return NULL; @@ -122,7 +128,7 @@ find_dir_name(tOptions * pOpts, int * p_free) } if (pzEnv == NULL) { - fprintf(stderr, SAVE_WARN, pOpts->pzProgName); + fprintf(stderr, zsave_warn, opts->pzProgName); fprintf(stderr, zNotDef, pzDir); return NULL; } @@ -148,14 +154,15 @@ find_dir_name(tOptions * pOpts, int * p_free) } } - +/** + */ static char const * -find_file_name(tOptions * pOpts, int * p_free_name) +find_file_name(tOptions * opts, int * p_free_name) { struct stat stBuf; int free_dir_name = 0; - char const * pzDir = find_dir_name(pOpts, &free_dir_name); + char const * pzDir = find_dir_name(opts, &free_dir_name); if (pzDir == NULL) return NULL; @@ -173,7 +180,7 @@ find_file_name(tOptions * pOpts, int * p_free_name) */ if (errno != ENOENT) { bogus_name: - fprintf(stderr, SAVE_WARN, pOpts->pzProgName); + fprintf(stderr, zsave_warn, opts->pzProgName); fprintf(stderr, zNoStat, errno, strerror(errno), pzDir); if (free_dir_name) AGFREE((void*)pzDir); @@ -206,14 +213,14 @@ find_file_name(tOptions * pOpts, int * p_free_name) * THEN tack on the config file name */ if (S_ISDIR(stBuf.st_mode)) { - size_t sz = strlen(pzDir) + strlen(pOpts->pzRcName) + 2; + size_t sz = strlen(pzDir) + strlen(opts->pzRcName) + 2; { char * pzPath = (char*)AGALOC(sz, "file name"); #ifdef HAVE_SNPRINTF - snprintf(pzPath, sz, "%s/%s", pzDir, pOpts->pzRcName); + snprintf(pzPath, sz, "%s/%s", pzDir, opts->pzRcName); #else - sprintf(pzPath, "%s/%s", pzDir, pOpts->pzRcName); + sprintf(pzPath, "%s/%s", pzDir, opts->pzRcName); #endif if (free_dir_name) AGFREE((void*)pzDir); @@ -227,7 +234,7 @@ find_file_name(tOptions * pOpts, int * p_free_name) */ if (stat(pzDir, &stBuf) != 0) { if (errno != ENOENT) { - fprintf(stderr, SAVE_WARN, pOpts->pzProgName); + fprintf(stderr, zsave_warn, opts->pzProgName); fprintf(stderr, zNoStat, errno, strerror(errno), pzDir); AGFREE((void*)pzDir); @@ -246,8 +253,7 @@ find_file_name(tOptions * pOpts, int * p_free_name) * or will soon be a file. */ if (! S_ISREG(stBuf.st_mode)) { - fprintf(stderr, SAVE_WARN, pOpts->pzProgName); - fprintf(stderr, zNotFile, pzDir); + fprintf(stderr, zsave_warn, opts->pzProgName, pzDir); if (free_dir_name) AGFREE((void*)pzDir); return NULL; @@ -261,9 +267,15 @@ find_file_name(tOptions * pOpts, int * p_free_name) return pzDir; } - +/** + * print one option entry to the save file. + * + * @param[in] fp the file pointer for the save file + * @param[in] od the option descriptor to print + * @param[in] l_arg the last argument for the option + */ static void -prt_entry(FILE * fp, tOptDesc * p, char const * pzLA) +prt_entry(FILE * fp, tOptDesc * od, char const * l_arg) { /* * There is an argument. Pad the name so values line up. @@ -273,10 +285,10 @@ prt_entry(FILE * fp, tOptDesc * p, char const * pzLA) */ { char const * pz; - if (! DISABLED_OPT(p) || (p->optEquivIndex != NO_EQUIVALENT)) - pz = p->pz_Name; + if (! DISABLED_OPT(od) || (od->optEquivIndex != NO_EQUIVALENT)) + pz = od->pz_Name; else - pz = p->pz_DisableName; + pz = od->pz_DisableName; fprintf(fp, "%-18s", pz); } @@ -284,44 +296,45 @@ prt_entry(FILE * fp, tOptDesc * p, char const * pzLA) * IF the option is numeric only, * THEN the char pointer is really the number */ - if (OPTST_GET_ARGTYPE(p->fOptState) == OPARG_TYPE_NUMERIC) - fprintf(fp, " %d\n", (int)(t_word)pzLA); + if (OPTST_GET_ARGTYPE(od->fOptState) == OPARG_TYPE_NUMERIC) + fprintf(fp, " %d\n", (int)(t_word)l_arg); /* * OTHERWISE, FOR each line of the value text, ... */ - else if (pzLA == NULL) + else if (l_arg == NULL) fputc(NL, fp); else { fputc(' ', fp); fputc(' ', fp); for (;;) { - char const * pzNl = strchr(pzLA, NL); + char const * eol = strchr(l_arg, NL); /* * IF this is the last line * THEN bail and print it */ - if (pzNl == NULL) + if (eol == NULL) break; /* * Print the continuation and the text from the current line */ - (void)fwrite(pzLA, (size_t)(pzNl - pzLA), (size_t)1, fp); - pzLA = pzNl+1; /* advance the Last Arg pointer */ + (void)fwrite(l_arg, (size_t)(eol - l_arg), (size_t)1, fp); + l_arg = eol+1; /* advance the Last Arg pointer */ fputs("\\\n", fp); } /* * Terminate the entry */ - fputs(pzLA, fp); + fputs(l_arg, fp); fputc(NL, fp); } } - +/** + */ static void prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp) { @@ -386,7 +399,8 @@ prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp) } } - +/** + */ static void prt_string(FILE * fp, char const * name, char const * pz) { @@ -421,7 +435,8 @@ prt_string(FILE * fp, char const * name, char const * pz) fprintf(fp, END_XML_FMT, name); } - +/** + */ static void prt_val_list(FILE * fp, char const * name, tArgList * al) { @@ -456,7 +471,8 @@ prt_val_list(FILE * fp, char const * name, tArgList * al) fprintf(fp, "\n", name); } - +/** + */ static void prt_nested(FILE * fp, tOptDesc * p) { @@ -492,21 +508,26 @@ prt_nested(FILE * fp, tOptDesc * p) } while (--opt_ct > 0); } - +/** + * open the file for saving option state. + * + * @param[in] opts the program options structure + * @returns the open file pointer. It may be NULL. + */ static FILE * -open_sv_file(tOptions* pOpts) +open_sv_file(tOptions * opts) { FILE * fp; { int free_name = 0; - char const * pzFName = find_file_name(pOpts, &free_name); + char const * pzFName = find_file_name(opts, &free_name); if (pzFName == NULL) return NULL; fp = fopen(pzFName, "w" FOPEN_BINARY_FLAG); if (fp == NULL) { - fprintf(stderr, SAVE_WARN, pOpts->pzProgName); + fprintf(stderr, zsave_warn, opts->pzProgName); fprintf(stderr, zNoCreat, errno, strerror(errno), pzFName); if (free_name) AGFREE((void*) pzFName ); @@ -517,30 +538,33 @@ open_sv_file(tOptions* pOpts) AGFREE((void*)pzFName); } + fputs("# ", fp); { - char const * pz = pOpts->pzUsageTitle; - fputs("# ", fp); - do { fputc(*pz, fp); } while (*(pz++) != NL); + char const * e = strchr(opts->pzUsageTitle, NL); + if (e++ != NULL) + fwrite(opts->pzUsageTitle, 1, e - opts->pzUsageTitle, fp); } { - time_t timeVal = time(NULL); - char * pzTime = ctime(&timeVal); + time_t cur_time = time(NULL); + char * time_str = ctime(&cur_time); - fprintf(fp, zPresetFile, pzTime); + fprintf(fp, zPresetFile, time_str); #ifdef HAVE_ALLOCATED_CTIME /* * The return values for ctime(), localtime(), and gmtime() * normally point to static data that is overwritten by each call. * The test to detect allocated ctime, so we leak the memory. */ - AGFREE((void*)pzTime); + AGFREE((void*)time_str); #endif } return fp; } +/** + */ static void prt_no_arg_opt(FILE * fp, tOptDesc * p, tOptDesc * pOD) { @@ -562,6 +586,8 @@ prt_no_arg_opt(FILE * fp, tOptDesc * p, tOptDesc * pOD) fprintf(fp, "%s\n", pznm); } +/** + */ static void prt_str_arg(FILE * fp, tOptDesc * pOD) { @@ -583,6 +609,8 @@ prt_str_arg(FILE * fp, tOptDesc * pOD) } } +/** + */ static void prt_enum_arg(FILE * fp, tOptDesc * pOD) { @@ -598,56 +626,72 @@ prt_enum_arg(FILE * fp, tOptDesc * pOD) pOD->optArg.argEnum = val; } +/** + * Print the bits set in a bit mask option. + * We call the option handling function with a magic value for + * the options pointer and it allocates and fills in the string. + * We print that with a call to prt_entry(). + * + * @param[in] fp the file pointer to write to + * @param[in] od the option descriptor with a bit mask value type + */ static void -prt_set_arg(FILE * fp, tOptDesc * pOD) +prt_set_arg(FILE * fp, tOptDesc * od) { - uintptr_t val = pOD->optArg.argEnum; + uintptr_t val = od->optArg.argEnum; /* * This is a magic incantation that will convert the * bit flag values back into a string suitable for printing. */ - (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD); - prt_entry(fp, pOD, (void*)(pOD->optArg.argString)); + (*(od->pOptProc))(OPTPROC_RETURN_VALNAME, od); + prt_entry(fp, od, (void*)(od->optArg.argString)); - if (pOD->optArg.argString != NULL) { + if (od->optArg.argString != NULL) { /* * set membership strings get allocated */ - AGFREE((void*)pOD->optArg.argString); - pOD->fOptState &= ~OPTST_ALLOC_ARG; + AGFREE((void*)od->optArg.argString); + od->fOptState &= ~OPTST_ALLOC_ARG; } - pOD->optArg.argEnum = val; + od->optArg.argEnum = val; } +/** + * figure out what the option file name argument is. + * If one can be found, call prt_entry() to emit it. + * + * @param[in] fp the file pointer to write to. + * @param[in] od the option descriptor with a bit mask value type + * @param[in] opts the program options descriptor + */ static void -prt_file_arg(FILE * fp, tOptDesc * pOD, tOptions* pOpts) +prt_file_arg(FILE * fp, tOptDesc * od, tOptions * opts) { /* * If the cookie is not NULL, then it has the file name, period. * Otherwise, if we have a non-NULL string argument, then.... */ - if (pOD->optCookie != NULL) - prt_entry(fp, pOD, pOD->optCookie); + if (od->optCookie != NULL) + prt_entry(fp, od, od->optCookie); - else if (HAS_originalOptArgArray(pOpts)) { + else if (HAS_originalOptArgArray(opts)) { char const * orig = - pOpts->originalOptArgArray[pOD->optIndex].argString; + opts->originalOptArgArray[od->optIndex].argString; - if (pOD->optArg.argString == orig) + if (od->optArg.argString == orig) return; - prt_entry(fp, pOD, pOD->optArg.argString); + prt_entry(fp, od, od->optArg.argString); } } - /*=export_func optionSaveFile * * what: saves the option state to a file * - * arg: tOptions*, pOpts, program options descriptor + * arg: tOptions*, opts, program options descriptor * * doc: * @@ -673,11 +717,11 @@ prt_file_arg(FILE * fp, tOptDesc * pOD, tOptions* pOpts) * will be printed to @code{stderr} and the routine will return. =*/ void -optionSaveFile(tOptions* pOpts) +optionSaveFile(tOptions * opts) { - tOptDesc* pOD; - int ct; - FILE * fp = open_sv_file(pOpts); + tOptDesc * od; + int ct; + FILE * fp = open_sv_file(opts); if (fp == NULL) return; @@ -685,8 +729,8 @@ optionSaveFile(tOptions* pOpts) /* * FOR each of the defined options, ... */ - ct = pOpts->presetOptCt; - pOD = pOpts->pOptDesc; + ct = opts->presetOptCt; + od = opts->pOptDesc; do { tOptDesc * p; @@ -699,14 +743,14 @@ optionSaveFile(tOptions* pOpts) * Equivalenced options get picked up when the equivalenced-to * option is processed. */ - if (UNUSED_OPT(pOD)) + if (UNUSED_OPT(od)) continue; - if ((pOD->fOptState & OPTST_DO_NOT_SAVE_MASK) != 0) + if ((od->fOptState & OPTST_DO_NOT_SAVE_MASK) != 0) continue; - if ( (pOD->optEquivIndex != NO_EQUIVALENT) - && (pOD->optEquivIndex != pOD->optIndex)) + if ( (od->optEquivIndex != NO_EQUIVALENT) + && (od->optEquivIndex != od->optIndex)) continue; /* @@ -714,12 +758,12 @@ optionSaveFile(tOptions* pOpts) * but the actual option argument type comes from the original * option descriptor. Be careful! */ - p = ((pOD->fOptState & OPTST_EQUIVALENCE) != 0) - ? (pOpts->pOptDesc + pOD->optActualIndex) : pOD; + p = ((od->fOptState & OPTST_EQUIVALENCE) != 0) + ? (opts->pOptDesc + od->optActualIndex) : od; - switch (OPTST_GET_ARGTYPE(pOD->fOptState)) { + switch (OPTST_GET_ARGTYPE(od->fOptState)) { case OPARG_TYPE_NONE: - prt_no_arg_opt(fp, p, pOD); + prt_no_arg_opt(fp, p, od); break; case OPARG_TYPE_NUMERIC: @@ -747,17 +791,18 @@ optionSaveFile(tOptions* pOpts) break; case OPARG_TYPE_FILE: - prt_file_arg(fp, p, pOpts); + prt_file_arg(fp, p, opts); break; default: break; /* cannot handle - skip it */ } - } while (pOD++, (--ct > 0)); + } while (od++, (--ct > 0)); fclose(fp); } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/sort.c b/sntp/libopts/sort.c index e5fd661943..0d70e341a1 100644 --- a/sntp/libopts/sort.c +++ b/sntp/libopts/sort.c @@ -4,6 +4,10 @@ * * This module implements argument sorting. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -18,11 +22,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /* = = = START-STATIC-FORWARD = = = */ @@ -326,7 +330,8 @@ optionSort(tOptions * opts) return; } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/stack.c b/sntp/libopts/stack.c index 95c211e7c6..dc73702afd 100644 --- a/sntp/libopts/stack.c +++ b/sntp/libopts/stack.c @@ -5,6 +5,10 @@ * This is a special option processing routine that will save the * argument to an option in a FIFO queue. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -19,11 +23,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ #ifdef WITH_LIBREGEX @@ -129,8 +133,8 @@ optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc) * we are keeping a define. */ for (i = 0, dIdx = 0, ct = pAL->useCt; --ct >= 0; i++) { - tCC* pzSrc = pAL->apzArgs[ i ]; - char* pzEq = strchr(pzSrc, '='); + const char ** pzSrc = pAL->apzArgs[ i ]; + char * pzEq = strchr(pzSrc, '='); if (pzEq != NULL) *pzEq = NUL; @@ -258,7 +262,8 @@ optionStackArg(tOptions * pOpts, tOptDesc * pOD) addArgListEntry(&(pOD->optCookie), (void*)pz); } } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/streqvcmp.c b/sntp/libopts/streqvcmp.c index 425331f1f1..7e6118561a 100644 --- a/sntp/libopts/streqvcmp.c +++ b/sntp/libopts/streqvcmp.c @@ -9,6 +9,10 @@ * the characters "-", "_" and "^" all need to be equivalent * (because they are treated so by different development environments). * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -23,11 +27,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd * * This array is designed for mapping upper and lower case letter * together for a case independent comparison. The mappings are @@ -96,7 +100,7 @@ static unsigned char charmap[] = { * err: none checked. Caller responsible for seg faults. =*/ int -strneqvcmp(tCC* s1, tCC* s2, int ct) +strneqvcmp(char const * s1, char const * s2, int ct) { for (; ct > 0; --ct) { unsigned char u1 = (unsigned char) *s1++; @@ -135,7 +139,7 @@ strneqvcmp(tCC* s1, tCC* s2, int ct) * err: none checked. Caller responsible for seg faults. =*/ int -streqvcmp(tCC* s1, tCC* s2) +streqvcmp(char const * s1, char const * s2) { for (;;) { unsigned char u1 = (unsigned char) *s1++; @@ -155,8 +159,8 @@ streqvcmp(tCC* s1, tCC* s2) * * what: Set the character mappings for the streqv functions * - * arg: + char + From + Input character + - * arg: + char + To + Mapped-to character + + * arg: + char + from + Input character + + * arg: + char + to + Mapped-to character + * arg: + int + ct + compare length + * * doc: @@ -180,7 +184,7 @@ streqvcmp(tCC* s1, tCC* s2) * err: none. =*/ void -streqvmap(char From, char To, int ct) +streqvmap(char from, char to, int ct) { if (ct == 0) { ct = sizeof(charmap) - 1; @@ -190,14 +194,14 @@ streqvmap(char From, char To, int ct) } else { - unsigned int chTo = (int)To & 0xFF; - unsigned int chFrom = (int)From & 0xFF; + unsigned int i_to = (int)to & 0xFF; + unsigned int i_from = (int)from & 0xFF; do { - charmap[chFrom] = (unsigned char)chTo; - chFrom++; - chTo++; - if ((chFrom >= sizeof(charmap)) || (chTo >= sizeof(charmap))) + charmap[i_from] = (unsigned char)i_to; + i_from++; + i_to++; + if ((i_from >= sizeof(charmap)) || (i_to >= sizeof(charmap))) break; } while (--ct > 0); } @@ -256,7 +260,8 @@ strtransform(char* d, char const* s) } while (*(s++) != NUL); } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/text_mmap.c b/sntp/libopts/text_mmap.c index 64b23855f0..8b117c0599 100644 --- a/sntp/libopts/text_mmap.c +++ b/sntp/libopts/text_mmap.c @@ -3,6 +3,10 @@ * * Map a text file, ensuring the text always has an ending NUL byte. * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -17,11 +21,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ #if defined(HAVE_MMAP) # ifndef MAP_ANONYMOUS @@ -95,8 +99,7 @@ load_text_file(tmap_info_t * mapinfo, char const * pzFile) ssize_t rdct = read(mapinfo->txt_fd, pz, sz); if (rdct <= 0) { mapinfo->txt_errno = errno; - fprintf(stderr, zFSErrReadFile, - errno, strerror(errno), pzFile); + fserr_warn("libopts", "read", pzFile); free(mapinfo->txt_data); return; } @@ -359,7 +362,8 @@ text_munmap(tmap_info_t * mi) return mi->txt_errno; } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/time.c b/sntp/libopts/time.c index a45f6158e3..6cf7faad89 100644 --- a/sntp/libopts/time.c +++ b/sntp/libopts/time.c @@ -2,6 +2,10 @@ /** * \file time.c * + * @addtogroup autoopts + * @{ + */ +/* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. * AutoOpts is Copyright (C) 1992-2013 by Bruce Korb - all rights reserved @@ -16,11 +20,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /*=export_func optionTimeVal @@ -132,7 +136,8 @@ optionTimeDate(tOptions * pOpts, tOptDesc * pOD) if (pOD->optArg.argInt != BAD_TIME) pOD->optArg.argInt += (long)time(NULL); } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/tokenize.c b/sntp/libopts/tokenize.c index 8c68e84e3b..15e7cb956f 100644 --- a/sntp/libopts/tokenize.c +++ b/sntp/libopts/tokenize.c @@ -1,3 +1,10 @@ +/** \file tokenize.c + * + * Tokenize a string, accommodating quoted strings. + * + * @addtogroup autoopts + * @{ + */ /* * This file defines the string_tokenize interface * This file is part of AutoOpts, a companion to AutoGen. @@ -14,11 +21,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ #include @@ -322,7 +329,8 @@ main(int argc, char** argv) } #endif -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/usage.c b/sntp/libopts/usage.c index 3f26c05dac..a9a320b2c0 100644 --- a/sntp/libopts/usage.c +++ b/sntp/libopts/usage.c @@ -5,6 +5,10 @@ * This module implements the default usage procedure for * Automated Options. It may be overridden, of course. * + * @addtogroup autoopts + * @{ + */ +/* * Sort options: --start=END-[S]TATIC-FORWARD --patt='^/\*($|[^:])' \ --out=xx.c key='^[a-zA-Z0-9_]+\(' --trail='^/\*:' \ @@ -26,38 +30,74 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ #define OPTPROC_L_N_S (OPTPROC_LONGOPT | OPTPROC_SHORTOPT) +#ifdef HAVE_LIBINTL_H +#include +#endif + +typedef struct { + size_t fnm_len; + uint32_t fnm_mask; + char const * fnm_name; +} ao_flag_names_t; + +/** + * Automated Options Usage Flags. + * NB: no entry may be a prefix of another entry + */ +#define AOFLAG_TABLE \ + _aof_(gnu, OPTPROC_GNUUSAGE ) \ + _aof_(autoopts, ~OPTPROC_GNUUSAGE) \ + _aof_(no_misuse_usage, OPTPROC_MISUSE ) \ + _aof_(misuse_usage, ~OPTPROC_MISUSE ) \ + _aof_(compute, OPTPROC_COMPUTE ) + +#define _aof_(_n, _f) AOUF_ ## _n ## _ID, +typedef enum { AOFLAG_TABLE AOUF_COUNT } ao_flag_id_t; +#undef _aof_ + +#define _aof_(_n, _f) AOUF_ ## _n = (1 << AOUF_ ## _n ## _ID), +typedef enum { AOFLAG_TABLE } ao_flags_t; +#undef _aof_ /* = = = START-STATIC-FORWARD = = = */ +static unsigned int +parse_usage_flags(ao_flag_names_t const * fnt, char const * txt); + static inline bool do_gnu_usage(tOptions * pOpts); static inline bool skip_misuse_usage(tOptions * pOpts); +static void +print_offer_usage(tOptions * opts); + static void print_usage_details(tOptions * opts, int exit_code); static void -prt_conflicts(tOptions * pOptions, tOptDesc * pOD); +print_one_paragraph(char const * text, bool plain, FILE * fp); + +static void +prt_conflicts(tOptions * opts, tOptDesc * od); static void -prt_one_vendor(tOptions * pOptions, tOptDesc * pOD, - arg_types_t * pAT, char const * usefmt); +prt_one_vendor(tOptions * opts, tOptDesc * od, + arg_types_t * argtp, char const * usefmt); static void -prt_vendor_opts(tOptions * pOpts, char const * pOptTitle); +prt_vendor_opts(tOptions * opts, char const * title); static void -prt_extd_usage(tOptions * pOpts, tOptDesc * pOD, - char const * pOptTitle); +prt_extd_usage(tOptions * opts, tOptDesc * od, char const * title); static void prt_ini_list(char const * const * papz, bool * need_intro, @@ -82,94 +122,125 @@ static int setStdOptFmts(tOptions * opts, char const ** ptxt); /* = = = END-STATIC-FORWARD = = = */ -/* - * NB: no entry may be a prefix of another entry +/** + * Parse the option usage flags string. Any parsing problems yield + * a zero (no flags set) result. This function is internal to + * set_usage_flags(). + * + * @param[in] fnt Flag Name Table - maps a name to a mask + * @param[in] txt the text to process. If NULL, then + * getenv("AUTOOPTS_USAGE") is used. + * @returns a bit mask indicating which \a fnt entries were found. */ -#define AOFLAG_TABLE \ - _aof_(gnu, OPTPROC_GNUUSAGE ) \ - _aof_(autoopts, ~OPTPROC_GNUUSAGE) \ - _aof_(no_misuse_usage, OPTPROC_MISUSE ) \ - _aof_(misuse_usage, ~OPTPROC_MISUSE ) - -LOCAL void -set_usage_flags(tOptions * opts, char const * flg_txt) +static unsigned int +parse_usage_flags(ao_flag_names_t const * fnt, char const * txt) { - typedef struct { - size_t fnm_len; - uint32_t fnm_mask; - char const * fnm_name; - } ao_flag_names_t; - -# define _aof_(_n, _f) AOUF_ ## _n ## _ID, - typedef enum { AOFLAG_TABLE AOUF_COUNT } ao_flag_id_t; -# undef _aof_ - -# define _aof_(_n, _f) AOUF_ ## _n = (1 << AOUF_ ## _n ## _ID), - typedef enum { AOFLAG_TABLE } ao_flags_t; -# undef _aof_ - -# define _aof_(_n, _f) { sizeof(#_n)-1, _f, #_n }, - static ao_flag_names_t const fn_table[AOUF_COUNT] = { - AOFLAG_TABLE - }; -# undef _aof_ + unsigned int res = 0; - unsigned int flg = (ao_flags_t)0; - - if (flg_txt == NULL) { - flg_txt = getenv("AUTOOPTS_USAGE"); - if (flg_txt == NULL) return; + /* + * The text may be passed in. If not, use the environment variable. + */ + if (txt == NULL) { + txt = getenv("AUTOOPTS_USAGE"); + if (txt == NULL) + return 0; } - flg_txt = SPN_WHITESPACE_CHARS(flg_txt); - if (*flg_txt == NUL) - return; + txt = SPN_WHITESPACE_CHARS(txt); + if (*txt == NUL) + return 0; + /* + * search the string for table entries. We must understand everything + * we see in the string, or we give up on it. + */ for (;;) { int ix = 0; - ao_flag_names_t const * fnt = fn_table; for (;;) { - if (strneqvcmp(flg_txt, fnt->fnm_name, (int)fnt->fnm_len) == 0) + if (strneqvcmp(txt, fnt[ix].fnm_name, (int)fnt[ix].fnm_len) == 0) break; if (++ix >= AOUF_COUNT) - return; - fnt++; + return 0; } /* * Make sure we have a full match. Look for whitespace, * a comma, or a NUL byte. */ - if (! IS_END_LIST_ENTRY_CHAR(flg_txt[fnt->fnm_len])) - return; + if (! IS_END_LIST_ENTRY_CHAR(txt[fnt[ix].fnm_len])) + return 0; - flg |= 1U << ix; - flg_txt = SPN_WHITESPACE_CHARS(flg_txt + fnt->fnm_len); + res |= 1U << ix; + txt = SPN_WHITESPACE_CHARS(txt + fnt[ix].fnm_len); - if (*flg_txt == NUL) - break; + switch (*txt) { + case NUL: + return res; - if (*flg_txt == ',') { - /* - * skip the comma and following white space - */ - flg_txt = SPN_WHITESPACE_CHARS(flg_txt + 1); - if (*flg_txt == NUL) - break; + case ',': + txt = SPN_WHITESPACE_CHARS(txt + 1); + /* Something must follow the comma */ + + default: + continue; } } +} +/** + * Set option usage flags. Any parsing problems yield no changes to options. + * Three different bits may be fiddled: \a OPTPROC_GNUUSAGE, \a OPTPROC_MISUSE + * and \a OPTPROC_COMPUTE. + * + * @param[in] flg_txt text to parse. If NULL, then the AUTOOPTS_USAGE + * environment variable is parsed. + * @param[in,out] opts the program option descriptor + */ +LOCAL void +set_usage_flags(tOptions * opts, char const * flg_txt) +{ +# define _aof_(_n, _f) { sizeof(#_n)-1, _f, #_n }, + static ao_flag_names_t const fn_table[AOUF_COUNT] = { + AOFLAG_TABLE + }; +# undef _aof_ + + /* + * the flag word holds a bit for each selected table entry. + */ + unsigned int flg = parse_usage_flags(fn_table, flg_txt); + if (flg == 0) return; + + /* + * Ensure we do not have conflicting selections + */ { - ao_flag_names_t const * fnm = fn_table; + static unsigned int const form_mask = + AOUF_gnu | AOUF_autoopts; + static unsigned int const misuse_mask = + AOUF_no_misuse_usage | AOUF_misuse_usage; + if ( ((flg & form_mask) == form_mask) + || ((flg & misuse_mask) == misuse_mask) ) + return; + } - while (flg != 0) { + /* + * Now fiddle the fOptSet bits, based on settings. + * The OPTPROC_LONGOPT bit is immutable, thus if it is set, + * then fnm points to a mask off mask. + */ + { + ao_flag_names_t const * fnm = fn_table; + for (;;) { if ((flg & 1) != 0) { if ((fnm->fnm_mask & OPTPROC_LONGOPT) != 0) opts->fOptSet &= fnm->fnm_mask; else opts->fOptSet |= fnm->fnm_mask; } flg >>= 1; + if (flg == 0) + break; fnm++; } } @@ -228,28 +299,97 @@ optionOnlyUsage(tOptions * pOpts, int ex_code) prt_opt_usage(pOpts, ex_code, pOptTitle); fflush(option_usage_fp); - if (ferror(option_usage_fp) != 0) { - fputs(zOutputFail, stderr); - exit(EXIT_FAILURE); + if (ferror(option_usage_fp) != 0) + fserr_exit(pOpts->pzProgName, zwriting, (option_usage_fp == stderr) + ? zstderr_name : zstdout_name); +} + +LOCAL void +ao_bug(char const * msg) +{ + fprintf(stderr, zao_bug_msg, msg); + exit(EX_SOFTWARE); +} + +/** + * Print a message suggesting how to get help. + * + * @param[in] opts the program options + */ +static void +print_offer_usage(tOptions * opts) +{ + char help[24]; + + if (HAS_opt_usage_t(opts)) { + int ix = opts->presetOptCt; + tOptDesc * od = opts->pOptDesc + ix; + while (od->optUsage != AOUSE_HELP) { + if (++ix >= opts->optCt) + ao_bug(zmissing_help_msg); + od++; + } + switch (opts->fOptSet & (OPTPROC_LONGOPT | OPTPROC_SHORTOPT)) { + case OPTPROC_SHORTOPT: + help[0] = '-'; + help[1] = od->optValue; + help[2] = NUL; + break; + + case OPTPROC_LONGOPT: + case (OPTPROC_LONGOPT | OPTPROC_SHORTOPT): + help[0] = help[1] = '-'; + strncpy(help + 2, od->pz_Name, 20); + break; + + case 0: + strncpy(help, od->pz_Name, 20); + break; + } + + } else { + switch (opts->fOptSet & (OPTPROC_LONGOPT | OPTPROC_SHORTOPT)) { + case OPTPROC_SHORTOPT: + strcpy(help, "-h"); + break; + + case OPTPROC_LONGOPT: + case (OPTPROC_LONGOPT | OPTPROC_SHORTOPT): + strcpy(help, "--help"); + + case 0: + strcpy(help, "help"); + break; + } } + + fprintf(option_usage_fp, zoffer_usage_fmt, opts->pzProgName, help); } +/** + * Print information about each option. + * + * @param[in] opts the program options + * @param[in] exit_code whether or not there was a usage error reported. + * used to select full usage versus abbreviated. + */ static void print_usage_details(tOptions * opts, int exit_code) { { char const * pOptTitle = NULL; + int flen; /* * Determine which header and which option formatting strings to use */ if (do_gnu_usage(opts)) { - int flen = setGnuOptFmts(opts, &pOptTitle); + flen = setGnuOptFmts(opts, &pOptTitle); sprintf(line_fmt_buf, zFmtFmt, flen); fputc(NL, option_usage_fp); } else { - int flen = setStdOptFmts(opts, &pOptTitle); + flen = setStdOptFmts(opts, &pOptTitle); sprintf(line_fmt_buf, zFmtFmt, flen); /* @@ -263,6 +403,9 @@ print_usage_details(tOptions * opts, int exit_code) fputs(pOptTitle, option_usage_fp); } + flen = 4 - ((flen + 15) / 8); + if (flen > 0) + tab_skip_ct = flen; prt_opt_usage(opts, exit_code, pOptTitle); } @@ -303,18 +446,137 @@ print_usage_details(tOptions * opts, int exit_code) fflush(option_usage_fp); - if (ferror(option_usage_fp) != 0) { - fputs(zOutputFail, stderr); - exit(EXIT_FAILURE); + if (ferror(option_usage_fp) != 0) + fserr_exit(opts->pzProgName, zwriting, (option_usage_fp == stderr) + ? zstderr_name : zstdout_name); +} + +static void +print_one_paragraph(char const * text, bool plain, FILE * fp) +{ + if (plain) { +#ifdef HAVE_LIBINTL_H +#undef gettext + char * buf = dgettext("libopts", text); + if (buf == text) + text = gettext(text); +#endif + fputs(text, fp); + } + + else { + text = optionQuoteString(text, LINE_SPLICE); + fprintf(fp, PUTS_FMT, text); + AGFREE(text); } } + +/*=export_func optionPrintParagraphs + * private: + * + * what: Print a paragraph of usage text + * arg: + char const * + text + a block of text that has bee i18n-ed + + * arg: + bool + plain + false -> wrap text in fputs() + + * arg: + FILE * + fp + the stream file pointer for output + + * + * doc: + * This procedure is called in two contexts: when a full or short usage text + * has been provided for display, and when autogen is assembling a list of + * translatable texts in the optmain.tlib template. In the former case, \a + * plain is set to \a true, otherwise \a false. + * + * Anything less than 256 characters in size is printed as a single unit. + * Otherwise, paragraphs are detected. A paragraph break is defined as just + * before a non-empty line preceded by two newlines or a line that starts + * with at least one space character but fewer than 8 space characters. + * Lines indented with tabs or more than 7 spaces are considered continuation + * lines. +=*/ +void +optionPrintParagraphs(char const * text, bool plain, FILE * fp) +{ + size_t len = strlen(text); + char * buf; + if (len < 256) { + print_one_paragraph(text, plain, fp); + return; + } + AGDUPSTR(buf, text, "ppara"); + text = buf; + + for (;;) { + char * scan; + + if (len < 256) { + done: + print_one_paragraph(buf, plain, fp); + break; + } + scan = buf; + + try_longer: + scan = strchr(scan, NL); + if (scan == NULL) + goto done; + + if ((scan - buf) < 40) { + scan++; + goto try_longer; + } + + scan++; + if ((! isspace((int)*scan)) || (*scan == HT)) + /* + * line starts with tab or non-whitespace --> continuation + */ + goto try_longer; + + if (*scan == NL) { + /* + * Double newline -> paragraph break + * Include all newlines in current paragraph. + */ + while (*++scan == NL) /*continue*/; + + } else { + char * p = scan; + int sp_ct = 0; + + while (*p == ' ') { + if (++sp_ct >= 8) { + /* + * Too many spaces --> continuation line + */ + scan = p; + goto try_longer; + } + p++; + } + } + /* + * "scan" points to the first character of a paragraph or the + * terminating NUL byte. + */ + { + char svch = *scan; + *scan = NUL; + print_one_paragraph(buf, plain, fp); + len -= scan - buf; + if (len <= 0) + break; + *scan = svch; + buf = scan; + } + } + AGFREE((void *)text); +} /*=export_func optionUsage * private: * * what: Print usage text - * arg: + tOptions* + pOptions + program options descriptor + + * arg: + tOptions* + opts + program options descriptor + * arg: + int + exitCode + exit code for calling exit(3) + * * doc: @@ -327,12 +589,13 @@ print_usage_details(tOptions * opts, int exit_code) * to stdout and the actual exit code will be "EXIT_SUCCESS". =*/ void -optionUsage(tOptions * pOptions, int usage_exit_code) +optionUsage(tOptions * opts, int usage_exit_code) { int exit_code = (usage_exit_code == AO_EXIT_REQ_USAGE) ? EXIT_SUCCESS : usage_exit_code; displayEnum = false; + set_usage_flags(opts, NULL); /* * Paged usage will preset option_usage_fp to an output file. @@ -346,32 +609,42 @@ optionUsage(tOptions * pOptions, int usage_exit_code) char const * pz; if (exit_code == EXIT_SUCCESS) { - pz = (pOptions->structVersion >= 30 * 4096) - ? pOptions->pzFullUsage : NULL; + pz = (opts->structVersion >= 30 * 4096) + ? opts->pzFullUsage : NULL; if (option_usage_fp == NULL) option_usage_fp = stdout; } else { - pz = (pOptions->structVersion >= 30 * 4096) - ? pOptions->pzShortUsage : NULL; + pz = (opts->structVersion >= 30 * 4096) + ? opts->pzShortUsage : NULL; if (option_usage_fp == NULL) option_usage_fp = stderr; } - if (pz != NULL) { - fputs(pz, option_usage_fp); - exit(exit_code); + if (((opts->fOptSet & OPTPROC_COMPUTE) == 0) && (pz != NULL)) { + if ((opts->fOptSet & OPTPROC_TRANSLATE) != 0) + optionPrintParagraphs(pz, true, option_usage_fp); + else + fputs(pz, option_usage_fp); + goto flush_and_exit; } } - fprintf(option_usage_fp, pOptions->pzUsageTitle, pOptions->pzProgName); - set_usage_flags(pOptions, NULL); + fprintf(option_usage_fp, opts->pzUsageTitle, opts->pzProgName); if ((exit_code == EXIT_SUCCESS) || - (! skip_misuse_usage(pOptions))) + (! skip_misuse_usage(opts))) - print_usage_details(pOptions, usage_exit_code); + print_usage_details(opts, usage_exit_code); + else + print_offer_usage(opts); + + flush_and_exit: + fflush(option_usage_fp); + if (ferror(option_usage_fp) != 0) + fserr_exit(opts->pzProgName, zwriting, (option_usage_fp == stdout) + ? zstdout_name : zstderr_name); exit(exit_code); } @@ -382,62 +655,74 @@ optionUsage(tOptions * pOptions, int usage_exit_code) /** * print option conflicts. * - * @param pOptions the program option descriptor - * @param pOD the option descriptor - * @param pAT names of the option argument types + * @param opts the program option descriptor + * @param od the option descriptor */ static void -prt_conflicts(tOptions * pOptions, tOptDesc * pOD) +prt_conflicts(tOptions * opts, tOptDesc * od) { - - fputs(zTabHyp, option_usage_fp); + const int * opt_no; + fputs(zTabHyp + tab_skip_ct, option_usage_fp); /* * REQUIRED: */ - if (pOD->pOptMust != NULL) { - const int* pOptNo = pOD->pOptMust; + if (od->pOptMust != NULL) { + opt_no = od->pOptMust; - fputs(zReqThese, option_usage_fp); - for (;;) { - fprintf(option_usage_fp, zTabout, - pOptions->pOptDesc[*pOptNo].pz_Name); - if (*++pOptNo == NO_EQUIVALENT) - break; + if (opt_no[1] == NO_EQUIVALENT) { + fprintf(option_usage_fp, zReqOne, + opts->pOptDesc[*opt_no].pz_Name); + } else { + fputs(zReqThese, option_usage_fp); + for (;;) { + fprintf(option_usage_fp, zTabout + tab_skip_ct, + opts->pOptDesc[*opt_no].pz_Name); + if (*++opt_no == NO_EQUIVALENT) + break; + } } - if (pOD->pOptCant != NULL) - fputs(zTabHypAnd, option_usage_fp); + if (od->pOptCant != NULL) + fputs(zTabHypAnd + tab_skip_ct, option_usage_fp); } /* * CONFLICTS: */ - if (pOD->pOptCant != NULL) { - const int* pOptNo = pOD->pOptCant; + if (od->pOptCant == NULL) + return; - fputs(zProhib, option_usage_fp); - for (;;) { - fprintf(option_usage_fp, zTabout, - pOptions->pOptDesc[*pOptNo].pz_Name); - if (*++pOptNo == NO_EQUIVALENT) - break; - } + opt_no = od->pOptCant; + + if (opt_no[1] == NO_EQUIVALENT) { + fprintf(option_usage_fp, zProhibOne, + opts->pOptDesc[*opt_no].pz_Name); + return; + } + + fputs(zProhib, option_usage_fp); + for (;;) { + fprintf(option_usage_fp, zTabout + tab_skip_ct, + opts->pOptDesc[*opt_no].pz_Name); + if (*++opt_no == NO_EQUIVALENT) + break; } } /** * Print the usage information for a single vendor option. * - * @param pOpts the program option descriptor - * @param pOD the option descriptor - * @param pAT names of the option argument types + * @param[in] opts the program option descriptor + * @param[in] od the option descriptor + * @param[in] argtp names of the option argument types + * @param[in] usefmt format for primary usage line */ static void -prt_one_vendor(tOptions * pOptions, tOptDesc * pOD, - arg_types_t * pAT, char const * usefmt) +prt_one_vendor(tOptions * opts, tOptDesc * od, + arg_types_t * argtp, char const * usefmt) { - prt_preamble(pOptions, pOD, pAT); + prt_preamble(opts, od, argtp); { char z[ 80 ]; @@ -448,52 +733,52 @@ prt_one_vendor(tOptions * pOptions, tOptDesc * pOD, * when the option argument is required, base the type string on the * argument type. */ - if (pOD->fOptState & OPTST_ARG_OPTIONAL) { - pzArgType = pAT->pzOpt; - - } else switch (OPTST_GET_ARGTYPE(pOD->fOptState)) { - case OPARG_TYPE_NONE: pzArgType = pAT->pzNo; break; - case OPARG_TYPE_ENUMERATION: pzArgType = pAT->pzKey; break; - case OPARG_TYPE_FILE: pzArgType = pAT->pzFile; break; - case OPARG_TYPE_MEMBERSHIP: pzArgType = pAT->pzKeyL; break; - case OPARG_TYPE_BOOLEAN: pzArgType = pAT->pzBool; break; - case OPARG_TYPE_NUMERIC: pzArgType = pAT->pzNum; break; - case OPARG_TYPE_HIERARCHY: pzArgType = pAT->pzNest; break; - case OPARG_TYPE_STRING: pzArgType = pAT->pzStr; break; - case OPARG_TYPE_TIME: pzArgType = pAT->pzTime; break; + if (od->fOptState & OPTST_ARG_OPTIONAL) { + pzArgType = argtp->pzOpt; + + } else switch (OPTST_GET_ARGTYPE(od->fOptState)) { + case OPARG_TYPE_NONE: pzArgType = argtp->pzNo; break; + case OPARG_TYPE_ENUMERATION: pzArgType = argtp->pzKey; break; + case OPARG_TYPE_FILE: pzArgType = argtp->pzFile; break; + case OPARG_TYPE_MEMBERSHIP: pzArgType = argtp->pzKeyL; break; + case OPARG_TYPE_BOOLEAN: pzArgType = argtp->pzBool; break; + case OPARG_TYPE_NUMERIC: pzArgType = argtp->pzNum; break; + case OPARG_TYPE_HIERARCHY: pzArgType = argtp->pzNest; break; + case OPARG_TYPE_STRING: pzArgType = argtp->pzStr; break; + case OPARG_TYPE_TIME: pzArgType = argtp->pzTime; break; default: goto bogus_desc; } pzArgType = SPN_WHITESPACE_CHARS(pzArgType); if (*pzArgType == NUL) - snprintf(z, sizeof(z), "%s", pOD->pz_Name); + snprintf(z, sizeof(z), "%s", od->pz_Name); else - snprintf(z, sizeof(z), "%s=%s", pOD->pz_Name, pzArgType); - fprintf(option_usage_fp, usefmt, z, pOD->pzText); + snprintf(z, sizeof(z), "%s=%s", od->pz_Name, pzArgType); + fprintf(option_usage_fp, usefmt, z, od->pzText); - switch (OPTST_GET_ARGTYPE(pOD->fOptState)) { + switch (OPTST_GET_ARGTYPE(od->fOptState)) { case OPARG_TYPE_ENUMERATION: case OPARG_TYPE_MEMBERSHIP: - displayEnum = (pOD->pOptProc != NULL) ? true : displayEnum; + displayEnum = (od->pOptProc != NULL) ? true : displayEnum; } } return; bogus_desc: - fprintf(stderr, zInvalOptDesc, pOD->pz_Name); - exit(EX_SOFTWARE); + fprintf(stderr, zbad_od, opts->pzProgName, od->pz_Name); + ao_bug(zbad_arg_type_msg); } /** * Print the long options processed with "-W". These options will be the * ones that do *not* have flag characters. * - * @param pOptions the program option descriptor - * @param pOD the option descriptor + * @param opts the program option descriptor + * @param title the title for the options */ static void -prt_vendor_opts(tOptions * pOpts, char const * pOptTitle) +prt_vendor_opts(tOptions * opts, char const * title) { static unsigned int const not_vended_mask = OPTST_NO_USAGE_MASK | OPTST_DOCUMENT; @@ -505,51 +790,57 @@ prt_vendor_opts(tOptions * pOpts, char const * pOptTitle) * Only handle client specified options. The "vendor option" follows * "presetOptCt", so we won't loop/recurse indefinitely. */ - int ct = pOpts->presetOptCt; - tOptDesc * pOD = pOpts->pOptDesc; - size_t nmlen = 0; + int ct = opts->presetOptCt; + tOptDesc * od = opts->pOptDesc; + fprintf(option_usage_fp, zTabout + tab_skip_ct, zVendOptsAre); - fprintf(option_usage_fp, zTabout, zVendOptsAre); + { + size_t nmlen = 0; + do { + size_t l; + if ( ((od->fOptState & not_vended_mask) != 0) + || IS_GRAPHIC_CHAR(od->optValue)) + continue; - do { - size_t l; - if ( ((pOD->fOptState & not_vended_mask) != 0) - || IS_GRAPHIC_CHAR(pOD->optValue)) - continue; + l = strlen(od->pz_Name); + if (l > nmlen) nmlen = l; + } while (od++, (--ct > 0)); - l = strlen(pOD->pz_Name); - if (l > nmlen) nmlen = l; - } while (pOD++, (--ct > 0)); + snprintf(vfmt, sizeof(vfmt), vfmtfmt, (unsigned int)nmlen + 4); + } - sprintf(vfmt, vfmtfmt, (unsigned int)nmlen + 4); - ct = pOpts->presetOptCt; - pOD = pOpts->pOptDesc; + if (tab_skip_ct > 0) + tab_skip_ct--; + + ct = opts->presetOptCt; + od = opts->pOptDesc; do { - if ( ((pOD->fOptState & not_vended_mask) != 0) - || IS_GRAPHIC_CHAR(pOD->optValue)) + if ( ((od->fOptState & not_vended_mask) != 0) + || IS_GRAPHIC_CHAR(od->optValue)) continue; - prt_one_vendor(pOpts, pOD, &argTypes, vfmt); - prt_extd_usage(pOpts, pOD, pOptTitle); + prt_one_vendor(opts, od, &argTypes, vfmt); + prt_extd_usage(opts, od, title); + + } while (od++, (--ct > 0)); - } while (pOD++, (--ct > 0)); + /* no need to restore "tab_skip_ct" - options are done now */ } /** * Print extended usage. Usage/help was requested. * - * @param pOptions the program option descriptor - * @param pOD the option descriptor - * @param pAT names of the option argument types + * @param opts the program option descriptor + * @param od the option descriptor + * @param title the title for the options */ static void -prt_extd_usage(tOptions * pOpts, tOptDesc * pOD, - char const * pOptTitle) +prt_extd_usage(tOptions * opts, tOptDesc * od, char const * title) { - if ( ((pOpts->fOptSet & OPTPROC_VENDOR_OPT) != 0) - && (pOD->optActualValue == VENDOR_OPTION_VALUE)) { - prt_vendor_opts(pOpts, pOptTitle); + if ( ((opts->fOptSet & OPTPROC_VENDOR_OPT) != 0) + && (od->optActualValue == VENDOR_OPTION_VALUE)) { + prt_vendor_opts(opts, title); return; } @@ -557,34 +848,33 @@ prt_extd_usage(tOptions * pOpts, tOptDesc * pOD, * IF there are option conflicts or dependencies, * THEN print them here. */ - if ( (pOD->pOptMust != NULL) - || (pOD->pOptCant != NULL) ) - prt_conflicts(pOpts, pOD); + if ((od->pOptMust != NULL) || (od->pOptCant != NULL)) + prt_conflicts(opts, od); /* * IF there is a disablement string * THEN print the disablement info */ - if (pOD->pz_DisableName != NULL ) - fprintf(option_usage_fp, zDis, pOD->pz_DisableName); + if (od->pz_DisableName != NULL ) + fprintf(option_usage_fp, zDis + tab_skip_ct, od->pz_DisableName); /* * Check for argument types that have callbacks with magical properties */ - switch (OPTST_GET_ARGTYPE(pOD->fOptState)) { + switch (OPTST_GET_ARGTYPE(od->fOptState)) { case OPARG_TYPE_NUMERIC: /* * IF the numeric option has a special callback, * THEN call it, requesting the range or other special info */ - if ( (pOD->pOptProc != NULL) - && (pOD->pOptProc != optionNumericVal) ) { - (*(pOD->pOptProc))(OPTPROC_EMIT_USAGE, pOD); + if ( (od->pOptProc != NULL) + && (od->pOptProc != optionNumericVal) ) { + (*(od->pOptProc))(OPTPROC_EMIT_USAGE, od); } break; case OPARG_TYPE_FILE: - (*(pOD->pOptProc))(OPTPROC_EMIT_USAGE, pOD); + (*(od->pOptProc))(OPTPROC_EMIT_USAGE, od); break; } @@ -592,18 +882,18 @@ prt_extd_usage(tOptions * pOpts, tOptDesc * pOD, * IF the option defaults to being enabled, * THEN print that out */ - if (pOD->fOptState & OPTST_INITENABLED) - fputs(zEnab, option_usage_fp); + if (od->fOptState & OPTST_INITENABLED) + fputs(zEnab + tab_skip_ct, option_usage_fp); /* * IF the option is in an equivalence class * AND not the designated lead * THEN print equivalence and leave it at that. */ - if ( (pOD->optEquivIndex != NO_EQUIVALENT) - && (pOD->optEquivIndex != pOD->optActualIndex ) ) { - fprintf(option_usage_fp, zAlt, - pOpts->pOptDesc[ pOD->optEquivIndex ].pz_Name); + if ( (od->optEquivIndex != NO_EQUIVALENT) + && (od->optEquivIndex != od->optActualIndex ) ) { + fprintf(option_usage_fp, zalt_opt + tab_skip_ct, + opts->pOptDesc[ od->optEquivIndex ].pz_Name); return; } @@ -613,32 +903,33 @@ prt_extd_usage(tOptions * pOpts, tOptDesc * pOD, * AND it is not an auto-managed option (e.g. --help, et al.) * THEN advise that this option may not be preset. */ - if ( ((pOD->fOptState & OPTST_NO_INIT) != 0) - && ( (pOpts->papzHomeList != NULL) - || (pOpts->pzPROGNAME != NULL) + if ( ((od->fOptState & OPTST_NO_INIT) != 0) + && ( (opts->papzHomeList != NULL) + || (opts->pzPROGNAME != NULL) ) - && (pOD->optIndex < pOpts->presetOptCt) + && (od->optIndex < opts->presetOptCt) ) - fputs(zNoPreset, option_usage_fp); + fputs(zNoPreset + tab_skip_ct, option_usage_fp); /* * Print the appearance requirements. */ - if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_MEMBERSHIP) - fputs(zMembers, option_usage_fp); + if (OPTST_GET_ARGTYPE(od->fOptState) == OPARG_TYPE_MEMBERSHIP) + fputs(zMembers + tab_skip_ct, option_usage_fp); - else switch (pOD->optMinCt) { + else switch (od->optMinCt) { case 1: case 0: - switch (pOD->optMaxCt) { - case 0: fputs(zPreset, option_usage_fp); break; - case NOLIMIT: fputs(zNoLim, option_usage_fp); break; + switch (od->optMaxCt) { + case 0: fputs(zPreset + tab_skip_ct, option_usage_fp); break; + case NOLIMIT: fputs(zNoLim + tab_skip_ct, option_usage_fp); break; case 1: break; /* * IF the max is more than one but limited, print "UP TO" message */ - default: fprintf(option_usage_fp, zUpTo, pOD->optMaxCt); break; + default: + fprintf(option_usage_fp, zUpTo + tab_skip_ct, od->optMaxCt); break; } break; @@ -646,12 +937,13 @@ prt_extd_usage(tOptions * pOpts, tOptDesc * pOD, /* * More than one is required. Print the range. */ - fprintf(option_usage_fp, zMust, pOD->optMinCt, pOD->optMaxCt); + fprintf(option_usage_fp, zMust + tab_skip_ct, + od->optMinCt, od->optMaxCt); } - if ( NAMED_OPTS(pOpts) - && (pOpts->specOptIdx.default_opt == pOD->optIndex)) - fputs(zDefaultOpt, option_usage_fp); + if ( NAMED_OPTS(opts) + && (opts->specOptIdx.default_opt == od->optIndex)) + fputs(zDefaultOpt + tab_skip_ct, option_usage_fp); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -802,7 +1094,7 @@ prt_one_usage(tOptions * opts, tOptDesc * od, arg_types_t * at) return; bogus_desc: - fprintf(stderr, zInvalOptDesc, od->pz_Name); + fprintf(stderr, zbad_od, opts->pzProgName, od->pz_Name); exit(EX_SOFTWARE); } @@ -1048,8 +1340,8 @@ setStdOptFmts(tOptions * opts, char const ** ptxt) return flen; } - -/*: +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup" diff --git a/sntp/libopts/version.c b/sntp/libopts/version.c index d0c4942bcd..8f2b1db322 100644 --- a/sntp/libopts/version.c +++ b/sntp/libopts/version.c @@ -1,9 +1,12 @@ -/* +/** \file version.c + * * This module implements the default usage procedure for * Automated Options. It may be overridden, of course. + * + * @addtogroup autoopts + * @{ */ - /* * This file is part of AutoOpts, a companion to AutoGen. * AutoOpts is free software. @@ -19,11 +22,11 @@ * The Modified Berkeley Software Distribution License * See the file "COPYING.mbsd" * - * These files have the following md5sums: + * These files have the following sha256 sums: * - * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3 - * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3 - * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd + * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3 + * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3 + * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd */ /*=export_func optionVersion @@ -42,90 +45,95 @@ optionVersion(void) return ver; } +static void +emit_first_line( + FILE * fp, char const * alt1, char const * alt2, char const * alt3) +{ + char const * p = (alt1 != NULL) ? alt1 : ((alt2 != NULL) ? alt2 : alt3); + char const * e; + if (p == NULL) + return; + e = strchr(p, NL); + if (e == NULL) + fputs(p, fp); + else + fwrite(p, 1, (e - p), fp); + fputc(NL, fp); +} + /** * Select among various ways to emit version information. * - * @param opts the option descriptor - * @param fp the output stream + * @param[in] o the option descriptor + * @param[in] fp the output stream */ static void -emit_simple_ver(tOptions * opts, FILE * fp) +emit_simple_ver(tOptions * o, FILE * fp) { - /* - * Use the supplied string - */ - if (opts->pzFullVersion != NULL) - fputs(opts->pzFullVersion, fp); - - /* - * Extract the interesting part of the copyright string - */ - else if (opts->pzCopyright != NULL) { - char const * pe = strchr(opts->pzCopyright, NL); - if (pe == NULL) - pe = opts->pzCopyright + strlen(opts->pzCopyright); - fwrite(opts->pzCopyright, 1, (size_t)(pe - opts->pzCopyright), fp); - } - - /* - * Extract the interesting part of the usage title string - */ - else { - char const * pe = strchr(opts->pzUsageTitle, NL); - if (pe == NULL) - pe = opts->pzUsageTitle + strlen(opts->pzUsageTitle); - fwrite(opts->pzUsageTitle, 1, (size_t)(pe - opts->pzUsageTitle), fp); - } - fputc(NL, fp); + emit_first_line(fp, o->pzFullVersion, o->pzCopyright, o->pzUsageTitle); } +/** + * print the version with a copyright notice. + * + * @param[in] o the option descriptor + * @param[in] fp the output stream + */ static void -emit_copy_ver(tOptions * opts, FILE * fp) +emit_copy_full(tOptions * o, FILE * fp) { - if (opts->pzCopyright != NULL) - fputs(opts->pzCopyright, fp); + if (o->pzCopyright != NULL) + fputs(o->pzCopyright, fp); - else if (opts->pzFullVersion != NULL) - fputs(opts->pzFullVersion, fp); + else if (o->pzFullVersion != NULL) + fputs(o->pzFullVersion, fp); - else { - char const * pe = strchr(opts->pzUsageTitle, NL); - if (pe == NULL) - pe = opts->pzUsageTitle + strlen(opts->pzUsageTitle); - fwrite(opts->pzUsageTitle, 1, (size_t)(pe - opts->pzCopyright), fp); - } - - fputc(NL, fp); - - if (HAS_pzPkgDataDir(opts) && (opts->pzPackager != NULL)) - fputs(opts->pzPackager, fp); + else + emit_first_line(fp, o->pzUsageTitle, NULL, NULL); + + if (HAS_pzPkgDataDir(o) && (o->pzPackager != NULL)) { + fputc(NL, fp); + fputs(o->pzPackager, fp); - else if (opts->pzBugAddr != NULL) - fprintf(fp, zPlsSendBugs, opts->pzBugAddr); + } else if (o->pzBugAddr != NULL) { + fputc(NL, fp); + fprintf(fp, zPlsSendBugs, o->pzBugAddr); + } } +/** + * print the version and any copyright notice. + * The version with a full copyright and additional notes. + * + * @param[in] opts the option descriptor + * @param[in] fp the output stream + */ static void emit_copy_note(tOptions * opts, FILE * fp) { - if (opts->pzCopyright != NULL) { + if (opts->pzCopyright != NULL) fputs(opts->pzCopyright, fp); - fputc(NL, fp); - } - if (opts->pzCopyNotice != NULL) { + if (opts->pzCopyNotice != NULL) fputs(opts->pzCopyNotice, fp); - fputc(NL, fp); - } - fprintf(fp, zAO_Ver, optionVersion()); - - if (HAS_pzPkgDataDir(opts) && (opts->pzPackager != NULL)) + fputc(NL, fp); + fprintf(fp, zao_ver_fmt, optionVersion()); + + if (HAS_pzPkgDataDir(opts) && (opts->pzPackager != NULL)) { + fputc(NL, fp); fputs(opts->pzPackager, fp); - else if (opts->pzBugAddr != NULL) + } else if (opts->pzBugAddr != NULL) { + fputc(NL, fp); fprintf(fp, zPlsSendBugs, opts->pzBugAddr); + } } +/** + * Handle the version printing. We must see how much information + * is being requested and select the correct printing routine. + */ static void print_ver(tOptions * opts, tOptDesc * od, FILE * fp) { @@ -153,7 +161,7 @@ print_ver(tOptions * opts, tOptDesc * od, FILE * fp) switch (ch) { case NUL: /* arg provided, but empty */ case 'v': case 'V': emit_simple_ver(opts, fp); break; - case 'c': case 'C': emit_copy_ver( opts, fp); break; + case 'c': case 'C': emit_copy_full( opts, fp); break; case 'n': case 'N': emit_copy_note( opts, fp); break; default: @@ -162,10 +170,10 @@ print_ver(tOptions * opts, tOptDesc * od, FILE * fp) } fflush(fp); - if (ferror(fp) != 0) { - fputs(zOutputFail, stderr); - exit(EXIT_FAILURE); - } + if (ferror(fp)) + fserr_exit(opts->pzProgName, zwriting, + (fp == stdout) ? zstdout_name : zstderr_name); + exit(EXIT_SUCCESS); } @@ -201,7 +209,8 @@ optionVersionStderr(tOptions * opts, tOptDesc * od) print_ver(opts, od, stderr); } -/* +/** @} + * * Local Variables: * mode: C * c-file-style: "stroustrup"