diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2003-11-21 15:15:40 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2003-11-21 15:15:40 +0000 |
commit | d8e1c3633afaa89ecb43201234559bfc2bdef02c (patch) | |
tree | 45548cf0571528ecfe568d4fc2f5e519e327ea84 | |
parent | 6f9b122622a750258bcef20660d6da3bf137297d (diff) | |
download | cpio-d8e1c3633afaa89ecb43201234559bfc2bdef02c.tar.gz cpio-d8e1c3633afaa89ecb43201234559bfc2bdef02c.tar.bz2 |
Implement standard --version and --help options
-rw-r--r-- | rmt.c | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -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"); |