5 * Id: 329b43154b88d78564d8f960a00a83ec7d8baee0
6 * Time-stamp: "2008-08-03 13:06:02 bkorb"
8 * Automated Options Paged Usage module.
10 * This routine will run run-on options through a pager so the
11 * user may examine, print or edit them at their leisure.
13 * This file is part of AutoOpts, a companion to AutoGen.
14 * AutoOpts is free software.
15 * AutoOpts is copyright (c) 1992-2009 by Bruce Korb - all rights reserved
17 * AutoOpts is available under any one of two licenses. The license
18 * in use must be one of these two and the choice is under the control
19 * of the user of the license.
21 * The GNU Lesser General Public License, version 3 or later
22 * See the files "COPYING.lgplv3" and "COPYING.gplv3"
24 * The Modified Berkeley Software Distribution License
25 * See the file "COPYING.mbsd"
27 * These files have the following md5sums:
29 * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
30 * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
31 * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
34 /*=export_func optionBooleanVal
37 * what: Decipher a boolean value
38 * arg: + tOptions* + pOpts + program options descriptor +
39 * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
42 * Decipher a true or false value for a boolean valued option argument.
43 * The value is true, unless it starts with 'n' or 'f' or "#f" or
44 * it is an empty string or it is a number that evaluates to zero.
47 optionBooleanVal( tOptions
* pOpts
, tOptDesc
* pOD
)
50 ag_bool res
= AG_TRUE
;
52 if ((pOD
->fOptState
& OPTST_RESET
) != 0)
55 if (pOD
->optArg
.argString
== NULL
) {
56 pOD
->optArg
.argBool
= AG_FALSE
;
60 switch (*(pOD
->optArg
.argString
)) {
63 long val
= strtol( pOD
->optArg
.argString
, &pz
, 0 );
64 if ((val
!= 0) || (*pz
!= NUL
))
76 if (pOD
->optArg
.argString
[1] != 'f')
81 if (pOD
->fOptState
& OPTST_ALLOC_ARG
) {
82 AGFREE(pOD
->optArg
.argString
);
83 pOD
->fOptState
&= ~OPTST_ALLOC_ARG
;
85 pOD
->optArg
.argBool
= res
;
90 * c-file-style: "stroustrup"
91 * indent-tabs-mode: nil
93 * end of autoopts/boolean.c */