aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2003-11-21 15:15:40 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2003-11-21 15:15:40 +0000
commitd8e1c3633afaa89ecb43201234559bfc2bdef02c (patch)
tree45548cf0571528ecfe568d4fc2f5e519e327ea84
parent6f9b122622a750258bcef20660d6da3bf137297d (diff)
downloadcpio-d8e1c3633afaa89ecb43201234559bfc2bdef02c.tar.gz
cpio-d8e1c3633afaa89ecb43201234559bfc2bdef02c.tar.bz2
Implement standard --version and --help options
-rw-r--r--rmt.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/rmt.c b/rmt.c
index 1bfb536..dd38f11 100644
--- a/rmt.c
+++ b/rmt.c
@@ -135,6 +135,20 @@ FILE *debug;
#define MTS_BF 'b'
#endif /* EXTENDED_RMT_PROTOCOL */
+static struct option gnu_options[] =
+ {
+ {"version", no_argument, 0, 'v'},
+ {"help", no_argument, 0, 'h'},
+ {0, 0, 0, 0}
+ };
+
+void
+rmt_help ()
+{
+ printf ("GNU rmt: remote magtape protocol module\n");
+ printf ("usage: rmt [debug_file]\n");
+}
+
int
main (argc, argv)
int argc;
@@ -144,7 +158,20 @@ main (argc, argv)
char c;
int n, i, cc;
- argc--, argv++;
+ while ((c = getopt_long (argc, argv, "vh", gnu_options, &n)) != EOF)
+ switch (c) {
+ case 'v':
+ printf ("rmt (%s)\n", PACKAGE_STRING);
+ return 0;
+
+ case 'h':
+ rmt_help ();
+ return 0;
+ }
+
+ argc -= optind;
+ argv += optind;
+
if (argc > 0)
{
debug = fopen (*argv, "w");

Return to:

Send suggestions and report system problems to the System administrator.