diff options
| author | Richard M. Stallman | 1994-03-05 21:53:42 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-03-05 21:53:42 +0000 |
| commit | e3515d10e71b405254046be9642262e34fd5c8cd (patch) | |
| tree | ae656aad7a70b4af5ac75038cdc4199961cafb34 /lib-src | |
| parent | 902a54b2c7d8955db10b7a55d3fab94f0c4a1b90 (diff) | |
| download | emacs-e3515d10e71b405254046be9642262e34fd5c8cd.tar.gz emacs-e3515d10e71b405254046be9642262e34fd5c8cd.zip | |
Clean up indentation and whitespace.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/b2m.c | 100 |
1 files changed, 56 insertions, 44 deletions
diff --git a/lib-src/b2m.c b/lib-src/b2m.c index dc0d81b6a93..77cfa9a622b 100644 --- a/lib-src/b2m.c +++ b/lib-src/b2m.c | |||
| @@ -15,6 +15,9 @@ | |||
| 15 | * Mon Nov 7 15:54:06 PDT 1988 | 15 | * Mon Nov 7 15:54:06 PDT 1988 |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | /* Serious bug: This program uses `gets', which is intrinsically | ||
| 19 | unreliable--long lines will cause crashes. | ||
| 20 | Someone should fix this program not to use `gets'. */ | ||
| 18 | #include <stdio.h> | 21 | #include <stdio.h> |
| 19 | #include <time.h> | 22 | #include <time.h> |
| 20 | #include <sys/types.h> | 23 | #include <sys/types.h> |
| @@ -49,68 +52,77 @@ main (argc, argv) | |||
| 49 | char **argv; | 52 | char **argv; |
| 50 | { | 53 | { |
| 51 | #ifdef MSDOS | 54 | #ifdef MSDOS |
| 52 | _fmode = O_BINARY; /* all of files are treated as binary files */ | 55 | _fmode = O_BINARY; /* all of files are treated as binary files */ |
| 53 | (stdout)->_flag &= ~_IOTEXT; | 56 | (stdout)->_flag &= ~_IOTEXT; |
| 54 | (stdin)->_flag &= ~_IOTEXT; | 57 | (stdin)->_flag &= ~_IOTEXT; |
| 55 | #endif | 58 | #endif |
| 56 | if (strcmp(argv[1], "--help") == 0) | 59 | if (strcmp (argv[1], "--help") == 0) |
| 57 | { | 60 | { |
| 58 | fprintf(stderr, "Usage: %s <babylmailbox >unixmailbox\n", argv[0]); | 61 | fprintf (stderr, "Usage: %s <babylmailbox >unixmailbox\n", argv[0]); |
| 59 | exit (0); | 62 | exit (0); |
| 60 | } | 63 | } |
| 61 | ltoday = time(0); | 64 | ltoday = time (0); |
| 62 | today = ctime(<oday); | 65 | today = ctime (<oday); |
| 63 | 66 | ||
| 64 | if (gets(data)) | 67 | /* BUG! Must not use gets in a reliable program! */ |
| 65 | if (strncmp(data, "BABYL OPTIONS:", 14)) | 68 | if (gets (data)) |
| 66 | { | 69 | { |
| 67 | fprintf(stderr, "%s: not a Babyl mailfile!\n", argv[0]); | 70 | if (strncmp (data, "BABYL OPTIONS:", 14)) |
| 68 | exit (-1); | 71 | { |
| 69 | } else | 72 | fprintf (stderr, "%s: not a Babyl mailfile!\n", argv[0]); |
| 73 | exit (-1); | ||
| 74 | } | ||
| 75 | else | ||
| 70 | printing = FALSE; | 76 | printing = FALSE; |
| 77 | } | ||
| 71 | else | 78 | else |
| 72 | exit(-1); | 79 | exit (-1); |
| 73 | if (printing) | 80 | if (printing) |
| 74 | puts(data); | 81 | puts (data); |
| 75 | 82 | ||
| 76 | while (gets(data)) { | 83 | while (gets (data)) |
| 84 | { | ||
| 77 | 85 | ||
| 78 | #if 0 | 86 | #if 0 |
| 79 | /* What was this for? Does somebody have something against blank | 87 | /* What was this for? Does somebody have something against blank |
| 80 | lines? */ | 88 | lines? */ |
| 81 | if (!strcmp(data, "")) | 89 | if (!strcmp (data, "")) |
| 82 | exit(0); | 90 | exit (0); |
| 83 | #endif | 91 | #endif |
| 84 | 92 | ||
| 85 | if (!strcmp(data, "*** EOOH ***") && !printing) { | 93 | if (!strcmp (data, "*** EOOH ***") && !printing) |
| 86 | printing = header = TRUE; | 94 | { |
| 87 | printf("From %s %s", argv[0], today); | 95 | printing = header = TRUE; |
| 88 | continue; | 96 | printf ("From %s %s", argv[0], today); |
| 89 | } | 97 | continue; |
| 98 | } | ||
| 90 | 99 | ||
| 91 | if (!strcmp(data, "\037\f")) { | 100 | if (!strcmp (data, "\037\f")) |
| 92 | /* save labels */ | 101 | { |
| 93 | gets(data); | 102 | /* save labels */ |
| 94 | p = strtok(data, " ,\r\n\t"); | 103 | gets (data); |
| 95 | strcpy(labels, "X-Babyl-Labels: "); | 104 | p = strtok (data, " ,\r\n\t"); |
| 105 | strcpy (labels, "X-Babyl-Labels: "); | ||
| 96 | 106 | ||
| 97 | while (p = strtok(NULL, " ,\r\n\t")) { | 107 | while (p = strtok (NULL, " ,\r\n\t")) |
| 98 | strcat(labels, p); | 108 | { |
| 99 | strcat(labels, ", "); | 109 | strcat (labels, p); |
| 100 | } | 110 | strcat (labels, ", "); |
| 111 | } | ||
| 101 | 112 | ||
| 102 | labels[strlen(labels) - 2] = '\0'; | 113 | labels[strlen (labels) - 2] = '\0'; |
| 103 | printing = header = FALSE; | 114 | printing = header = FALSE; |
| 104 | continue; | 115 | continue; |
| 105 | } | 116 | } |
| 106 | 117 | ||
| 107 | if (!strlen(data) && header) { | 118 | if (!strlen (data) && header) |
| 108 | header = FALSE; | 119 | { |
| 109 | if (strcmp(labels, "X-Babyl-Labels")) | 120 | header = FALSE; |
| 110 | puts(labels); | 121 | if (strcmp (labels, "X-Babyl-Labels")) |
| 111 | } | 122 | puts (labels); |
| 123 | } | ||
| 112 | 124 | ||
| 113 | if (printing) | 125 | if (printing) |
| 114 | puts(data); | 126 | puts (data); |
| 115 | } | 127 | } |
| 116 | } | 128 | } |