summaryrefslogtreecommitdiff
path: root/lib-src/b2m.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1994-03-03 18:11:32 +0000
committerKarl Heuer <kwzh@gnu.org>1994-03-03 18:11:32 +0000
commit88d00c7e26ef3a462eacc4c641177c5c7d3aa4ac (patch)
treea92577ffeca87a7ed1cdea840befc96978e1aace /lib-src/b2m.c
parent5b3557df52431521137aa996124d4dff6a4f9055 (diff)
downloademacs-88d00c7e26ef3a462eacc4c641177c5c7d3aa4ac.tar.gz
emacs-88d00c7e26ef3a462eacc4c641177c5c7d3aa4ac.tar.bz2
emacs-88d00c7e26ef3a462eacc4c641177c5c7d3aa4ac.zip
(main): Change delimiter from "^L" to "^_^L".
Allow for text following "BABYL OPTIONS:". Add --help option. Use argv[0] in error messages.
Diffstat (limited to 'lib-src/b2m.c')
-rw-r--r--lib-src/b2m.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/lib-src/b2m.c b/lib-src/b2m.c
index f4f3888345c..f05a0e8f678 100644
--- a/lib-src/b2m.c
+++ b/lib-src/b2m.c
@@ -22,7 +22,11 @@
#include <fcntl.h>
#endif
-#include <../src/config.h>
+#include "../src/config.h"
+
+#ifdef __STDC__
+#include <stdlib.h>
+#endif
#ifdef USG
#include <string.h>
@@ -53,15 +57,21 @@ main (argc, argv)
(stdout)->_flag &= ~_IOTEXT;
(stdin)->_flag &= ~_IOTEXT;
#endif
+ if (strcmp(argv[1], "--help") == 0)
+ {
+ fprintf(stderr, "Usage: %s <babylmailbox >unixmailbox\n", argv[0]);
+ exit (0);
+ }
ltoday = time(0);
today = ctime(&ltoday);
if (gets(data))
- if (strcmp(data, "BABYL OPTIONS:")) {
- fprintf(stderr, "b2m: not a Babyl mailfile!\n");
- exit(-1);
- } else
- printing = FALSE;
+ if (strncmp(data, "BABYL OPTIONS:", 14))
+ {
+ fprintf(stderr, "%s: not a Babyl mailfile!\n", argv[0]);
+ exit (-1);
+ } else
+ printing = FALSE;
else
exit(-1);
if (printing)
@@ -78,11 +88,11 @@ main (argc, argv)
if (!strcmp(data, "*** EOOH ***") && !printing) {
printing = header = TRUE;
- printf("From b2m %s", today);
+ printf("From %s %s", argv[0], today);
continue;
}
-
- if (!strcmp(data, " ")) {
+
+ if (!strcmp(data, "\037\f")) {
/* save labels */
gets(data);
p = strtok(data, " ,\r\n\t");