From ed31c612c12e603ce86073952018bf7f00f9cd59 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 11 Aug 2007 08:30:43 +0200 Subject: Accommodate more xstrtol changes. * src/df.c (long_options): Don't bother prepending "--" to long options that OPT_STR might decode, as that hack is no longer needed. (main): Invoke xstrtol_fatal rather than STRTOL_FATAL_ERROR. * src/du.c (long_options, main): Likewise. * src/ls.c (decode_switches): Likewise. * src/od.c (long_options, main): Likewise. * src/pr.c (first_last_page, main): Likewise. * src/sort.c (long_options, specify_sort_size): Likewise. * src/pr.c (first_last_page): Accept option index and option char instead of an assembled option string. All callers changed. * src/sort.c (specify_sort_size): Likewise. * src/system.h (OPT_STR, LONG_OPT_STR, short_opt_str, OPT_STR_INIT): Remove. --- src/ls.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/ls.c') diff --git a/src/ls.c b/src/ls.c index 064a51f74..c6a15f60d 100644 --- a/src/ls.c +++ b/src/ls.c @@ -1375,7 +1375,6 @@ main (int argc, char **argv) static int decode_switches (int argc, char **argv) { - int c; char *time_style_option = NULL; /* Record whether there is an option specifying sort type. */ @@ -1506,10 +1505,15 @@ decode_switches (int argc, char **argv) } } - while ((c = getopt_long (argc, argv, - "abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UXZ1", - long_options, NULL)) != -1) + for (;;) { + int oi = -1; + int c = getopt_long (argc, argv, + "abcdfghiklmnopqrstuvw:xABCDFGHI:LNQRST:UXZ1", + long_options, &oi); + if (c == -1) + break; + switch (c) { case 'a': @@ -1797,7 +1801,7 @@ decode_switches (int argc, char **argv) enum strtol_error e = human_options (optarg, &human_output_opts, &output_block_size); if (e != LONGINT_OK) - STRTOL_FATAL_ERROR ("--block-size", optarg, e); + xstrtol_fatal (e, oi, 0, long_options, optarg); file_output_block_size = output_block_size; } break; -- cgit v1.2.3-54-g00ecf