diff options
Diffstat (limited to 'libstore')
-rw-r--r-- | libstore/argp.c | 12 | ||||
-rw-r--r-- | libstore/store.h | 7 |
2 files changed, 13 insertions, 6 deletions
diff --git a/libstore/argp.c b/libstore/argp.c index 1ebd32a2..058d8276 100644 --- a/libstore/argp.c +++ b/libstore/argp.c @@ -1,7 +1,7 @@ /* Store argument parsing - Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. - Written by Miles Bader <miles@gnu.ai.mit.edu> + Copyright (C) 1996,97,98,99,2001 Free Software Foundation, Inc. + Written by Miles Bader <miles@gnu.org> This file is part of the GNU Hurd. The GNU Hurd is free software; you can redistribute it and/or @@ -361,11 +361,13 @@ parse_opt (int opt, char *arg, struct argp_state *state) && (!parsed->type->validate_name || (*parsed->type->validate_name) (0, parsed->classes) != 0)) { + struct store_argp_params *params = state->input; store_parsed_free (parsed); - PERR (EINVAL, "No store specified"); + if (!params->store_optional) + PERR (EINVAL, "No store specified"); + parsed = 0; } - else - ((struct store_argp_params *)state->input)->result = parsed; + ((struct store_argp_params *)state->input)->result = parsed; break; default: diff --git a/libstore/store.h b/libstore/store.h index 9c5e5bfd..6d95746a 100644 --- a/libstore/store.h +++ b/libstore/store.h @@ -1,6 +1,6 @@ /* Store I/O - Copyright (C) 1995, 96, 97, 98, 99 Free Software Foundation, Inc. + Copyright (C) 1995,96,97,98,99,2001 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.org> This file is part of the GNU Hurd. @@ -625,6 +625,11 @@ struct store_argp_params /* The set of classes used to validate store-types and argument syntax. */ const struct store_class *const *classes; + + /* This controls the behavior when no store arguments are specified. + If zero, the parser fails with the error message "No store specified". + If nonzero, the parser succeeds and sets `result' to null. */ + int store_optional; }; /* The result of parsing a store, which should be enough information to open |