5 * Time-stamp: "2012-03-31 13:46:19 bkorb"
7 * Automated Options Paged Usage module.
9 * This routine will run run-on options through a pager so the
10 * user may examine, print or edit them at their leisure.
12 * This file is part of AutoOpts, a companion to AutoGen.
13 * AutoOpts is free software.
14 * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
16 * AutoOpts is available under any one of two licenses. The license
17 * in use must be one of these two and the choice is under the control
18 * of the user of the license.
20 * The GNU Lesser General Public License, version 3 or later
21 * See the files "COPYING.lgplv3" and "COPYING.gplv3"
23 * The Modified Berkeley Software Distribution License
24 * See the file "COPYING.mbsd"
26 * These files have the following md5sums:
28 * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
29 * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
30 * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
33 /*=export_func optionBooleanVal
36 * what: Decipher a boolean value
37 * arg: + tOptions* + pOpts + program options descriptor +
38 * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
41 * Decipher a true or false value for a boolean valued option argument.
42 * The value is true, unless it starts with 'n' or 'f' or "#f" or
43 * it is an empty string or it is a number that evaluates to zero.
46 optionBooleanVal(tOptions
* pOpts
, tOptDesc
* pOD
)
53 if ((pOD
->fOptState
& OPTST_RESET
) != 0)
56 if (pOD
->optArg
.argString
== NULL
) {
57 pOD
->optArg
.argBool
= false;
61 switch (*(pOD
->optArg
.argString
)) {
64 long val
= strtol( pOD
->optArg
.argString
, &pz
, 0 );
65 if ((val
!= 0) || (*pz
!= NUL
))
77 if (pOD
->optArg
.argString
[1] != 'f')
82 if (pOD
->fOptState
& OPTST_ALLOC_ARG
) {
83 AGFREE(pOD
->optArg
.argString
);
84 pOD
->fOptState
&= ~OPTST_ALLOC_ARG
;
86 pOD
->optArg
.argBool
= res
;
91 * c-file-style: "stroustrup"
92 * indent-tabs-mode: nil
94 * end of autoopts/boolean.c */