\f
/* Initialize a linebuffer for use */
-void
+static void
init_linebuffer (struct linebuffer *linebuffer)
{
linebuffer->size = INITIAL_LINE_SIZE;
/* Read a line of text from `stream' into `linebuffer'.
Return the length of the line. */
-long
+static long
readline (struct linebuffer *linebuffer, FILE *stream)
{
char *buffer = linebuffer->buffer;
If there is no keyword, return NULL and don't alter *REST. */
-char *
+static char *
get_keyword (register char *field, char **rest)
{
static char keyword[KEYWORD_SIZE];
/* Nonzero if the string FIELD starts with a colon-terminated keyword. */
-boolean
+static boolean
has_keyword (char *field)
{
char *ignored;
We don't pay attention to overflowing WHERE;
the caller has to make it big enough. */
-char *
+static char *
add_field (line_list the_list, register char *field, register char *where)
{
register char c;
return where;
}
\f
-line_list
+static line_list
make_file_preface (void)
{
char *the_string, *temp;
return result;
}
-void
+static void
write_line_list (register line_list the_list, FILE *the_stream)
{
for ( ;
return;
}
\f
-int
+static int
close_the_streams (void)
{
register stream_list rem;
for (rem = the_streams;
rem != ((stream_list) NULL);
rem = rem->rest_streams)
- no_problems = (no_problems &&
- ((*rem->action) (rem->handle) == 0));
+ if (no_problems && (*rem->action) (rem->handle) != 0)
+ error ("output error", NULL);
the_streams = ((stream_list) NULL);
return (no_problems ? EXIT_SUCCESS : EXIT_FAILURE);
}
-void
+static void
add_a_stream (FILE *the_stream, int (*closing_action) (FILE *))
{
stream_list old = the_streams;
return;
}
-int
+static int
my_fclose (FILE *the_file)
{
putc ('\n', the_file);
fflush (the_file);
+ if (ferror (the_file))
+ return EOF;
return fclose (the_file);
}
-boolean
+static boolean
open_a_file (char *name)
{
FILE *the_stream = fopen (name, "a");
return false;
}
-void
+static void
put_string (char *s)
{
register stream_list rem;
return;
}
-void
+static void
put_line (const char *string)
{
register stream_list rem;
the header name), and THE_LIST holds the continuation lines if any.
Call open_a_file for each file. */
-void
+static void
setup_files (register line_list the_list, register char *field)
{
register char *start;
/* Compute the total size of all recipient names stored in THE_HEADER.
The result says how big to make the buffer to pass to parse_header. */
-int
+static int
args_size (header the_header)
{
register header old = the_header;
Also, if the header has any FCC fields, call setup_files for each one. */
-void
+static void
parse_header (header the_header, register char *where)
{
register header old = the_header;
one for each line in that field.
Continuation lines are grouped in the headers they continue. */
-header
+static header
read_header (void)
{
register header the_header = ((header) NULL);
return the_header->next;
}
\f
-void
+static void
write_header (header the_header)
{
register header old = the_header;
put_string (buf);
}
+ if (no_problems && (ferror (stdin) || fclose (stdin) != 0))
+ error ("input error", NULL);
+
exit (close_the_streams ());
}