summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-05-20 05:30:58 +0000
committerMiles Bader <miles@gnu.org>1995-05-20 05:30:58 +0000
commitdd00d76b68212429e172bf9169858beec7160ad9 (patch)
treebdc8812528aefdb0eec144b069d3e74ea506daa6
parentd0635863b90c77f826aa0a54bdb2157dfbf98bf3 (diff)
(main): Check for a missing filesystem name.
(main): Tweak the error msgs a bit. (options, main): Don't use '?' as the --help key.
-rw-r--r--utils/fsysopts.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/utils/fsysopts.c b/utils/fsysopts.c
index ff7e511b..4e931f80 100644
--- a/utils/fsysopts.c
+++ b/utils/fsysopts.c
@@ -33,7 +33,7 @@
/* ---------------------------------------------------------------- */
-#define USAGE "Usage: %s [OPTION...] FILE OPTIONS...\n"
+#define USAGE "Usage: %s [OPTION...] FILESYS OPTIONS...\n"
static void
usage(status)
@@ -57,13 +57,13 @@ usage(status)
exit(status);
}
-#define SHORT_OPTIONS "LR?V"
+#define SHORT_OPTIONS "LRV"
static struct option options[] =
{
{"dereference", no_argument, 0, 'L'},
{"recursive", no_argument, 0, 'R'},
- {"help", no_argument, 0, '?'},
+ {"help", no_argument, 0, '&'},
{"version", no_argument, 0, 'V'},
{0, 0, 0, 0}
};
@@ -103,10 +103,16 @@ main(int argc, char *argv[])
case 'R': recursive = 1; break;
case 'L': deref = 1; break;
case 'V': printf ("%s 0.0\n", program_invocation_short_name); exit (0);
- case '?': usage(0);
+ case '&': usage(0);
default: usage(-1);
}
+ if (node_name == NULL)
+ {
+ fprintf (stderr, USAGE, program_invocation_short_name);
+ usage (-1);
+ }
+
node = file_name_lookup(node_name, (deref ? 0 : O_NOLINK), 0666);
if (node == MACH_PORT_NULL)
error(1, errno, "%s", node_name);
@@ -118,7 +124,10 @@ main(int argc, char *argv[])
err = fsys_set_options (fsys, argz, argz_len, recursive);
if (err)
- error(5, err, "%s", node_name);
+ {
+ argz_stringify (argz, argz_len);
+ error(5, err, "%s: %s", node_name, argz);
+ }
exit(0);
}