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.
This commit is contained in:
Jim Meyering
2005-06-30 16:47:00 +00:00
parent f2daebf810
commit 779a89cdb4
2 changed files with 6 additions and 5 deletions
+3 -3
View File
@@ -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;
+3 -2
View File
@@ -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)