3
* $Id: numeric.c,v 4.11 2007/02/04 17:44:12 bkorb Exp $
4
* Time-stamp: "2007-01-13 10:28:20 bkorb"
8
* Automated Options copyright 1992-2007 Bruce Korb
10
* Automated Options is free software.
11
* You may redistribute it and/or modify it under the terms of the
12
* GNU General Public License, as published by the Free Software
13
* Foundation; either version 2, or (at your option) any later version.
15
* Automated Options is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with Automated Options. See the file "COPYING". If not,
22
* write to: The Free Software Foundation, Inc.,
23
* 51 Franklin Street, Fifth Floor,
24
* Boston, MA 02110-1301, USA.
26
* As a special exception, Bruce Korb gives permission for additional
27
* uses of the text contained in his release of AutoOpts.
29
* The exception is that, if you link the AutoOpts library with other
30
* files to produce an executable, this does not by itself cause the
31
* resulting executable to be covered by the GNU General Public License.
32
* Your use of that executable is in no way restricted on account of
33
* linking the AutoOpts library code into it.
35
* This exception does not however invalidate any other reasons why
36
* the executable file might be covered by the GNU General Public License.
38
* This exception applies only to the code released by Bruce Korb under
39
* the name AutoOpts. If you copy code from other sources under the
40
* General Public License into a copy of AutoOpts, as the General Public
41
* License permits, the exception does not apply to the code that you add
42
* in this way. To avoid misleading anyone as to the status of such
43
* modified files, you must delete this exception notice from them.
45
* If you write modifications of your own for AutoOpts, it is your choice
46
* whether to permit this exception to apply to your modifications.
47
* If you do not wish that, delete this exception notice.
50
/*=export_func optionNumericVal
53
* what: Decipher a boolean value
54
* arg: + tOptions* + pOpts + program options descriptor +
55
* arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
58
* Decipher a numeric value.
61
optionNumericVal( tOptions* pOpts, tOptDesc* pOD )
67
* Numeric options may have a range associated with it.
68
* If it does, the usage procedure requests that it be
69
* emitted by passing a NULL pOD pointer.
71
if ((pOD == NULL) || (pOD->optArg.argString == NULL))
74
val = strtol( pOD->optArg.argString, &pz, 0 );
76
fprintf( stderr, zNotNumber, pOpts->pzProgName, pOD->optArg.argString );
77
(*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE);
80
if (pOD->fOptState & OPTST_ALLOC_ARG) {
81
AGFREE(pOD->optArg.argString);
82
pOD->fOptState &= ~OPTST_ALLOC_ARG;
85
pOD->optArg.argInt = val;
90
* c-file-style: "stroustrup"
91
* indent-tabs-mode: nil
93
* end of autoopts/numeric.c */