summaryrefslogtreecommitdiff
path: root/src/ls.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2007-08-11 08:30:43 +0200
committerJim Meyering <jim@meyering.net>2007-08-11 08:32:50 +0200
commited31c612c12e603ce86073952018bf7f00f9cd59 (patch)
tree6b4a11c2f0f491d53127516d9e01fb1914fa9f76 /src/ls.c
parentd243c0e840138cc5d8bf67c9d2a785bdbd74a8d9 (diff)
downloadcoreutils-ed31c612c12e603ce86073952018bf7f00f9cd59.tar.xz
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.
Diffstat (limited to 'src/ls.c')
-rw-r--r--src/ls.c14
1 files changed, 9 insertions, 5 deletions
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;