revert back to using lower case _unlocked wrapper names
authorJim Meyering <jim@meyering.net>
Mon, 29 Jun 1998 15:57:45 +0000 (15:57 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 29 Jun 1998 15:57:45 +0000 (15:57 +0000)
23 files changed:
src/asa.c
src/cksum.c
src/comm.c
src/csplit.c
src/cut.c
src/expand.c
src/fmt.c
src/fold.c
src/head.c
src/join.c
src/md5sum.c
src/nl.c
src/od.c
src/paste.c
src/pr.c
src/sort.c
src/sum.c
src/tac-pipe.c
src/tac.c
src/tail.c
src/tr.c
src/unexpand.c
src/uniq.c

index baf4d3b..411122c 100644 (file)
--- a/src/asa.c
+++ b/src/asa.c
@@ -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);
            }
        }
     }
index 680a673..e34499f 100644 (file)
@@ -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);
 }
index 044eed0..20e232a 100644 (file)
@@ -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;
index 3d62449..d31f899 100644 (file)
@@ -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);
index 1e6371e..8b2ec23 100644 (file)
--- a/src/cut.c
+++ b/src/cut.c
@@ -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);
index 9cda50d..a179ef8 100644 (file)
@@ -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);
index 079897e..abad56e 100644 (file)
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -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++;
     }
 }
index bd9f738..1ffe60c 100644 (file)
@@ -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);
index 0be7ca6..3052df1 100644 (file)
@@ -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);
index faebf3b..82c4220 100644 (file)
@@ -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);
index 97aa2af..5c8410e 100644 (file)
@@ -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);
index f7d4d74..6a7fab2 100644 (file)
--- a/src/nl.c
+++ b/src/nl.c
@@ -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);
index 5f31a27..5cf92e7 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -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);
index abb856c..9f98509 100644 (file)
@@ -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);
 }
index ffc461d..4149684 100644 (file)
--- a/src/pr.c
+++ b/src/pr.c
@@ -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;
index bdfb790..a1ada76 100644 (file)
@@ -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);
index b013afd..de3dfe1 100644 (file)
--- a/src/sum.c
+++ b/src/sum.c
@@ -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);
 }
index 5e9f6fb..8e21d1c 100644 (file)
@@ -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);
     }
 }
 
index 6480088..b274461 100644 (file)
--- a/src/tac.c
+++ b/src/tac.c
@@ -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);
 }
index 8c25952..981ed6f 100644 (file)
@@ -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);
 }
index 0eaa6c1..831de3b 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -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)
index ff12b25..42df105 100644 (file)
@@ -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);
 }
index c3cb7a9..2726112 100644 (file)
@@ -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);