From 1e25b6e3d3608549b46f55624e8111f48d916f2f Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 2 Jan 1999 19:29:47 +0000 Subject: [PATCH] Adapt to use new interface to XARGMATCH. --- src/cp.c | 6 +++--- src/ls.c | 32 ++++++++++++++++++-------------- src/touch.c | 10 +++++++--- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/cp.c b/src/cp.c index 4b81546862..14ba1075c4 100644 --- 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. */ diff --git a/src/ls.c b/src/ls.c index 84e0a2d36c..81e0e83d05 100644 --- 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: diff --git a/src/touch.c b/src/touch.c index f9ea43a060..6f24d9f4c4 100644 --- a/src/touch.c +++ b/src/touch.c @@ -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: -- 2.47.3