comparison lib-src/fakemail.c @ 42181:358035cb58d9

Conditionally include config.h. Clean-up whitespaces.
author Pavel Janík <Pavel@Janik.cz>
date Wed, 19 Dec 2001 07:26:05 +0000
parents de525d9743c9
children 64341c22fb4c
comparison
equal deleted inserted replaced
42180:35906f73a07d 42181:358035cb58d9
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */ 19 Boston, MA 02111-1307, USA. */
20 20
21 #define NO_SHORTNAMES 21 #define NO_SHORTNAMES
22 #define _XOPEN_SOURCE 500 /* for cuserid */ 22 #define _XOPEN_SOURCE 500 /* for cuserid */
23 #include <config.h> 23
24 #ifdef HAVE_CONFIG_H
25 #include "config.h"
26 #endif
24 27
25 #if defined (BSD_SYSTEM) && !defined (BSD4_1) && !defined (USE_FAKEMAIL) 28 #if defined (BSD_SYSTEM) && !defined (BSD4_1) && !defined (USE_FAKEMAIL)
26 /* This program isnot used in BSD, so just avoid loader complaints. */ 29 /* This program isnot used in BSD, so just avoid loader complaints. */
27 int 30 int
28 main () 31 main ()
80 line_list text; 83 line_list text;
81 struct header_record *next; 84 struct header_record *next;
82 struct header_record *previous; 85 struct header_record *previous;
83 }; 86 };
84 typedef struct header_record *header; 87 typedef struct header_record *header;
85 88
86 struct stream_record 89 struct stream_record
87 { 90 {
88 FILE *handle; 91 FILE *handle;
89 int (*action)(); 92 int (*action)();
90 struct stream_record *rest_streams; 93 struct stream_record *rest_streams;
201 linebuffer->size = INITIAL_LINE_SIZE; 204 linebuffer->size = INITIAL_LINE_SIZE;
202 linebuffer->buffer = ((char *) xmalloc (INITIAL_LINE_SIZE)); 205 linebuffer->buffer = ((char *) xmalloc (INITIAL_LINE_SIZE));
203 } 206 }
204 207
205 /* Read a line of text from `stream' into `linebuffer'. 208 /* Read a line of text from `stream' into `linebuffer'.
206 * Return the length of the line. 209 Return the length of the line. */
207 */
208 210
209 long 211 long
210 readline (linebuffer, stream) 212 readline (linebuffer, stream)
211 struct linebuffer *linebuffer; 213 struct linebuffer *linebuffer;
212 FILE *stream; 214 FILE *stream;
617 the_header = the_header->next; 619 the_header = the_header->next;
618 } while (the_header != old); 620 } while (the_header != old);
619 *where = '\0'; 621 *where = '\0';
620 return; 622 return;
621 } 623 }
622 624
623 /* Read lines from the input until we get a blank line. 625 /* Read lines from the input until we get a blank line.
624 Create a list of `header' objects, one for each header field, 626 Create a list of `header' objects, one for each header field,
625 each of which points to a list of `line_list' objects, 627 each of which points to a list of `line_list' objects,
626 one for each line in that field. 628 one for each line in that field.
627 Continuation lines are grouped in the headers they continue. */ 629 Continuation lines are grouped in the headers they continue. */
628 630
629 header 631 header
630 read_header () 632 read_header ()
631 { 633 {
632 register header the_header = ((header) NULL); 634 register header the_header = ((header) NULL);
633 register line_list *next_line = ((line_list *) NULL); 635 register line_list *next_line = ((line_list *) NULL);
723 725
724 the_header = read_header (); 726 the_header = read_header ();
725 command_line = alloc_string (name_length + args_size (the_header)); 727 command_line = alloc_string (name_length + args_size (the_header));
726 strcpy (command_line, mail_program_name); 728 strcpy (command_line, mail_program_name);
727 parse_header (the_header, &command_line[name_length]); 729 parse_header (the_header, &command_line[name_length]);
728 730
729 the_pipe = popen (command_line, "w"); 731 the_pipe = popen (command_line, "w");
730 if (the_pipe == ((FILE *) NULL)) 732 if (the_pipe == ((FILE *) NULL))
731 fatal ("cannot open pipe to real mailer"); 733 fatal ("cannot open pipe to real mailer");
732 734
733 add_a_stream (the_pipe, pclose); 735 add_a_stream (the_pipe, pclose);