5 * Id: 63d3312044fd7854ad0995faea41c96f5185cb93
6 * Time-stamp: "2008-11-16 14:51:48 bkorb"
8 * This file is part of AutoOpts, a companion to AutoGen.
9 * AutoOpts is free software.
10 * AutoOpts is copyright (c) 1992-2009 by Bruce Korb - all rights reserved
12 * AutoOpts is available under any one of two licenses. The license
13 * in use must be one of these two and the choice is under the control
14 * of the user of the license.
16 * The GNU Lesser General Public License, version 3 or later
17 * See the files "COPYING.lgplv3" and "COPYING.gplv3"
19 * The Modified Berkeley Software Distribution License
20 * See the file "COPYING.mbsd"
22 * These files have the following md5sums:
24 * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
25 * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
26 * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
29 #ifndef HAVE_PARSE_DURATION
33 ao_xstrdup(char const * pz
)
36 AGDUPSTR(str
, pz
, "time val str");
40 #define xstrdup(_s) ao_xstrdup(_s)
42 #include "parse-duration.c"
47 /*=export_func optionTimeVal
50 * what: process an option with a time value.
51 * arg: + tOptions* + pOpts + program options descriptor +
52 * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
55 * Decipher a time duration value.
58 optionTimeVal(tOptions
* pOpts
, tOptDesc
* pOD
)
62 if ((pOD
->fOptState
& OPTST_RESET
) != 0)
65 val
= parse_duration(pOD
->optArg
.argString
);
69 if (pOD
->fOptState
& OPTST_ALLOC_ARG
) {
70 AGFREE(pOD
->optArg
.argString
);
71 pOD
->fOptState
&= ~OPTST_ALLOC_ARG
;
74 pOD
->optArg
.argInt
= val
;
78 fprintf( stderr
, zNotNumber
, pOpts
->pzProgName
, pOD
->optArg
.argString
);
79 if ((pOpts
->fOptSet
& OPTPROC_ERRSTOP
) != 0)
80 (*(pOpts
->pUsageProc
))(pOpts
, EXIT_FAILURE
);
82 pOD
->optArg
.argInt
= ~0;
87 * c-file-style: "stroustrup"
88 * indent-tabs-mode: nil
90 * end of autoopts/numeric.c */