aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorKarl Heuer1994-03-03 18:11:32 +0000
committerKarl Heuer1994-03-03 18:11:32 +0000
commit88d00c7e26ef3a462eacc4c641177c5c7d3aa4ac (patch)
treea92577ffeca87a7ed1cdea840befc96978e1aace /lib-src
parent5b3557df52431521137aa996124d4dff6a4f9055 (diff)
downloademacs-88d00c7e26ef3a462eacc4c641177c5c7d3aa4ac.tar.gz
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')
-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 @@
22#include <fcntl.h> 22#include <fcntl.h>
23#endif 23#endif
24 24
25#include <../src/config.h> 25#include "../src/config.h"
26
27#ifdef __STDC__
28#include <stdlib.h>
29#endif
26 30
27#ifdef USG 31#ifdef USG
28#include <string.h> 32#include <string.h>
@@ -53,15 +57,21 @@ main (argc, argv)
53 (stdout)->_flag &= ~_IOTEXT; 57 (stdout)->_flag &= ~_IOTEXT;
54 (stdin)->_flag &= ~_IOTEXT; 58 (stdin)->_flag &= ~_IOTEXT;
55#endif 59#endif
60 if (strcmp(argv[1], "--help") == 0)
61 {
62 fprintf(stderr, "Usage: %s <babylmailbox >unixmailbox\n", argv[0]);
63 exit (0);
64 }
56 ltoday = time(0); 65 ltoday = time(0);
57 today = ctime(&ltoday); 66 today = ctime(&ltoday);
58 67
59 if (gets(data)) 68 if (gets(data))
60 if (strcmp(data, "BABYL OPTIONS:")) { 69 if (strncmp(data, "BABYL OPTIONS:", 14))
61 fprintf(stderr, "b2m: not a Babyl mailfile!\n"); 70 {
62 exit(-1); 71 fprintf(stderr, "%s: not a Babyl mailfile!\n", argv[0]);
63 } else 72 exit (-1);
64 printing = FALSE; 73 } else
74 printing = FALSE;
65 else 75 else
66 exit(-1); 76 exit(-1);
67 if (printing) 77 if (printing)
@@ -78,11 +88,11 @@ main (argc, argv)
78 88
79 if (!strcmp(data, "*** EOOH ***") && !printing) { 89 if (!strcmp(data, "*** EOOH ***") && !printing) {
80 printing = header = TRUE; 90 printing = header = TRUE;
81 printf("From b2m %s", today); 91 printf("From %s %s", argv[0], today);
82 continue; 92 continue;
83 } 93 }
84 94
85 if (!strcmp(data, " ")) { 95 if (!strcmp(data, "\037\f")) {
86 /* save labels */ 96 /* save labels */
87 gets(data); 97 gets(data);
88 p = strtok(data, " ,\r\n\t"); 98 p = strtok(data, " ,\r\n\t");