X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lib-src%2Ffakemail.c;h=5397d7c51e705d8bc5679114086d5150d6ac1f0e;hb=a5f466de30a3e927ed1146b0c7e3870e71465c8f;hp=22cb1ab13f63a4c7a3461462d843e780d7771c40;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910;p=chise%2Fxemacs-chise.git.1 diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c index 22cb1ab..5397d7c 100644 --- a/lib-src/fakemail.c +++ b/lib-src/fakemail.c @@ -24,9 +24,9 @@ Boston, MA 02111-1307, USA. */ #include <../src/config.h> #if defined (BSD) && !defined (BSD4_1) && !defined (USE_FAKEMAIL) -/* This program isnot used in BSD, so just avoid loader complaints. */ +/* This program is not used in BSD, so just avoid loader complaints. */ int -main () +main (int argc, char *argv[]) { return 0; } @@ -34,7 +34,7 @@ main () #include #include int -main () +main (int argc, char *argv[]) { /* Linux /bin/mail, if it exists, is NOT the Unix v7 mail that fakemail depends on! This causes garbled mail. Better to @@ -48,7 +48,7 @@ main () #else /* not BSD 4.2 (or newer) */ #ifdef MSDOS int -main () +main (int argc, char *argv[]) { return 0; } @@ -100,11 +100,11 @@ struct header_record struct header_record *previous; }; typedef struct header_record *header; - + struct stream_record { FILE *handle; - int (*action)(); + int (*action)(FILE *); struct stream_record *rest_streams; }; typedef struct stream_record *stream_list; @@ -191,8 +191,7 @@ fatal (CONST char *s1, CONST char *s2) /* Like malloc but get fatal error if memory is exhausted. */ static char * -xmalloc (size) - size_t size; +xmalloc (size_t size) { char *result = malloc (((unsigned) size)); if (result == ((char *) NULL)) @@ -201,9 +200,7 @@ xmalloc (size) } static char * -xrealloc (ptr, size) - char *ptr; - size_t size; +xrealloc (char *ptr, size_t size) { char *result = realloc (ptr, ((unsigned) size)); if (result == ((char *) NULL)) @@ -221,7 +218,7 @@ init_linebuffer (struct linebuffer *linebuffer) } /* Read a line of text from `stream' into `linebuffer'. - * Return the length of the line. + * Return the length of the line. */ static long @@ -263,14 +260,17 @@ get_keyword (register char *field, char **rest) ptr = &keyword[0]; c = *field++; - if ((isspace (c)) || (c == ':')) - return ((char *) NULL); - *ptr++ = ((islower (c)) ? (toupper (c)) : c); - while (((c = *field++) != ':') && (!(isspace (c)))) - *ptr++ = ((islower (c)) ? (toupper (c)) : c); + if ((isspace ((int) (unsigned char) c)) || (c == ':')) + return (char *) NULL; + *ptr++ = ((islower ((int) (unsigned char) c)) ? + (toupper ((int) (unsigned char) c)) : c); + while (((c = *field++) != ':') && + (!(isspace ((int) (unsigned char) c)))) + *ptr++ = ((islower ((int) (unsigned char) c)) ? + (toupper ((int) (unsigned char) c)) : c); *ptr++ = '\0'; - while (isspace (c)) c = *field++; - if (c != ':') return ((char *) NULL); + while (isspace ((int) (unsigned char) c)) c = *field++; + if (c != ':') return (char *) NULL; *rest = field; return &keyword[0]; } @@ -323,7 +323,11 @@ make_file_preface (void) /* the_date has an unwanted newline at the end */ date_length = strlen (the_date) - 1; the_date[date_length] = '\0'; +#ifdef WINDOWSNT + temp = "(null)"; +#else temp = cuserid ((char *) NULL); +#endif user_length = strlen (temp); the_user = alloc_string ((size_t) (user_length + 1)); strcpy (the_user, temp); @@ -371,7 +375,7 @@ close_the_streams (void) } static void -add_a_stream (FILE *the_stream, int (*closing_action)()) +add_a_stream (FILE *the_stream, int (*closing_action)(FILE *)) { stream_list old = the_streams; the_streams = new_stream (); @@ -553,7 +557,7 @@ parse_header (header the_header, register char *where) *where = '\0'; return; } - + static header read_header (void) { @@ -624,9 +628,7 @@ write_header (header the_header) } int -main (argc, argv) - int argc; - char **argv; +main (int argc, char *argv[]) { char *command_line; header the_header; @@ -655,7 +657,7 @@ main (argc, argv) args_size (the_header))); strcpy (command_line, mail_program_name); parse_header (the_header, &command_line[name_length]); - + the_pipe = popen (command_line, "w"); if (the_pipe == ((FILE *) NULL)) fatal ("cannot open pipe to real mailer", (char *) 0);