summaryrefslogtreecommitdiff
path: root/src/pr.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2007-08-04 13:36:59 +0200
committerJim Meyering <jim@meyering.net>2007-08-04 13:36:59 +0200
commit8188c3b48ded8b53d88440f0736690d2e30508ed (patch)
treeb36bbe8ed28eaa4dc37c9876cc5f71a520bb9fdd /src/pr.c
parent33f95a9ab62968a6b13eb1a6a71f180f61721f71 (diff)
downloadcoreutils-8188c3b48ded8b53d88440f0736690d2e30508ed.tar.xz
Adapt to new human and xstrtol API.
* src/df.c (long_options): Prepend "--" to long options that OPT_STR might decode. * src/du.c (long_options): Likewise. * src/od.c (long_options): Likewise. * src/sort.c (long_options): Likewise. * src/df.c (main): Adjust to new human and xstrtol API. * src/du.c (main): Likewise. * src/ls.c (decode_switches): Likewise. * src/od.c (main): Likewise. * src/pr.c (first_last_page): Likewise. New argument OPTION. All callers changed. * src/sort.c (specify_sort_size): New arg OPTION. All callers changed. Adjust to new xstrtol API. * src/system.h (opt_str_storage): New static var. (OPT_STR, LONG_OPT_STR, OPT_STR_INIT): New macros.
Diffstat (limited to 'src/pr.c')
-rw-r--r--src/pr.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pr.c b/src/pr.c
index f7ae01512..329183b99 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -796,14 +796,14 @@ cols_ready_to_print (void)
using option +FIRST_PAGE:LAST_PAGE */
static bool
-first_last_page (char const *pages)
+first_last_page (char const *option, char const *pages)
{
char *p;
uintmax_t first;
uintmax_t last = UINTMAX_MAX;
strtol_error err = xstrtoumax (pages, &p, 10, &first, "");
if (err != LONGINT_OK && err != LONGINT_INVALID_SUFFIX_CHAR)
- _STRTOL_ERROR (EXIT_FAILURE, pages, _("page range"), err);
+ STRTOL_FATAL_ERROR (option, pages, err);
if (p == pages || !first)
return false;
@@ -813,7 +813,7 @@ first_last_page (char const *pages)
char const *p1 = p + 1;
err = xstrtoumax (p1, &p, 10, &last, "");
if (err != LONGINT_OK)
- _STRTOL_ERROR (EXIT_FAILURE, pages, _("page range"), err);
+ STRTOL_FATAL_ERROR (option, pages, err);
if (p1 == p || last < first)
return false;
}
@@ -902,7 +902,7 @@ main (int argc, char **argv)
case 1: /* Non-option argument. */
/* long option --page dominates old `+FIRST_PAGE ...'. */
if (! (first_page_number == 0
- && *optarg == '+' && first_last_page (optarg + 1)))
+ && *optarg == '+' && first_last_page ("+", optarg + 1)))
file_names[n_files++] = optarg;
break;
@@ -911,7 +911,7 @@ main (int argc, char **argv)
if (! optarg)
error (EXIT_FAILURE, 0,
_("`--pages=FIRST_PAGE[:LAST_PAGE]' missing argument"));
- else if (! first_last_page (optarg))
+ else if (! first_last_page ("--pages", optarg))
error (EXIT_FAILURE, 0, _("Invalid page range %s"),
quote (optarg));
break;