diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2007-08-04 13:36:59 +0200 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2007-08-04 13:36:59 +0200 |
commit | 8188c3b48ded8b53d88440f0736690d2e30508ed (patch) | |
tree | b36bbe8ed28eaa4dc37c9876cc5f71a520bb9fdd /src/sort.c | |
parent | 33f95a9ab62968a6b13eb1a6a71f180f61721f71 (diff) | |
download | coreutils-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/sort.c')
-rw-r--r-- | src/sort.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/sort.c b/src/sort.c index af23e844f..dc7874a9e 100644 --- a/src/sort.c +++ b/src/sort.c @@ -414,7 +414,7 @@ static struct option const long_options[] = {"output", required_argument, NULL, 'o'}, {"reverse", no_argument, NULL, 'r'}, {"stable", no_argument, NULL, 's'}, - {"buffer-size", required_argument, NULL, 'S'}, + {OPT_STR_INIT ("buffer-size"), required_argument, NULL, 'S'}, {"field-separator", required_argument, NULL, 't'}, {"temporary-directory", required_argument, NULL, 'T'}, {"unique", no_argument, NULL, 'u'}, @@ -1032,7 +1032,7 @@ inittables (void) /* Specify the amount of main memory to use when sorting. */ static void -specify_sort_size (char const *s) +specify_sort_size (char const *option, char const *s) { uintmax_t n; char *suffix; @@ -1088,7 +1088,7 @@ specify_sort_size (char const *s) e = LONGINT_OVERFLOW; } - STRTOL_FATAL_ERROR (s, _("sort size"), e); + STRTOL_FATAL_ERROR (option, s, e); } /* Return the default sort size. */ @@ -2842,6 +2842,7 @@ main (int argc, char **argv) pedantic and a file was seen, unless the POSIX version predates 1003.1-2001 and -c was not seen and the operand is "-o FILE" or "-oFILE". */ + int oi = -1; if (c == -1 || (posixly_correct && nfiles != 0 @@ -2851,7 +2852,7 @@ main (int argc, char **argv) && argv[optind][0] == '-' && argv[optind][1] == 'o' && (argv[optind][2] || optind + 1 != argc))) || ((c = getopt_long (argc, argv, short_options, - long_options, NULL)) + long_options, &oi)) == -1)) { if (argc <= optind) @@ -3011,7 +3012,7 @@ main (int argc, char **argv) break; case 'S': - specify_sort_size (optarg); + specify_sort_size (OPT_STR (oi, c, long_options), optarg); break; case 't': |