From 779a89cdb444cf4426eb31ab3d63b2575b29431f Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 30 Jun 2005 16:47:00 +0000 Subject: Add uses of ARGMATCH_VERIFY to ensure that corresponding option string and value arrays are consistent. Remove a harmless trailing `, 0' from a value list. --- src/cp.c | 6 +++--- src/du.c | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/cp.c b/src/cp.c index d413bf5ee..a2810c30c 100644 --- a/src/cp.c +++ b/src/cp.c @@ -94,23 +94,23 @@ static char const *const sparse_type_string[] = { "never", "auto", "always", NULL }; - static enum Sparse_type const sparse_type[] = { SPARSE_NEVER, SPARSE_AUTO, SPARSE_ALWAYS }; +ARGMATCH_VERIFY (sparse_type_string, sparse_type); /* Valid arguments to the `--reply' option. */ static char const* const reply_args[] = { "yes", "no", "query", NULL }; - /* The values that correspond to the above strings. */ static int const reply_vals[] = { I_ALWAYS_YES, I_ALWAYS_NO, I_ASK_USER }; +ARGMATCH_VERIFY (reply_args, reply_vals); static struct option const long_opts[] = { @@ -729,13 +729,13 @@ decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off) PRESERVE_MODE, PRESERVE_TIMESTAMPS, PRESERVE_OWNERSHIP, PRESERVE_LINK, PRESERVE_ALL }; - /* Valid arguments to the `--preserve' option. */ static char const* const preserve_args[] = { "mode", "timestamps", "ownership", "links", "all", NULL }; + ARGMATCH_VERIFY (preserve_args, preserve_vals); char *arg_writable = xstrdup (arg); char *s = arg_writable; diff --git a/src/du.c b/src/du.c index b6fc5add9..bd6aeba34 100644 --- a/src/du.c +++ b/src/du.c @@ -245,6 +245,7 @@ static enum time_type const time_types[] = { time_atime, time_atime, time_atime, time_ctime, time_ctime }; +ARGMATCH_VERIFY (time_args, time_types); /* `full-iso' uses full ISO-style dates and times. `long-iso' uses longer ISO-style time stamps, though shorter than `full-iso'. `iso' uses shorter @@ -260,11 +261,11 @@ static char const *const time_style_args[] = { "full-iso", "long-iso", "iso", NULL }; - static enum time_style const time_style_types[] = { - full_iso_time_style, long_iso_time_style, iso_time_style, 0 + full_iso_time_style, long_iso_time_style, iso_time_style }; +ARGMATCH_VERIFY (time_style_args, time_style_types); void usage (int status) -- cgit v1.2.3-70-g09d2