mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-07-26 02:30:35 +02:00
Change all uses of unlocked-wrapped functions to their upper case wrapper names.
This commit is contained in:
@@ -4,7 +4,7 @@ TODO
|
||||
add usage function
|
||||
call parse_long_options
|
||||
dcl, set program_name
|
||||
do fclose/error checking
|
||||
do FCLOSE/error checking
|
||||
*/
|
||||
|
||||
/* asa.c - interpret ASA carriage control characters
|
||||
@@ -67,13 +67,13 @@ static void copy_file (FILE *fp);
|
||||
static void
|
||||
form_feed ()
|
||||
{
|
||||
putchar ('\f');
|
||||
PUTCHAR ('\f');
|
||||
}
|
||||
|
||||
static void
|
||||
new_line ()
|
||||
{
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -119,20 +119,20 @@ flush ()
|
||||
if (ch != ' ')
|
||||
{
|
||||
if (printed)
|
||||
putchar ('\b');
|
||||
putchar (ch);
|
||||
PUTCHAR ('\b');
|
||||
PUTCHAR (ch);
|
||||
printed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!printed)
|
||||
putchar (' ');
|
||||
PUTCHAR (' ');
|
||||
}
|
||||
for (j = 0; j < line_num; j++)
|
||||
free (line_buffer[j].chr);
|
||||
|
||||
line_num = 0;
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
|
||||
static size_t
|
||||
@@ -255,7 +255,7 @@ main (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
copy_file (fp);
|
||||
fclose (fp);
|
||||
FCLOSE (fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -217,7 +217,7 @@ cksum (char *file, int print_name)
|
||||
}
|
||||
}
|
||||
|
||||
while ((bytes_read = fread (buf, 1, BUFLEN, fp)) > 0)
|
||||
while ((bytes_read = FREAD (buf, 1, BUFLEN, fp)) > 0)
|
||||
{
|
||||
unsigned char *cp = buf;
|
||||
|
||||
@@ -226,15 +226,15 @@ cksum (char *file, int print_name)
|
||||
crc = (crc << 8) ^ crctab[((crc >> 24) ^ *(cp++)) & 0xFF];
|
||||
}
|
||||
|
||||
if (ferror (fp))
|
||||
if (FERROR (fp))
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
if (!STREQ (file, "-"))
|
||||
fclose (fp);
|
||||
FCLOSE (fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!STREQ (file, "-") && fclose (fp) == EOF)
|
||||
if (!STREQ (file, "-") && FCLOSE (fp) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
return -1;
|
||||
@@ -252,7 +252,7 @@ cksum (char *file, int print_name)
|
||||
printf ("%lu %ld", crc, length);
|
||||
if (print_name)
|
||||
printf (" %s", file);
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -326,7 +326,7 @@ main (int argc, char **argv)
|
||||
errors = 1;
|
||||
}
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
if (have_read_stdin && FCLOSE (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+7
-7
@@ -103,7 +103,7 @@ writeline (struct linebuffer *line, FILE *stream, int class)
|
||||
return;
|
||||
/* Skip the tab stop for case 1, if we are printing case 1. */
|
||||
if (only_file_1)
|
||||
putc ('\t', stream);
|
||||
PUTC ('\t', stream);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
@@ -111,15 +111,15 @@ writeline (struct linebuffer *line, FILE *stream, int class)
|
||||
return;
|
||||
/* Skip the tab stop for case 1, if we are printing case 1. */
|
||||
if (only_file_1)
|
||||
putc ('\t', stream);
|
||||
PUTC ('\t', stream);
|
||||
/* Skip the tab stop for case 2, if we are printing case 2. */
|
||||
if (only_file_2)
|
||||
putc ('\t', stream);
|
||||
PUTC ('\t', stream);
|
||||
break;
|
||||
}
|
||||
|
||||
fwrite (line->buffer, sizeof (char), line->length, stream);
|
||||
putc ('\n', stream);
|
||||
FWRITE (line->buffer, sizeof (char), line->length, stream);
|
||||
PUTC ('\n', stream);
|
||||
}
|
||||
|
||||
/* Compare INFILES[0] and INFILES[1].
|
||||
@@ -197,13 +197,13 @@ compare_files (char **infiles)
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
free (lb1[i].buffer);
|
||||
if (ferror (streams[i]) || fclose (streams[i]) == EOF)
|
||||
if (FERROR (streams[i]) || fclose (streams[i]) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", infiles[i]);
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
if (FERROR (stdout) || fclose (stdout) == EOF)
|
||||
{
|
||||
error (0, errno, _("write error"));
|
||||
ret = 1;
|
||||
|
||||
+3
-3
@@ -1001,7 +1001,7 @@ close_output_file (void)
|
||||
{
|
||||
if (output_stream)
|
||||
{
|
||||
if (ferror (output_stream) || fclose (output_stream) == EOF)
|
||||
if (FERROR (output_stream) || fclose (output_stream) == EOF)
|
||||
{
|
||||
error (0, errno, _("write error for `%s'"), output_filename);
|
||||
output_stream = NULL;
|
||||
@@ -1030,7 +1030,7 @@ close_output_file (void)
|
||||
static void
|
||||
save_line_to_file (const struct cstring *line)
|
||||
{
|
||||
fwrite (line->str, sizeof (char), line->len, output_stream);
|
||||
FWRITE (line->str, sizeof (char), line->len, output_stream);
|
||||
bytes_written += line->len;
|
||||
}
|
||||
|
||||
@@ -1497,7 +1497,7 @@ main (int argc, char **argv)
|
||||
cleanup_fatal ();
|
||||
}
|
||||
|
||||
if (!suppress_count && (ferror (stdout) || fclose (stdout) == EOF))
|
||||
if (!suppress_count && (FERROR (stdout) || fclose (stdout) == EOF))
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
@@ -254,7 +254,7 @@ getstr (char **lineptr, int *n, FILE *stream, char terminator)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
register int c = getc (stream);
|
||||
register int c = GETC (stream);
|
||||
|
||||
/* We always want at least one char left in the buffer, since we
|
||||
always (unless we get an error while reading the first char)
|
||||
@@ -276,7 +276,7 @@ getstr (char **lineptr, int *n, FILE *stream, char terminator)
|
||||
assert (*n - nchars_avail == read_pos - *lineptr);
|
||||
}
|
||||
|
||||
if (feof (stream) || ferror (stream))
|
||||
if (FEOF (stream) || ferror (stream))
|
||||
{
|
||||
/* Return partial line, if any. */
|
||||
if (read_pos == *lineptr)
|
||||
@@ -484,17 +484,17 @@ cut_bytes (FILE *stream)
|
||||
{
|
||||
register int c; /* Each character from the file. */
|
||||
|
||||
c = getc (stream);
|
||||
c = GETC (stream);
|
||||
|
||||
if (c == '\n')
|
||||
{
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
byte_idx = 0;
|
||||
}
|
||||
else if (c == EOF)
|
||||
{
|
||||
if (byte_idx > 0)
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -502,7 +502,7 @@ cut_bytes (FILE *stream)
|
||||
++byte_idx;
|
||||
if (print_kth (byte_idx))
|
||||
{
|
||||
putchar (c);
|
||||
PUTCHAR (c);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -522,7 +522,7 @@ cut_fields (FILE *stream)
|
||||
found_any_selected_field = 0;
|
||||
field_idx = 1;
|
||||
|
||||
c = getc (stream);
|
||||
c = GETC (stream);
|
||||
empty_input = (c == EOF);
|
||||
if (c != EOF)
|
||||
ungetc (c, stream);
|
||||
@@ -558,17 +558,17 @@ cut_fields (FILE *stream)
|
||||
}
|
||||
else
|
||||
{
|
||||
fwrite (field_1_buffer, sizeof (char), len, stdout);
|
||||
FWRITE (field_1_buffer, sizeof (char), len, stdout);
|
||||
/* Make sure the output line is newline terminated. */
|
||||
if (field_1_buffer[len - 1] != '\n')
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (print_kth (1))
|
||||
{
|
||||
/* Print the field, but not the trailing delimiter. */
|
||||
fwrite (field_1_buffer, sizeof (char), len - 1, stdout);
|
||||
FWRITE (field_1_buffer, sizeof (char), len - 1, stdout);
|
||||
found_any_selected_field = 1;
|
||||
}
|
||||
++field_idx;
|
||||
@@ -581,18 +581,18 @@ cut_fields (FILE *stream)
|
||||
if (found_any_selected_field)
|
||||
{
|
||||
/* FIXME: use output delimiter here */
|
||||
putchar (delim);
|
||||
PUTCHAR (delim);
|
||||
}
|
||||
found_any_selected_field = 1;
|
||||
|
||||
while ((c = getc (stream)) != delim && c != '\n' && c != EOF)
|
||||
while ((c = GETC (stream)) != delim && c != '\n' && c != EOF)
|
||||
{
|
||||
putchar (c);
|
||||
PUTCHAR (c);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((c = getc (stream)) != delim && c != '\n' && c != EOF)
|
||||
while ((c = GETC (stream)) != delim && c != '\n' && c != EOF)
|
||||
{
|
||||
/* Empty. */
|
||||
}
|
||||
@@ -601,7 +601,7 @@ cut_fields (FILE *stream)
|
||||
|
||||
if (c == '\n')
|
||||
{
|
||||
c = getc (stream);
|
||||
c = GETC (stream);
|
||||
if (c != EOF)
|
||||
{
|
||||
ungetc (c, stream);
|
||||
@@ -615,7 +615,7 @@ cut_fields (FILE *stream)
|
||||
{
|
||||
if (found_any_selected_field
|
||||
|| (!empty_input && !(suppress_non_delimited && field_idx == 1)))
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
if (c == EOF)
|
||||
break;
|
||||
field_idx = 1;
|
||||
@@ -658,14 +658,14 @@ cut_file (char *file)
|
||||
|
||||
cut_stream (stream);
|
||||
|
||||
if (ferror (stream))
|
||||
if (FERROR (stream))
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
return 1;
|
||||
}
|
||||
if (STREQ (file, "-"))
|
||||
clearerr (stream); /* Also clear EOF. */
|
||||
else if (fclose (stream) == EOF)
|
||||
CLEARERR (stream); /* Also clear EOF. */
|
||||
else if (FCLOSE (stream) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
return 1;
|
||||
@@ -765,12 +765,12 @@ main (int argc, char **argv)
|
||||
for (; optind < argc; optind++)
|
||||
exit_status |= cut_file (argv[optind]);
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
if (have_read_stdin && FCLOSE (stdin) == EOF)
|
||||
{
|
||||
error (0, errno, "-");
|
||||
exit_status = 1;
|
||||
}
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
if (FERROR (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
|
||||
+9
-9
@@ -202,14 +202,14 @@ next_file (FILE *fp)
|
||||
|
||||
if (fp)
|
||||
{
|
||||
if (ferror (fp))
|
||||
if (FERROR (fp))
|
||||
{
|
||||
error (0, errno, "%s", prev_file);
|
||||
exit_status = 1;
|
||||
}
|
||||
if (fp == stdin)
|
||||
clearerr (fp); /* Also clear EOF. */
|
||||
else if (fclose (fp) == EOF)
|
||||
CLEARERR (fp); /* Also clear EOF. */
|
||||
else if (FCLOSE (fp) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", prev_file);
|
||||
exit_status = 1;
|
||||
@@ -254,7 +254,7 @@ expand (void)
|
||||
return;
|
||||
for (;;)
|
||||
{
|
||||
c = getc (fp);
|
||||
c = GETC (fp);
|
||||
if (c == EOF)
|
||||
{
|
||||
fp = next_file (fp);
|
||||
@@ -266,7 +266,7 @@ expand (void)
|
||||
|
||||
if (c == '\n')
|
||||
{
|
||||
putchar (c);
|
||||
PUTCHAR (c);
|
||||
tab_index = 0;
|
||||
column = 0;
|
||||
convert = 1;
|
||||
@@ -292,7 +292,7 @@ expand (void)
|
||||
}
|
||||
while (column < next_tab_column)
|
||||
{
|
||||
putchar (' ');
|
||||
PUTCHAR (' ');
|
||||
++column;
|
||||
}
|
||||
}
|
||||
@@ -312,7 +312,7 @@ expand (void)
|
||||
convert = 0;
|
||||
}
|
||||
}
|
||||
putchar (c);
|
||||
PUTCHAR (c);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -387,9 +387,9 @@ main (int argc, char **argv)
|
||||
|
||||
expand ();
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
if (have_read_stdin && FCLOSE (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
if (FERROR (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
|
||||
@@ -409,7 +409,7 @@ main (register int argc, register char **argv)
|
||||
if (in_stream != NULL)
|
||||
{
|
||||
fmt (in_stream);
|
||||
if (fclose (in_stream) == EOF)
|
||||
if (FCLOSE (in_stream) == EOF)
|
||||
error (EXIT_FAILURE, errno, file);
|
||||
}
|
||||
else
|
||||
@@ -418,7 +418,7 @@ main (register int argc, register char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
if (FERROR (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
@@ -497,7 +497,7 @@ get_paragraph (FILE *f)
|
||||
next_char = EOF;
|
||||
return FALSE;
|
||||
}
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
c = get_prefix (f);
|
||||
}
|
||||
|
||||
@@ -573,13 +573,13 @@ copy_rest (FILE *f, register int c)
|
||||
{
|
||||
put_space (next_prefix_indent);
|
||||
for (s = prefix; out_column != in_column && *s; out_column++)
|
||||
putchar (*s++);
|
||||
PUTCHAR (*s++);
|
||||
put_space (in_column - out_column);
|
||||
}
|
||||
while (c != '\n' && c != EOF)
|
||||
{
|
||||
putchar (c);
|
||||
c = getc (f);
|
||||
PUTCHAR (c);
|
||||
c = GETC (f);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@@ -625,7 +625,7 @@ get_line (FILE *f, register int c)
|
||||
if (wptr == end_of_parabuf)
|
||||
flush_paragraph ();
|
||||
*wptr++ = c;
|
||||
c = getc (f);
|
||||
c = GETC (f);
|
||||
}
|
||||
while (c != EOF && !ISSPACE (c));
|
||||
in_column += word_limit->length = wptr - word_limit->text;
|
||||
@@ -661,7 +661,7 @@ get_prefix (FILE *f)
|
||||
register const char *p;
|
||||
|
||||
in_column = 0;
|
||||
c = get_space (f, getc (f));
|
||||
c = get_space (f, GETC (f));
|
||||
if (prefix_length == 0)
|
||||
next_prefix_indent = prefix_lead_space < in_column ?
|
||||
prefix_lead_space : in_column;
|
||||
@@ -673,7 +673,7 @@ get_prefix (FILE *f)
|
||||
if (c != *p)
|
||||
return c;
|
||||
in_column++;
|
||||
c = getc (f);
|
||||
c = GETC (f);
|
||||
}
|
||||
c = get_space (f, c);
|
||||
}
|
||||
@@ -697,7 +697,7 @@ get_space (FILE *f, register int c)
|
||||
}
|
||||
else
|
||||
return c;
|
||||
c = getc (f);
|
||||
c = GETC (f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -919,7 +919,7 @@ put_line (register WORD *w, int indent)
|
||||
}
|
||||
put_word (w);
|
||||
last_line_length = out_column;
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
|
||||
/* Output to stdout the word W. */
|
||||
@@ -932,7 +932,7 @@ put_word (register WORD *w)
|
||||
|
||||
s = w->text;
|
||||
for (n = w->length; n != 0; n--)
|
||||
putchar (*s++);
|
||||
PUTCHAR (*s++);
|
||||
out_column += w->length;
|
||||
}
|
||||
|
||||
@@ -950,13 +950,13 @@ put_space (int space)
|
||||
if (out_column + 1 < tab_target)
|
||||
while (out_column < tab_target)
|
||||
{
|
||||
putchar ('\t');
|
||||
PUTCHAR ('\t');
|
||||
out_column = (out_column / TABWIDTH + 1) * TABWIDTH;
|
||||
}
|
||||
}
|
||||
while (out_column < space_target)
|
||||
{
|
||||
putchar (' ');
|
||||
PUTCHAR (' ');
|
||||
out_column++;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -134,7 +134,7 @@ fold_file (char *filename, int width)
|
||||
return 1;
|
||||
}
|
||||
|
||||
while ((c = getc (istream)) != EOF)
|
||||
while ((c = GETC (istream)) != EOF)
|
||||
{
|
||||
if (offset_out + 1 >= allocated_out)
|
||||
{
|
||||
@@ -145,7 +145,7 @@ fold_file (char *filename, int width)
|
||||
if (c == '\n')
|
||||
{
|
||||
line_out[offset_out++] = c;
|
||||
fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
|
||||
FWRITE (line_out, sizeof (char), (size_t) offset_out, stdout);
|
||||
column = offset_out = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -173,9 +173,9 @@ fold_file (char *filename, int width)
|
||||
|
||||
/* Found a blank. Don't output the part after it. */
|
||||
logical_end++;
|
||||
fwrite (line_out, sizeof (char), (size_t) logical_end,
|
||||
FWRITE (line_out, sizeof (char), (size_t) logical_end,
|
||||
stdout);
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
/* Move the remainder to the beginning of the next line.
|
||||
The areas being copied here might overlap. */
|
||||
memmove (line_out, line_out + logical_end,
|
||||
@@ -195,7 +195,7 @@ fold_file (char *filename, int width)
|
||||
}
|
||||
}
|
||||
line_out[offset_out++] = '\n';
|
||||
fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
|
||||
FWRITE (line_out, sizeof (char), (size_t) offset_out, stdout);
|
||||
column = offset_out = 0;
|
||||
goto rescan;
|
||||
}
|
||||
@@ -204,22 +204,22 @@ fold_file (char *filename, int width)
|
||||
}
|
||||
|
||||
if (offset_out)
|
||||
fwrite (line_out, sizeof (char), (size_t) offset_out, stdout);
|
||||
FWRITE (line_out, sizeof (char), (size_t) offset_out, stdout);
|
||||
|
||||
if (ferror (istream))
|
||||
if (FERROR (istream))
|
||||
{
|
||||
error (0, errno, "%s", filename);
|
||||
if (!STREQ (filename, "-"))
|
||||
fclose (istream);
|
||||
FCLOSE (istream);
|
||||
return 1;
|
||||
}
|
||||
if (!STREQ (filename, "-") && fclose (istream) == EOF)
|
||||
if (!STREQ (filename, "-") && FCLOSE (istream) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ferror (stdout))
|
||||
if (FERROR (stdout))
|
||||
{
|
||||
error (0, errno, _("write error"));
|
||||
return 1;
|
||||
@@ -304,9 +304,9 @@ main (int argc, char **argv)
|
||||
for (i = optind; i < argc; i++)
|
||||
errs |= fold_file (argv[i], width);
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
if (have_read_stdin && FCLOSE (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (fclose (stdout) == EOF)
|
||||
if (FCLOSE (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (errs == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
|
||||
+3
-3
@@ -136,7 +136,7 @@ head_bytes (const char *filename, int fd, U_LONG_LONG bytes_to_write)
|
||||
break;
|
||||
if (bytes_read > bytes_to_write)
|
||||
bytes_read = bytes_to_write;
|
||||
if (fwrite (buffer, 1, bytes_read, stdout) == 0)
|
||||
if (FWRITE (buffer, 1, bytes_read, stdout) == 0)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
bytes_to_write -= bytes_read;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ head_lines (const char *filename, int fd, U_LONG_LONG lines_to_write)
|
||||
while (bytes_to_write < bytes_read)
|
||||
if (buffer[bytes_to_write++] == '\n' && --lines_to_write == 0)
|
||||
break;
|
||||
if (fwrite (buffer, 1, bytes_to_write, stdout) == 0)
|
||||
if (FWRITE (buffer, 1, bytes_to_write, stdout) == 0)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
return 0;
|
||||
@@ -388,7 +388,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (have_read_stdin && close (0) < 0)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (fclose (stdout) == EOF)
|
||||
if (FCLOSE (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
|
||||
+14
-14
@@ -248,12 +248,12 @@ get_line (FILE *fp, struct line *line)
|
||||
int c, i;
|
||||
char *ptr;
|
||||
|
||||
if (feof (fp))
|
||||
if (FEOF (fp))
|
||||
return 0;
|
||||
|
||||
ptr = xmalloc (linesize);
|
||||
|
||||
for (i = 0; (c = getc (fp)) != EOF && c != '\n'; ++i)
|
||||
for (i = 0; (c = GETC (fp)) != EOF && c != '\n'; ++i)
|
||||
{
|
||||
if (i == linesize)
|
||||
{
|
||||
@@ -386,7 +386,7 @@ prfield (int n, struct line *line)
|
||||
{
|
||||
len = line->fields[n].len;
|
||||
if (len)
|
||||
fwrite (line->fields[n].beg, 1, len, stdout);
|
||||
FWRITE (line->fields[n].beg, 1, len, stdout);
|
||||
else if (empty_filler)
|
||||
fputs (empty_filler, stdout);
|
||||
}
|
||||
@@ -435,9 +435,9 @@ prjoin (struct line *line1, struct line *line2)
|
||||
o = o->next;
|
||||
if (o == NULL)
|
||||
break;
|
||||
putchar (tab ? tab : ' ');
|
||||
PUTCHAR (tab ? tab : ' ');
|
||||
}
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -453,26 +453,26 @@ prjoin (struct line *line1, struct line *line2)
|
||||
prfield (join_field_1, line1);
|
||||
for (i = 0; i < join_field_1 && i < line1->nfields; ++i)
|
||||
{
|
||||
putchar (tab ? tab : ' ');
|
||||
PUTCHAR (tab ? tab : ' ');
|
||||
prfield (i, line1);
|
||||
}
|
||||
for (i = join_field_1 + 1; i < line1->nfields; ++i)
|
||||
{
|
||||
putchar (tab ? tab : ' ');
|
||||
PUTCHAR (tab ? tab : ' ');
|
||||
prfield (i, line1);
|
||||
}
|
||||
|
||||
for (i = 0; i < join_field_2 && i < line2->nfields; ++i)
|
||||
{
|
||||
putchar (tab ? tab : ' ');
|
||||
PUTCHAR (tab ? tab : ' ');
|
||||
prfield (i, line2);
|
||||
}
|
||||
for (i = join_field_2 + 1; i < line2->nfields; ++i)
|
||||
{
|
||||
putchar (tab ? tab : ' ');
|
||||
PUTCHAR (tab ? tab : ' ');
|
||||
prfield (i, line2);
|
||||
}
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -850,13 +850,13 @@ main (int argc, char **argv)
|
||||
error (EXIT_FAILURE, errno, _("both files cannot be standard input"));
|
||||
join (fp1, fp2);
|
||||
|
||||
if (fp1 != stdin && fclose (fp1) == EOF)
|
||||
if (fp1 != stdin && FCLOSE (fp1) == EOF)
|
||||
error (EXIT_FAILURE, errno, "%s", names[0]);
|
||||
if (fp2 != stdin && fclose (fp2) == EOF)
|
||||
if (fp2 != stdin && FCLOSE (fp2) == EOF)
|
||||
error (EXIT_FAILURE, errno, "%s", names[1]);
|
||||
if ((fp1 == stdin || fp2 == stdin) && fclose (stdin) == EOF)
|
||||
if ((fp1 == stdin || fp2 == stdin) && FCLOSE (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
if (FERROR (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
+15
-15
@@ -264,11 +264,11 @@ md5_file (const char *filename, int binary, unsigned char *md5_result)
|
||||
{
|
||||
error (0, errno, "%s", filename);
|
||||
if (fp != stdin)
|
||||
fclose (fp);
|
||||
FCLOSE (fp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fp != stdin && fclose (fp) == EOF)
|
||||
if (fp != stdin && FCLOSE (fp) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", filename);
|
||||
return 1;
|
||||
@@ -358,7 +358,7 @@ md5_check (const char *checkfile_name)
|
||||
if (!status_only)
|
||||
{
|
||||
printf (_("%s: FAILED open or read\n"), filename);
|
||||
fflush (stdout);
|
||||
FFLUSH (stdout);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -380,23 +380,23 @@ md5_check (const char *checkfile_name)
|
||||
{
|
||||
printf ("%s: %s\n", filename,
|
||||
(cnt != 16 ? _("FAILED") : _("OK")));
|
||||
fflush (stdout);
|
||||
FFLUSH (stdout);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (!feof (checkfile_stream) && !ferror (checkfile_stream));
|
||||
while (!FEOF (checkfile_stream) && !ferror (checkfile_stream));
|
||||
|
||||
if (line)
|
||||
free (line);
|
||||
|
||||
if (ferror (checkfile_stream))
|
||||
if (FERROR (checkfile_stream))
|
||||
{
|
||||
error (0, 0, _("%s: read error"), checkfile_name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (checkfile_stream != stdin && fclose (checkfile_stream) == EOF)
|
||||
if (checkfile_stream != stdin && FCLOSE (checkfile_stream) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", checkfile_name);
|
||||
return 1;
|
||||
@@ -577,16 +577,16 @@ verifying checksums"));
|
||||
/* Output a leading backslash if the file name contains
|
||||
a newline. */
|
||||
if (strchr (file, '\n'))
|
||||
putchar ('\\');
|
||||
PUTCHAR ('\\');
|
||||
|
||||
for (i = 0; i < 16; ++i)
|
||||
printf ("%02x", md5buffer[i]);
|
||||
|
||||
putchar (' ');
|
||||
PUTCHAR (' ');
|
||||
if (binary)
|
||||
putchar ('*');
|
||||
PUTCHAR ('*');
|
||||
else
|
||||
putchar (' ');
|
||||
PUTCHAR (' ');
|
||||
|
||||
/* Translate each NEWLINE byte to the string, "\\n",
|
||||
and each backslash to "\\\\". */
|
||||
@@ -603,19 +603,19 @@ verifying checksums"));
|
||||
break;
|
||||
|
||||
default:
|
||||
putchar (file[i]);
|
||||
PUTCHAR (file[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fclose (stdout) == EOF)
|
||||
if (FCLOSE (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
if (have_read_stdin && FCLOSE (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("standard input"));
|
||||
|
||||
exit (err == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
|
||||
@@ -295,7 +295,7 @@ proc_header (void)
|
||||
current_regex = &header_regex;
|
||||
if (reset_numbers)
|
||||
line_no = starting_line_number;
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
|
||||
/* Switch to a body section. */
|
||||
@@ -305,7 +305,7 @@ proc_body (void)
|
||||
{
|
||||
current_type = body_type;
|
||||
current_regex = &body_regex;
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
|
||||
/* Switch to a footer section. */
|
||||
@@ -315,7 +315,7 @@ proc_footer (void)
|
||||
{
|
||||
current_type = footer_type;
|
||||
current_regex = &footer_regex;
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
|
||||
/* Process a regular text line in `line_buf'. */
|
||||
@@ -358,8 +358,8 @@ proc_text (void)
|
||||
print_lineno ();
|
||||
break;
|
||||
}
|
||||
fwrite (line_buf.buffer, sizeof (char), line_buf.length, stdout);
|
||||
putchar ('\n');
|
||||
FWRITE (line_buf.buffer, sizeof (char), line_buf.length, stdout);
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
|
||||
/* Return the type of line in `line_buf'. */
|
||||
@@ -431,14 +431,14 @@ nl_file (const char *file)
|
||||
|
||||
process_file (stream);
|
||||
|
||||
if (ferror (stream))
|
||||
if (FERROR (stream))
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
return 1;
|
||||
}
|
||||
if (STREQ (file, "-"))
|
||||
clearerr (stream); /* Also clear EOF. */
|
||||
else if (fclose (stream) == EOF)
|
||||
CLEARERR (stream); /* Also clear EOF. */
|
||||
else if (FCLOSE (stream) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
return 1;
|
||||
@@ -609,12 +609,12 @@ main (int argc, char **argv)
|
||||
for (; optind < argc; optind++)
|
||||
exit_status |= nl_file (argv[optind]);
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
if (have_read_stdin && FCLOSE (stdin) == EOF)
|
||||
{
|
||||
error (0, errno, "-");
|
||||
exit_status = 1;
|
||||
}
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
if (FERROR (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
|
||||
@@ -516,10 +516,10 @@ dump_hexl_mode_trailer (long unsigned int n_bytes, const char *block)
|
||||
{
|
||||
unsigned int c = *(const unsigned char *) block;
|
||||
unsigned int c2 = (ISPRINT(c) ? c : '.');
|
||||
putchar (c2);
|
||||
PUTCHAR (c2);
|
||||
block += sizeof (unsigned char);
|
||||
}
|
||||
putchar ('<');
|
||||
PUTCHAR ('<');
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1010,7 +1010,7 @@ skip (off_t n_skip)
|
||||
if (n_skip >= file_stats.st_size)
|
||||
{
|
||||
n_skip -= file_stats.st_size;
|
||||
if (in_stream != stdin && fclose (in_stream) == EOF)
|
||||
if (in_stream != stdin && FCLOSE (in_stream) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", input_filename);
|
||||
err = 1;
|
||||
@@ -1040,7 +1040,7 @@ skip (off_t n_skip)
|
||||
? BUFSIZ
|
||||
: n_skip % BUFSIZ);
|
||||
size_t n_bytes_read;
|
||||
n_bytes_read = fread (buf, 1, n_bytes_to_read, in_stream);
|
||||
n_bytes_read = FREAD (buf, 1, n_bytes_to_read, in_stream);
|
||||
n_skip -= n_bytes_read;
|
||||
if (n_bytes_read != n_bytes_to_read)
|
||||
break;
|
||||
@@ -1141,7 +1141,7 @@ write_block (long unsigned int current_offset, long unsigned int n_bytes,
|
||||
printf ("%*s", blank_fields * field_width, "");
|
||||
dump_hexl_mode_trailer (n_bytes, curr_block);
|
||||
}
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
}
|
||||
first = 0;
|
||||
@@ -1159,20 +1159,20 @@ check_and_close (void)
|
||||
int err;
|
||||
|
||||
err = 0;
|
||||
if (ferror (in_stream))
|
||||
if (FERROR (in_stream))
|
||||
{
|
||||
error (0, errno, "%s", input_filename);
|
||||
if (in_stream != stdin)
|
||||
fclose (in_stream);
|
||||
FCLOSE (in_stream);
|
||||
err = 1;
|
||||
}
|
||||
else if (in_stream != stdin && fclose (in_stream) == EOF)
|
||||
else if (in_stream != stdin && FCLOSE (in_stream) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", input_filename);
|
||||
err = 1;
|
||||
}
|
||||
|
||||
if (ferror (stdout))
|
||||
if (FERROR (stdout))
|
||||
{
|
||||
error (0, errno, _("standard output"));
|
||||
err = 1;
|
||||
@@ -1252,7 +1252,7 @@ read_char (int *c)
|
||||
Then try to read the remaining bytes from the newly opened file.
|
||||
Repeat if necessary until *FILE_LIST is NULL. Set *N_BYTES_IN_BUFFER
|
||||
to the number of bytes read. If an error occurs, it will be detected
|
||||
through ferror when the stream is about to be closed. If there is an
|
||||
through FERROR when the stream is about to be closed. If there is an
|
||||
error, give a message but continue reading as usual and return nonzero.
|
||||
Otherwise return zero. */
|
||||
|
||||
@@ -1278,7 +1278,7 @@ read_block (size_t n, char *block, size_t *n_bytes_in_buffer)
|
||||
size_t n_read;
|
||||
|
||||
n_needed = n - *n_bytes_in_buffer;
|
||||
n_read = fread (block + *n_bytes_in_buffer, 1, n_needed, in_stream);
|
||||
n_read = FREAD (block + *n_bytes_in_buffer, 1, n_needed, in_stream);
|
||||
|
||||
*n_bytes_in_buffer += n_read;
|
||||
|
||||
@@ -1576,10 +1576,10 @@ dump_strings (void)
|
||||
break;
|
||||
|
||||
default:
|
||||
putc (c, stdout);
|
||||
PUTC (c, stdout);
|
||||
}
|
||||
}
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
|
||||
/* We reach this point only if we search through
|
||||
@@ -1963,10 +1963,10 @@ the maximum\nrepresentable value of type `long'"), optarg);
|
||||
|
||||
cleanup:;
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
if (have_read_stdin && FCLOSE (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("standard input"));
|
||||
|
||||
if (fclose (stdout) == EOF)
|
||||
if (FCLOSE (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
exit (err == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
|
||||
+23
-23
@@ -230,10 +230,10 @@ paste_parallel (int nfiles, char **fnamptr)
|
||||
line_length = 0; /* Clear so we can easily detect EOF. */
|
||||
if (fileptr[i] != CLOSED)
|
||||
{
|
||||
chr = getc (fileptr[i]);
|
||||
chr = GETC (fileptr[i]);
|
||||
if (chr != EOF && delims_saved)
|
||||
{
|
||||
fwrite (delbuf, sizeof (char), delims_saved, stdout);
|
||||
FWRITE (delbuf, sizeof (char), delims_saved, stdout);
|
||||
delims_saved = 0;
|
||||
}
|
||||
|
||||
@@ -242,8 +242,8 @@ paste_parallel (int nfiles, char **fnamptr)
|
||||
line_length++;
|
||||
if (chr == '\n')
|
||||
break;
|
||||
putc (chr, stdout);
|
||||
chr = getc (fileptr[i]);
|
||||
PUTC (chr, stdout);
|
||||
chr = GETC (fileptr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,14 +253,14 @@ paste_parallel (int nfiles, char **fnamptr)
|
||||
If an EOF or error, close the file and mark it in the list. */
|
||||
if (fileptr[i] != CLOSED)
|
||||
{
|
||||
if (ferror (fileptr[i]))
|
||||
if (FERROR (fileptr[i]))
|
||||
{
|
||||
error (0, errno, "%s", fnamptr[i]);
|
||||
errors = 1;
|
||||
}
|
||||
if (fileptr[i] == stdin)
|
||||
clearerr (fileptr[i]); /* Also clear EOF. */
|
||||
else if (fclose (fileptr[i]) == EOF)
|
||||
CLEARERR (fileptr[i]); /* Also clear EOF. */
|
||||
else if (FCLOSE (fileptr[i]) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", fnamptr[i]);
|
||||
errors = 1;
|
||||
@@ -279,10 +279,10 @@ paste_parallel (int nfiles, char **fnamptr)
|
||||
/* No. Some files were not closed for this line. */
|
||||
if (delims_saved)
|
||||
{
|
||||
fwrite (delbuf, sizeof (char), delims_saved, stdout);
|
||||
FWRITE (delbuf, sizeof (char), delims_saved, stdout);
|
||||
delims_saved = 0;
|
||||
}
|
||||
putc ('\n', stdout);
|
||||
PUTC ('\n', stdout);
|
||||
}
|
||||
continue; /* Next read of files, or exit. */
|
||||
}
|
||||
@@ -304,14 +304,14 @@ paste_parallel (int nfiles, char **fnamptr)
|
||||
if (fileptr[i + 1] != ENDLIST)
|
||||
{
|
||||
if (chr != '\n')
|
||||
putc (chr, stdout);
|
||||
PUTC (chr, stdout);
|
||||
if (*delimptr != EMPTY_DELIM)
|
||||
putc (*delimptr, stdout);
|
||||
PUTC (*delimptr, stdout);
|
||||
if (++delimptr == delim_end)
|
||||
delimptr = delims;
|
||||
}
|
||||
else
|
||||
putc (chr, stdout);
|
||||
PUTC (chr, stdout);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -350,7 +350,7 @@ paste_serial (int nfiles, char **fnamptr)
|
||||
|
||||
delimptr = delims; /* Set up for delimiter string. */
|
||||
|
||||
charold = getc (fileptr);
|
||||
charold = GETC (fileptr);
|
||||
if (charold != EOF)
|
||||
{
|
||||
/* `charold' is set up. Hit it!
|
||||
@@ -359,38 +359,38 @@ paste_serial (int nfiles, char **fnamptr)
|
||||
character if needed. After the EOF, output `charold'
|
||||
if it's a newline; otherwise, output it and then a newline. */
|
||||
|
||||
while ((charnew = getc (fileptr)) != EOF)
|
||||
while ((charnew = GETC (fileptr)) != EOF)
|
||||
{
|
||||
/* Process the old character. */
|
||||
if (charold == '\n')
|
||||
{
|
||||
if (*delimptr != EMPTY_DELIM)
|
||||
putc (*delimptr, stdout);
|
||||
PUTC (*delimptr, stdout);
|
||||
|
||||
if (++delimptr == delim_end)
|
||||
delimptr = delims;
|
||||
}
|
||||
else
|
||||
putc (charold, stdout);
|
||||
PUTC (charold, stdout);
|
||||
|
||||
charold = charnew;
|
||||
}
|
||||
|
||||
/* Hit EOF. Process that last character. */
|
||||
putc (charold, stdout);
|
||||
PUTC (charold, stdout);
|
||||
}
|
||||
|
||||
if (charold != '\n')
|
||||
putc ('\n', stdout);
|
||||
PUTC ('\n', stdout);
|
||||
|
||||
if (ferror (fileptr))
|
||||
if (FERROR (fileptr))
|
||||
{
|
||||
error (0, errno, "%s", *fnamptr);
|
||||
errors = 1;
|
||||
}
|
||||
if (fileptr == stdin)
|
||||
clearerr (fileptr); /* Also clear EOF. */
|
||||
else if (fclose (fileptr) == EOF)
|
||||
CLEARERR (fileptr); /* Also clear EOF. */
|
||||
else if (FCLOSE (fileptr) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", *fnamptr);
|
||||
errors = 1;
|
||||
@@ -485,9 +485,9 @@ main (int argc, char **argv)
|
||||
exit_status = paste_parallel (argc - optind, &argv[optind]);
|
||||
else
|
||||
exit_status = paste_serial (argc - optind, &argv[optind]);
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
if (have_read_stdin && FCLOSE (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
if (FERROR (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -884,9 +884,9 @@ main (int argc, char **argv)
|
||||
|
||||
cleanup ();
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
if (have_read_stdin && FCLOSE (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("standard input"));
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
if (FERROR (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
if (failed_opens > 0)
|
||||
exit (EXIT_FAILURE);
|
||||
@@ -1229,9 +1229,9 @@ close_file (COLUMN *p)
|
||||
|
||||
if (p->status == CLOSED)
|
||||
return;
|
||||
if (ferror (p->fp))
|
||||
if (FERROR (p->fp))
|
||||
error (EXIT_FAILURE, errno, "%s", p->name);
|
||||
if (p->fp != stdin && fclose (p->fp) == EOF)
|
||||
if (p->fp != stdin && FCLOSE (p->fp) == EOF)
|
||||
error (EXIT_FAILURE, errno, "%s", p->name);
|
||||
|
||||
if (!parallel_files)
|
||||
@@ -1580,7 +1580,7 @@ print_page (void)
|
||||
|
||||
if (pad_vertically)
|
||||
{
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
--lines_left_on_page;
|
||||
}
|
||||
|
||||
@@ -1589,7 +1589,7 @@ print_page (void)
|
||||
|
||||
if (double_space && pv)
|
||||
{
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
--lines_left_on_page;
|
||||
}
|
||||
}
|
||||
@@ -1605,7 +1605,7 @@ print_page (void)
|
||||
pad_down (lines_left_on_page + lines_per_footer);
|
||||
else if (keep_FF && print_a_FF)
|
||||
{
|
||||
putchar ('\f');
|
||||
PUTCHAR ('\f');
|
||||
print_a_FF = FALSE;
|
||||
}
|
||||
|
||||
@@ -1788,7 +1788,7 @@ pad_across_to (int position)
|
||||
else
|
||||
{
|
||||
while (++h <= position)
|
||||
putchar (' ');
|
||||
PUTCHAR (' ');
|
||||
output_position = position;
|
||||
}
|
||||
}
|
||||
@@ -1804,10 +1804,10 @@ pad_down (int lines)
|
||||
register int i;
|
||||
|
||||
if (use_form_feed)
|
||||
putchar ('\f');
|
||||
PUTCHAR ('\f');
|
||||
else
|
||||
for (i = lines; i; --i)
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
}
|
||||
|
||||
/* Read the rest of the line.
|
||||
@@ -1822,11 +1822,11 @@ read_rest_of_line (COLUMN *p)
|
||||
register int c;
|
||||
FILE *f = p->fp;
|
||||
|
||||
while ((c = getc (f)) != '\n')
|
||||
while ((c = GETC (f)) != '\n')
|
||||
{
|
||||
if (c == '\f')
|
||||
{
|
||||
if ((c = getc (f)) != '\n')
|
||||
if ((c = GETC (f)) != '\n')
|
||||
ungetc (c, f);
|
||||
if (keep_FF)
|
||||
print_a_FF = TRUE;
|
||||
@@ -1859,11 +1859,11 @@ skip_read (COLUMN *p, int column_number)
|
||||
COLUMN *q;
|
||||
|
||||
/* Read 1st character in a line or any character succeeding a FF */
|
||||
if ((c = getc (f)) == '\f' && p->full_page_printed)
|
||||
if ((c = GETC (f)) == '\f' && p->full_page_printed)
|
||||
/* A FF-coincidence with a previous full_page_printed.
|
||||
To avoid an additional empty page, eliminate the FF */
|
||||
if ((c = getc (f)) == '\n')
|
||||
c = getc (f);
|
||||
if ((c = GETC (f)) == '\n')
|
||||
c = GETC (f);
|
||||
|
||||
p->full_page_printed = FALSE;
|
||||
|
||||
@@ -1892,7 +1892,7 @@ skip_read (COLUMN *p, int column_number)
|
||||
p->full_page_printed = FALSE;
|
||||
}
|
||||
|
||||
if ((c = getc (f)) != '\n')
|
||||
if ((c = GETC (f)) != '\n')
|
||||
ungetc (c, f);
|
||||
hold_file (p);
|
||||
break;
|
||||
@@ -1902,7 +1902,7 @@ skip_read (COLUMN *p, int column_number)
|
||||
close_file (p);
|
||||
break;
|
||||
}
|
||||
c = getc (f);
|
||||
c = GETC (f);
|
||||
}
|
||||
|
||||
if (skip_count)
|
||||
@@ -1926,11 +1926,11 @@ print_white_space (void)
|
||||
while (goal - h_old > 1
|
||||
&& (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
|
||||
{
|
||||
putchar (output_tab_char);
|
||||
PUTCHAR (output_tab_char);
|
||||
h_old = h_new;
|
||||
}
|
||||
while (++h_old <= goal)
|
||||
putchar (' ');
|
||||
PUTCHAR (' ');
|
||||
|
||||
output_position = goal;
|
||||
spaces_not_printed = 0;
|
||||
@@ -1955,7 +1955,7 @@ print_sep_string ()
|
||||
for (; separators_not_printed > 0; --separators_not_printed)
|
||||
{
|
||||
while (l-- > 0)
|
||||
putchar (*s++);
|
||||
PUTCHAR (*s++);
|
||||
output_position += col_sep_length;
|
||||
}
|
||||
}
|
||||
@@ -2001,7 +2001,7 @@ print_char (int c)
|
||||
else
|
||||
++output_position;
|
||||
}
|
||||
putchar (c);
|
||||
PUTCHAR (c);
|
||||
}
|
||||
|
||||
/* Skip to page PAGE before printing. */
|
||||
@@ -2094,19 +2094,19 @@ read_line (COLUMN *p)
|
||||
#endif
|
||||
|
||||
/* read 1st character in each line or any character succeeding a FF: */
|
||||
c = getc (p->fp);
|
||||
c = GETC (p->fp);
|
||||
|
||||
last_input_position = input_position;
|
||||
|
||||
if (c == '\f' && p->full_page_printed)
|
||||
if ((c = getc (p->fp)) == '\n')
|
||||
c = getc (p->fp);
|
||||
if ((c = GETC (p->fp)) == '\n')
|
||||
c = GETC (p->fp);
|
||||
p->full_page_printed = FALSE;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\f':
|
||||
if ((c = getc (p->fp)) != '\n')
|
||||
if ((c = GETC (p->fp)) != '\n')
|
||||
ungetc (c, p->fp);
|
||||
FF_only = TRUE;
|
||||
if (print_a_header && !storing_columns)
|
||||
@@ -2179,14 +2179,14 @@ read_line (COLUMN *p)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
c = getc (p->fp);
|
||||
c = GETC (p->fp);
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\n':
|
||||
return TRUE;
|
||||
case '\f':
|
||||
if ((c = getc (p->fp)) != '\n')
|
||||
if ((c = GETC (p->fp)) != '\n')
|
||||
ungetc (c, p->fp);
|
||||
if (keep_FF)
|
||||
print_a_FF = TRUE;
|
||||
|
||||
+21
-21
@@ -381,12 +381,12 @@ xfclose (FILE *fp)
|
||||
if (fp == stdin)
|
||||
{
|
||||
/* Allow reading stdin from tty more than once. */
|
||||
if (feof (fp))
|
||||
clearerr (fp);
|
||||
if (FEOF (fp))
|
||||
CLEARERR (fp);
|
||||
}
|
||||
else if (fp == stdout)
|
||||
{
|
||||
if (fflush (fp) != 0)
|
||||
if (FFLUSH (fp) != 0)
|
||||
{
|
||||
error (0, errno, _("flushing file"));
|
||||
cleanup ();
|
||||
@@ -395,7 +395,7 @@ xfclose (FILE *fp)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fclose (fp) != 0)
|
||||
if (FCLOSE (fp) != 0)
|
||||
{
|
||||
error (0, errno, _("error closing file"));
|
||||
cleanup ();
|
||||
@@ -407,7 +407,7 @@ xfclose (FILE *fp)
|
||||
static void
|
||||
write_bytes (const char *buf, size_t n_bytes, FILE *fp)
|
||||
{
|
||||
if (fwrite (buf, 1, n_bytes, fp) != n_bytes)
|
||||
if (FWRITE (buf, 1, n_bytes, fp) != n_bytes)
|
||||
{
|
||||
error (0, errno, _("write error"));
|
||||
cleanup ();
|
||||
@@ -618,7 +618,7 @@ fillbuf (struct buffer *buf, FILE *fp)
|
||||
memmove (buf->buf, buf->buf + buf->used - buf->left, buf->left);
|
||||
buf->used = buf->left;
|
||||
|
||||
while (!feof (fp) && (buf->used == 0
|
||||
while (!FEOF (fp) && (buf->used == 0
|
||||
|| !memchr (buf->buf, eolchar, buf->used)))
|
||||
{
|
||||
if (buf->used == buf->alloc)
|
||||
@@ -626,8 +626,8 @@ fillbuf (struct buffer *buf, FILE *fp)
|
||||
buf->alloc *= 2;
|
||||
buf->buf = xrealloc (buf->buf, buf->alloc);
|
||||
}
|
||||
cc = fread (buf->buf + buf->used, 1, buf->alloc - buf->used, fp);
|
||||
if (ferror (fp))
|
||||
cc = FREAD (buf->buf + buf->used, 1, buf->alloc - buf->used, fp);
|
||||
if (FERROR (fp))
|
||||
{
|
||||
error (0, errno, _("read error"));
|
||||
cleanup ();
|
||||
@@ -636,7 +636,7 @@ fillbuf (struct buffer *buf, FILE *fp)
|
||||
buf->used += cc;
|
||||
}
|
||||
|
||||
if (feof (fp) && buf->used && buf->buf[buf->used - 1] != eolchar)
|
||||
if (FEOF (fp) && buf->used && buf->buf[buf->used - 1] != eolchar)
|
||||
{
|
||||
if (buf->used == buf->alloc)
|
||||
{
|
||||
@@ -1901,7 +1901,7 @@ finish:
|
||||
fprintf (stderr, _("%s: %s:%d: disorder: "), program_name, file_name,
|
||||
disorder_line_number);
|
||||
write_bytes (disorder_line->text, disorder_line->length, stderr);
|
||||
putc (eolchar, stderr);
|
||||
PUTC (eolchar, stderr);
|
||||
}
|
||||
|
||||
free (buf.buf);
|
||||
@@ -1982,7 +1982,7 @@ mergefps (FILE **fps, register int nfps, FILE *ofp)
|
||||
if (savedflag && compare (&saved, &lines[ord[0]].lines[cur[ord[0]]]))
|
||||
{
|
||||
write_bytes (saved.text, saved.length, ofp);
|
||||
putc (eolchar, ofp);
|
||||
PUTC (eolchar, ofp);
|
||||
savedflag = 0;
|
||||
}
|
||||
if (!savedflag)
|
||||
@@ -2015,7 +2015,7 @@ mergefps (FILE **fps, register int nfps, FILE *ofp)
|
||||
{
|
||||
write_bytes (lines[ord[0]].lines[cur[ord[0]]].text,
|
||||
lines[ord[0]].lines[cur[ord[0]]].length, ofp);
|
||||
putc (eolchar, ofp);
|
||||
PUTC (eolchar, ofp);
|
||||
}
|
||||
|
||||
/* Check if we need to read more lines into core. */
|
||||
@@ -2070,7 +2070,7 @@ mergefps (FILE **fps, register int nfps, FILE *ofp)
|
||||
if (unique && savedflag)
|
||||
{
|
||||
write_bytes (saved.text, saved.length, ofp);
|
||||
putc (eolchar, ofp);
|
||||
PUTC (eolchar, ofp);
|
||||
free (saved.text);
|
||||
}
|
||||
}
|
||||
@@ -2279,7 +2279,7 @@ sort (char **files, int nfiles, FILE *ofp)
|
||||
nls_numeric_format (lines.lines, lines.used);
|
||||
#endif
|
||||
sortlines (lines.lines, lines.used, tmp);
|
||||
if (feof (fp) && !nfiles && !n_temp_files && !buf.left)
|
||||
if (FEOF (fp) && !nfiles && !n_temp_files && !buf.left)
|
||||
tfp = ofp;
|
||||
else
|
||||
{
|
||||
@@ -2291,7 +2291,7 @@ sort (char **files, int nfiles, FILE *ofp)
|
||||
|| compare (&lines.lines[i], &lines.lines[i - 1]))
|
||||
{
|
||||
write_bytes (lines.lines[i].text, lines.lines[i].length, tfp);
|
||||
putc (eolchar, tfp);
|
||||
PUTC (eolchar, tfp);
|
||||
}
|
||||
if (tfp != ofp)
|
||||
xfclose (tfp);
|
||||
@@ -2883,9 +2883,9 @@ but lacks following character offset"));
|
||||
fp = xfopen (files[i], "r");
|
||||
tmp = tempname ();
|
||||
ofp = xtmpfopen (tmp);
|
||||
while ((cc = fread (buf, 1, sizeof buf, fp)) > 0)
|
||||
while ((cc = FREAD (buf, 1, sizeof buf, fp)) > 0)
|
||||
write_bytes (buf, cc, ofp);
|
||||
if (ferror (fp))
|
||||
if (FERROR (fp))
|
||||
{
|
||||
error (0, errno, "%s", files[i]);
|
||||
cleanup ();
|
||||
@@ -2910,14 +2910,14 @@ but lacks following character offset"));
|
||||
/* If we wait for the implicit flush on exit, and the parent process
|
||||
has closed stdout (e.g., exec >&- in a shell), then the output file
|
||||
winds up empty. I don't understand why. This is under SunOS,
|
||||
Solaris, Ultrix, and Irix. This premature fflush makes the output
|
||||
Solaris, Ultrix, and Irix. This premature FFLUSH makes the output
|
||||
reappear. --karl@cs.umb.edu */
|
||||
if (fflush (ofp) < 0)
|
||||
if (FFLUSH (ofp) < 0)
|
||||
error (SORT_FAILURE, errno, _("%s: write error"), outfile);
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
if (have_read_stdin && FCLOSE (stdin) == EOF)
|
||||
error (SORT_FAILURE, errno, outfile);
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
if (FERROR (stdout) || fclose (stdout) == EOF)
|
||||
error (SORT_FAILURE, errno, _("%s: write error"), outfile);
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
|
||||
@@ -107,7 +107,7 @@ bsd_sum_file (const char *file, int print_name)
|
||||
}
|
||||
}
|
||||
|
||||
while ((ch = getc (fp)) != EOF)
|
||||
while ((ch = GETC (fp)) != EOF)
|
||||
{
|
||||
total_bytes++;
|
||||
ROTATE_RIGHT (checksum);
|
||||
@@ -115,15 +115,15 @@ bsd_sum_file (const char *file, int print_name)
|
||||
checksum &= 0xffff; /* Keep it within bounds. */
|
||||
}
|
||||
|
||||
if (ferror (fp))
|
||||
if (FERROR (fp))
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
if (!STREQ (file, "-"))
|
||||
fclose (fp);
|
||||
FCLOSE (fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!STREQ (file, "-") && fclose (fp) == EOF)
|
||||
if (!STREQ (file, "-") && FCLOSE (fp) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
return -1;
|
||||
@@ -132,7 +132,7 @@ bsd_sum_file (const char *file, int print_name)
|
||||
printf ("%05lu %5ld", checksum, (total_bytes + 1024 - 1) / 1024);
|
||||
if (print_name > 1)
|
||||
printf (" %s", file);
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ sysv_sum_file (const char *file, int print_name)
|
||||
printf ("%lu %ld", checksum % 0xffff, (total_bytes + 512 - 1) / 512);
|
||||
if (print_name)
|
||||
printf (" %s", file);
|
||||
putchar ('\n');
|
||||
PUTCHAR ('\n');
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ main (int argc, char **argv)
|
||||
if ((*sum_func) (argv[optind], files_given) < 0)
|
||||
errors = 1;
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
if (have_read_stdin && FCLOSE (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+1
-1
@@ -208,7 +208,7 @@ print_line (FILE *out_stream, const Buf *x,
|
||||
{
|
||||
char *a = (i == bol->i ? bol->ptr : x->p[i].start);
|
||||
char *b = (i == bol_next->i ? bol_next->ptr : ONE_PAST_END (x, i));
|
||||
fwrite (a, 1, b - a, out_stream);
|
||||
FWRITE (a, 1, b - a, out_stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ output (const char *start, const char *past_end)
|
||||
|
||||
if (start == 0)
|
||||
{
|
||||
fwrite (buffer, 1, bytes_in_buffer, stdout);
|
||||
FWRITE (buffer, 1, bytes_in_buffer, stdout);
|
||||
bytes_in_buffer = 0;
|
||||
return;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ output (const char *start, const char *past_end)
|
||||
memcpy (buffer + bytes_in_buffer, start, bytes_available);
|
||||
bytes_to_add -= bytes_available;
|
||||
start += bytes_available;
|
||||
fwrite (buffer, 1, WRITESIZE, stdout);
|
||||
FWRITE (buffer, 1, WRITESIZE, stdout);
|
||||
bytes_in_buffer = 0;
|
||||
bytes_available = WRITESIZE;
|
||||
}
|
||||
@@ -368,7 +368,7 @@ tac_file (const char *file)
|
||||
return 1;
|
||||
}
|
||||
errors = tac_seekable (fileno (in), file);
|
||||
if (ferror (in) || fclose (in) == EOF)
|
||||
if (FERROR (in) || fclose (in) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", file);
|
||||
return 1;
|
||||
@@ -417,10 +417,10 @@ save_stdin (FILE **g_tmp, char **g_tempfile)
|
||||
error (EXIT_FAILURE, errno, _("stdin: read error"));
|
||||
|
||||
/* Don't bother checking for failure inside the loop -- check after. */
|
||||
fwrite (G_buffer, 1, bytes_read, tmp);
|
||||
FWRITE (G_buffer, 1, bytes_read, tmp);
|
||||
}
|
||||
|
||||
if (ferror (tmp) || fflush (tmp) == EOF)
|
||||
if (FERROR (tmp) || fflush (tmp) == EOF)
|
||||
error (EXIT_FAILURE, errno, "%s", tempfile);
|
||||
|
||||
rewind (tmp);
|
||||
@@ -497,18 +497,18 @@ tac_mem (const char *buf, size_t n_bytes, FILE *out)
|
||||
if (bol < buf + n_bytes)
|
||||
{
|
||||
/* Print out the line from bol to end of input. */
|
||||
fwrite (bol, 1, (buf + n_bytes) - bol, out);
|
||||
FWRITE (bol, 1, (buf + n_bytes) - bol, out);
|
||||
|
||||
/* Add a newline here. Otherwise, the first and second lines
|
||||
of output would appear to have been joined. */
|
||||
fputc ('\n', out);
|
||||
FPUTC ('\n', out);
|
||||
}
|
||||
|
||||
while ((nl = memrchr (buf, bol - 1, '\n')) != NULL)
|
||||
{
|
||||
/* Output the line (which includes a trailing newline)
|
||||
from NL+1 to BOL-1. */
|
||||
fwrite (nl + 1, 1, bol - (nl + 1), out);
|
||||
FWRITE (nl + 1, 1, bol - (nl + 1), out);
|
||||
|
||||
bol = nl + 1;
|
||||
}
|
||||
@@ -517,10 +517,10 @@ tac_mem (const char *buf, size_t n_bytes, FILE *out)
|
||||
When the first byte of the input is a newline, there is nothing
|
||||
left to do here. */
|
||||
if (buf < bol)
|
||||
fwrite (buf, 1, bol - buf, out);
|
||||
FWRITE (buf, 1, bol - buf, out);
|
||||
|
||||
/* FIXME: this is work in progress.... */
|
||||
return ferror (out);
|
||||
return FERROR (out);
|
||||
}
|
||||
|
||||
/* FIXME: describe */
|
||||
@@ -669,7 +669,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (have_read_stdin && close (0) < 0)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (ferror (stdout) || fclose (stdout) == EOF)
|
||||
if (FERROR (stdout) || fclose (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+3
-3
@@ -197,7 +197,7 @@ xwrite (int fd, char *const buffer, size_t n_bytes)
|
||||
{
|
||||
assert (fd == 1);
|
||||
assert (n_bytes >= 0);
|
||||
if (n_bytes > 0 && fwrite (buffer, 1, n_bytes, stdout) == 0)
|
||||
if (n_bytes > 0 && FWRITE (buffer, 1, n_bytes, stdout) == 0)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ dump_remainder (const char *pretty_filename, int fd)
|
||||
error (EXIT_FAILURE, errno, "%s", pretty_filename);
|
||||
|
||||
if (forever)
|
||||
fflush (stdout);
|
||||
FFLUSH (stdout);
|
||||
|
||||
return total;
|
||||
}
|
||||
@@ -1291,7 +1291,7 @@ main (int argc, char **argv)
|
||||
|
||||
if (have_read_stdin && close (0) < 0)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (fclose (stdout) == EOF)
|
||||
if (FCLOSE (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -1667,7 +1667,7 @@ squeeze_filter (unsigned char *buf, long int size, PFI reader)
|
||||
++i;
|
||||
}
|
||||
if (out_len > 0
|
||||
&& fwrite ((char *) &buf[begin], 1, out_len, stdout) == 0)
|
||||
&& FWRITE ((char *) &buf[begin], 1, out_len, stdout) == 0)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
|
||||
@@ -1913,7 +1913,7 @@ without squeezing repeats"));
|
||||
do
|
||||
{
|
||||
nr = read_and_delete (io_buf, IO_BUF_SIZE, NULL);
|
||||
if (nr > 0 && fwrite ((char *) io_buf, 1, nr, stdout) == 0)
|
||||
if (nr > 0 && FWRITE ((char *) io_buf, 1, nr, stdout) == 0)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
while (nr > 0);
|
||||
@@ -2021,14 +2021,14 @@ construct in string1 must be aligned with a corresponding construct\n\
|
||||
{
|
||||
chars_read = read_and_xlate (io_buf, IO_BUF_SIZE, NULL);
|
||||
if (chars_read > 0
|
||||
&& fwrite ((char *) io_buf, 1, chars_read, stdout) == 0)
|
||||
&& FWRITE ((char *) io_buf, 1, chars_read, stdout) == 0)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
}
|
||||
while (chars_read > 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (fclose (stdout) == EOF)
|
||||
if (FCLOSE (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
|
||||
if (close (0) != 0)
|
||||
|
||||
+10
-10
@@ -175,14 +175,14 @@ next_file (FILE *fp)
|
||||
|
||||
if (fp)
|
||||
{
|
||||
if (ferror (fp))
|
||||
if (FERROR (fp))
|
||||
{
|
||||
error (0, errno, "%s", prev_file);
|
||||
exit_status = 1;
|
||||
}
|
||||
if (fp == stdin)
|
||||
clearerr (fp); /* Also clear EOF. */
|
||||
else if (fclose (fp) == EOF)
|
||||
CLEARERR (fp); /* Also clear EOF. */
|
||||
else if (FCLOSE (fp) == EOF)
|
||||
{
|
||||
error (0, errno, "%s", prev_file);
|
||||
exit_status = 1;
|
||||
@@ -231,7 +231,7 @@ unexpand (void)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
c = getc (fp);
|
||||
c = GETC (fp);
|
||||
|
||||
if (c == ' ' && convert)
|
||||
{
|
||||
@@ -270,7 +270,7 @@ unexpand (void)
|
||||
then print the rest as spaces. */
|
||||
if (pending == 1)
|
||||
{
|
||||
putchar (' ');
|
||||
PUTCHAR (' ');
|
||||
pending = 0;
|
||||
}
|
||||
column -= pending;
|
||||
@@ -293,7 +293,7 @@ unexpand (void)
|
||||
}
|
||||
if (next_tab_column - column <= pending)
|
||||
{
|
||||
putchar ('\t');
|
||||
PUTCHAR ('\t');
|
||||
pending -= next_tab_column - column;
|
||||
column = next_tab_column;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ unexpand (void)
|
||||
column += pending;
|
||||
while (pending != 0)
|
||||
{
|
||||
putchar (' ');
|
||||
PUTCHAR (' ');
|
||||
pending--;
|
||||
}
|
||||
}
|
||||
@@ -333,7 +333,7 @@ unexpand (void)
|
||||
}
|
||||
}
|
||||
|
||||
putchar (c);
|
||||
PUTCHAR (c);
|
||||
|
||||
if (c == '\n')
|
||||
{
|
||||
@@ -450,9 +450,9 @@ main (int argc, char **argv)
|
||||
|
||||
unexpand ();
|
||||
|
||||
if (have_read_stdin && fclose (stdin) == EOF)
|
||||
if (have_read_stdin && FCLOSE (stdin) == EOF)
|
||||
error (EXIT_FAILURE, errno, "-");
|
||||
if (fclose (stdout) == EOF)
|
||||
if (FCLOSE (stdout) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("write error"));
|
||||
exit (exit_status == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+5
-5
@@ -195,8 +195,8 @@ writeline (const struct linebuffer *line, FILE *stream, int linecount)
|
||||
if (countmode == count_occurrences)
|
||||
fprintf (stream, "%7d\t", linecount + 1);
|
||||
|
||||
fwrite (line->buffer, sizeof (char), line->length, stream);
|
||||
putc ('\n', stream);
|
||||
FWRITE (line->buffer, sizeof (char), line->length, stream);
|
||||
PUTC ('\n', stream);
|
||||
}
|
||||
|
||||
/* Process input file INFILE with output to OUTFILE.
|
||||
@@ -238,7 +238,7 @@ check_file (const char *infile, const char *outfile)
|
||||
prevfield = find_field (prevline);
|
||||
prevlen = prevline->length - (prevfield - prevline->buffer);
|
||||
|
||||
while (!feof (istream))
|
||||
while (!FEOF (istream))
|
||||
{
|
||||
if (readline (thisline, istream) == 0)
|
||||
break;
|
||||
@@ -262,10 +262,10 @@ check_file (const char *infile, const char *outfile)
|
||||
writeline (prevline, ostream, match_count);
|
||||
|
||||
closefiles:
|
||||
if (ferror (istream) || fclose (istream) == EOF)
|
||||
if (FERROR (istream) || fclose (istream) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("error reading %s"), infile);
|
||||
|
||||
if (ferror (ostream) || fclose (ostream) == EOF)
|
||||
if (FERROR (ostream) || fclose (ostream) == EOF)
|
||||
error (EXIT_FAILURE, errno, _("error writing %s"), outfile);
|
||||
|
||||
free (lb1.buffer);
|
||||
|
||||
Reference in New Issue
Block a user