Mercurial > hg > xemacs-beta
comparison lib-src/fakemail.c @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | 023b83f4e54b |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
44 fprintf (stderr, "set the Lisp variable `sendmail-program' to point\n"); | 44 fprintf (stderr, "set the Lisp variable `sendmail-program' to point\n"); |
45 fprintf (stderr, "to the path of the sendmail binary.\n"); | 45 fprintf (stderr, "to the path of the sendmail binary.\n"); |
46 return 1; | 46 return 1; |
47 } | 47 } |
48 #else /* not BSD 4.2 (or newer) */ | 48 #else /* not BSD 4.2 (or newer) */ |
49 #ifdef MSDOS | |
50 int | |
51 main (int argc, char *argv[]) | |
52 { | |
53 return 0; | |
54 } | |
55 #else /* not MSDOS */ | |
56 /* This conditional contains all the rest of the file. */ | |
57 | 49 |
58 /* These are defined in config in some versions. */ | 50 /* These are defined in config in some versions. */ |
59 | 51 |
60 #ifdef static | 52 #ifdef static |
61 #undef static | 53 #undef static |
142 | 134 |
143 #ifndef MAIL_PROGRAM_NAME | 135 #ifndef MAIL_PROGRAM_NAME |
144 #define MAIL_PROGRAM_NAME "/bin/mail" | 136 #define MAIL_PROGRAM_NAME "/bin/mail" |
145 #endif | 137 #endif |
146 | 138 |
147 static CONST char *my_name; | 139 static const char *my_name; |
148 static char *the_date; | 140 static char *the_date; |
149 static char *the_user; | 141 static char *the_user; |
150 static line_list file_preface; | 142 static line_list file_preface; |
151 static stream_list the_streams; | 143 static stream_list the_streams; |
152 static boolean no_problems = true; | 144 static boolean no_problems = true; |
169 /* Utilities */ | 161 /* Utilities */ |
170 | 162 |
171 /* Print error message. `s1' is printf control string, `s2' is arg for it. */ | 163 /* Print error message. `s1' is printf control string, `s2' is arg for it. */ |
172 | 164 |
173 static void | 165 static void |
174 error (CONST char *s1, CONST char *s2) | 166 error (const char *s1, const char *s2) |
175 { | 167 { |
176 printf ("%s: ", my_name); | 168 printf ("%s: ", my_name); |
177 printf (s1, s2); | 169 printf (s1, s2); |
178 printf ("\n"); | 170 printf ("\n"); |
179 no_problems = false; | 171 no_problems = false; |
180 } | 172 } |
181 | 173 |
182 /* Print error message and exit. */ | 174 /* Print error message and exit. */ |
183 | 175 |
184 static void | 176 static void |
185 fatal (CONST char *s1, CONST char *s2) | 177 fatal (const char *s1, const char *s2) |
186 { | 178 { |
187 error (s1, s2); | 179 error (s1, s2); |
188 exit (1); | 180 exit (1); |
189 } | 181 } |
190 | 182 |
308 | 300 |
309 static line_list | 301 static line_list |
310 make_file_preface (void) | 302 make_file_preface (void) |
311 { | 303 { |
312 char *the_string, *temp; | 304 char *the_string, *temp; |
313 long idiotic_interface; | 305 time_t idiotic_interface; |
314 long prefix_length; | 306 long prefix_length; |
315 long user_length; | 307 long user_length; |
316 long date_length; | 308 long date_length; |
317 line_list result; | 309 line_list result; |
318 | 310 |
319 prefix_length = strlen (FROM_PREFIX); | 311 prefix_length = strlen (FROM_PREFIX); |
320 time (&idiotic_interface); | 312 time (&idiotic_interface); |
321 the_date = ctime (&idiotic_interface); | 313 the_date = ctime (&idiotic_interface); |
322 /* the_date has an unwanted newline at the end */ | 314 /* the_date has an unwanted newline at the end */ |
323 date_length = strlen (the_date) - 1; | 315 date_length = strlen (the_date) - 1; |
324 the_date[date_length] = '\0'; | 316 if (the_date[date_length] == '\n') |
325 #ifdef WINDOWSNT | 317 the_date[date_length] = '\0'; |
318 #ifdef WIN32_NATIVE | |
326 temp = "(null)"; | 319 temp = "(null)"; |
327 #else | 320 #else |
328 temp = cuserid ((char *) NULL); | 321 temp = cuserid ((char *) NULL); |
329 #endif | 322 #endif |
330 user_length = strlen (temp); | 323 user_length = strlen (temp); |
417 fputs (s, rem->handle); | 410 fputs (s, rem->handle); |
418 return; | 411 return; |
419 } | 412 } |
420 | 413 |
421 static void | 414 static void |
422 put_line (CONST char *string) | 415 put_line (const char *string) |
423 { | 416 { |
424 register stream_list rem; | 417 register stream_list rem; |
425 for (rem = the_streams; | 418 for (rem = the_streams; |
426 rem != ((stream_list) NULL); | 419 rem != ((stream_list) NULL); |
427 rem = rem->rest_streams) | 420 rem = rem->rest_streams) |
428 { | 421 { |
429 CONST char *s = string; | 422 const char *s = string; |
430 int column = 0; | 423 int column = 0; |
431 | 424 |
432 /* Divide STRING into lines. */ | 425 /* Divide STRING into lines. */ |
433 while (*s != 0) | 426 while (*s != 0) |
434 { | 427 { |
435 CONST char *breakpos; | 428 const char *breakpos; |
436 | 429 |
437 /* Find the last char that fits. */ | 430 /* Find the last char that fits. */ |
438 for (breakpos = s; *breakpos && column < 78; ++breakpos) | 431 for (breakpos = s; *breakpos && column < 78; ++breakpos) |
439 { | 432 { |
440 if (*breakpos == '\t') | 433 if (*breakpos == '\t') |
671 } | 664 } |
672 | 665 |
673 return close_the_streams (); | 666 return close_the_streams (); |
674 } | 667 } |
675 | 668 |
676 #endif /* not MSDOS */ | |
677 #endif /* not BSD 4.2 (or newer) */ | 669 #endif /* not BSD 4.2 (or newer) */ |