]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Adapt to use new interface to XARGMATCH.
authorJim Meyering <jim@meyering.net>
Sat, 2 Jan 1999 19:29:47 +0000 (19:29 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 2 Jan 1999 19:29:47 +0000 (19:29 +0000)
src/cp.c
src/ls.c
src/touch.c

index 4b81546862daf3a045f1e1ff35d4e60825aded86..14ba1075c4108c2c9314cae254ac8122786df941 100644 (file)
--- a/src/cp.c
+++ b/src/cp.c
@@ -1,5 +1,5 @@
 /* cp.c  -- file copying (main routines)
-   Copyright (C) 89, 90, 91, 95, 96, 97, 1998 Free Software Foundation.
+   Copyright (C) 89, 90, 91, 95, 96, 97, 1998, 1999 Free Software Foundation.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -655,8 +655,8 @@ main (int argc, char **argv)
          break;
 
        case CHAR_MAX + 1:
-         x.sparse_mode = XARGMATCH ("--sparse", optarg,
-                                        sparse_type_string, sparse_type);
+         XARGMATCH (&x.sparse_mode, "--sparse", optarg,
+                    sparse_type_string, sparse_type, usage (1));
          break;
 
        case 'a':               /* Like -dpR. */
index 84e0a2d36ca430de6715b259825759a6985ae2ce..81e0e83d05ab39944ece9b0d751618ba6cd2fb81 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -1,5 +1,5 @@
 /* `dir', `vdir' and `ls' directory listing programs for GNU.
-   Copyright (C) 85, 88, 90, 91, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 85, 88, 90, 91, 95, 96, 97, 1998, 1999 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -78,6 +78,9 @@
 #define obstack_chunk_alloc malloc
 #define obstack_chunk_free free
 
+#define MY_XARGMATCH(Result_ptr, Msg, Arg, Arg_list, Val_list) \
+         XARGMATCH (Result_ptr, Msg, Arg, Arg_list, Val_list, usage (1))
+
 /* Return an int indicating the result of comparing two integers.
    Subtracting doesn't always work, due to overflow.  */
 #define longdiff(a, b) ((a) < (b) ? -1 : (a) > (b))
@@ -1099,22 +1102,20 @@ decode_switches (int argc, char **argv)
          break;
 
        case 10:                /* --sort */
-         sort_type = XARGMATCH ("--sort", optarg, sort_args, sort_types);
+         MY_XARGMATCH (&sort_type, "--sort", optarg, sort_args, sort_types);
          break;
 
        case 11:                /* --time */
-         time_type = XARGMATCH ("--time", optarg, time_args, time_types);
+         MY_XARGMATCH (&time_type, "--time", optarg, time_args, time_types);
          break;
 
        case 12:                /* --format */
-         format = XARGMATCH ("--format", optarg,
-                                 format_args, format_types);
+         MY_XARGMATCH (&format, "--format", optarg, format_args, format_types);
          break;
 
        case 13:                /* --color */
          if (optarg)
-           i = XARGMATCH ("--color", optarg,
-                              color_args, color_types);
+           MY_XARGMATCH (&i, "--color", optarg, color_args, color_types);
          else
            /* Using --color with no argument is equivalent to using
               --color=always.  */
@@ -1134,16 +1135,19 @@ decode_switches (int argc, char **argv)
          break;
 
        case 14:                /* --indicator-style */
-         indicator_style = XARGMATCH ("--indicator-style", optarg,
-                                          indicator_style_args,
-                                          indicator_style_types);
+         MY_XARGMATCH (&indicator_style, "--indicator-style", optarg,
+                       indicator_style_args,
+                       indicator_style_types);
          break;
 
        case 15:                /* --quoting-style */
-         set_quoting_style (NULL,
-                            XARGMATCH ("--quoting-style", optarg,
-                                           quoting_style_args,
-                                           quoting_style_vals));
+         {
+           enum quoting_style qs;
+           MY_XARGMATCH (&qs, "--quoting-style", optarg,
+                         quoting_style_args,
+                         quoting_style_vals);
+           set_quoting_style (NULL, qs);
+         }
          break;
 
        case 16:
index f9ea43a060d98139803174a7d32a3232dc160b25..6f24d9f4c4b9078e54f313f6ed9fc147c67e5372 100644 (file)
@@ -1,5 +1,5 @@
 /* touch -- change modification and access times of files
-   Copyright (C) 87, 89, 90, 91, 95, 96, 97, 1998 Free Software Foundation, Inc.
+   Copyright (C) 87, 1989-1991, 1995-1999 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -285,8 +285,12 @@ main (int argc, char **argv)
          break;
 
        case CHAR_MAX + 1:      /* --time */
-         change_times |= XARGCASEMATCH ("--time", optarg, 
-                                        time_args, time_masks);
+         {
+           int mask;
+           XARGMATCH (&mask, "--time", optarg, time_args, time_masks,
+                      usage (1));
+           change_times |= mask;
+         }
          break;
 
        default: