1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A more useful interface to strtol.
5 Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2011 Free Software
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
30 #define N_(msgid) msgid
32 /* Report an error for an invalid integer in an option argument.
34 ERR is the error code returned by one of the xstrto* functions.
36 Use OPT_IDX to decide whether to print the short option string "C"
37 or "-C" or a long option string derived from LONG_OPTION. OPT_IDX
38 is -2 if the short option "C" was used, without any leading "-"; it
39 is -1 if the short option "-C" was used; otherwise it is an index
40 into LONG_OPTIONS, which should have a name preceded by two '-'
43 ARG is the option-argument containing the integer.
45 After reporting an error, exit with status EXIT_STATUS if it is
49 xstrtol_error (enum strtol_error err,
50 int opt_idx, char c, struct option const *long_options,
54 char const *hyphens = "--";
57 char option_buffer[2];
65 msgid = N_("invalid %s%s argument `%s'");
68 case LONGINT_INVALID_SUFFIX_CHAR:
69 case LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW:
70 msgid = N_("invalid suffix in %s%s argument `%s'");
73 case LONGINT_OVERFLOW:
74 msgid = N_("%s%s argument `%s' too large");
82 option_buffer[1] = '\0';
83 option = option_buffer;
86 option = long_options[opt_idx].name;
88 error (exit_status, 0, gettext (msgid), hyphens, option, arg);
91 /* Like xstrtol_error, except exit with a failure status. */
94 xstrtol_fatal (enum strtol_error err,
95 int opt_idx, char c, struct option const *long_options,
98 xstrtol_error (err, opt_idx, c, long_options, arg, exit_failure);