summaryrefslogtreecommitdiff
path: root/lib-src/b2m.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1997-11-23 02:17:36 +0000
committerKarl Heuer <kwzh@gnu.org>1997-11-23 02:17:36 +0000
commite4b34a85e5fbafc7f8ca2b6adb9158af95457ee1 (patch)
tree99ccc7d64136e4c870e2829a3f69418ee070af73 /lib-src/b2m.c
parent7e7dab81236eb810834191298fdc68585c192ec1 (diff)
downloademacs-e4b34a85e5fbafc7f8ca2b6adb9158af95457ee1.tar.gz
Include getopt.h.
(main): Use getopt_long to handle --version and --help.
Diffstat (limited to 'lib-src/b2m.c')
-rw-r--r--lib-src/b2m.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/lib-src/b2m.c b/lib-src/b2m.c
index 2eb6a0354b8..6aea2270a51 100644
--- a/lib-src/b2m.c
+++ b/lib-src/b2m.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <time.h>
#include <sys/types.h>
+#include <getopt.h>
#ifdef MSDOS
#include <fcntl.h>
#endif
@@ -78,6 +79,15 @@ void fatal ();
char *progname;
+struct option longopts[] =
+{
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'V' },
+ { 0 }
+};
+
+extern int optind;
+
main (argc, argv)
int argc;
char **argv;
@@ -101,11 +111,31 @@ main (argc, argv)
#endif
progname = argv[0];
- if (argc != 1)
+ while (1)
+ {
+ int opt = getopt_long (argc, argv, "hV", longopts, 0);
+ if (opt == EOF)
+ break;
+
+ switch (opt)
+ {
+ case 'V':
+ printf ("%s (GNU Emacs %s)\n", "b2m", VERSION);
+ puts ("b2m is in the public domain.");
+ exit (GOOD);
+
+ case 'h':
+ fprintf (stderr, "Usage: %s <babylmailbox >unixmailbox\n", progname);
+ exit (GOOD);
+ }
+ }
+
+ if (optind != argc)
{
fprintf (stderr, "Usage: %s <babylmailbox >unixmailbox\n", progname);
exit (GOOD);
}
+
labels_saved = printing = header = FALSE;
ltoday = time (0);
today = ctime (&ltoday);