(tac_mem, tac_stdin_to_mem): Remove #if-0'd functions.
[platform/upstream/coreutils.git] / src / tac.c
index 8b82746..f706674 100644 (file)
--- a/src/tac.c
+++ b/src/tac.c
@@ -563,97 +563,6 @@ tac_file (const char *filename)
   return ok;
 }
 
-#if 0
-/* BUF_END points one byte past the end of the buffer to be searched.  */
-
-/* FIXME: describe */
-
-static void
-tac_mem (const char *buf, size_t n_bytes, FILE *out)
-{
-  const char *nl;
-  const char *bol;
-
-  if (n_bytes == 0)
-    return;
-
-  nl = memrchr (buf, buf + n_bytes, '\n');
-  bol = (nl == NULL ? buf : nl + 1);
-
-  /* If the last line of the input file has no terminating newline,
-     treat it as a special case.  */
-  if (bol < buf + n_bytes)
-    {
-      /* Print out the line from bol to end of input.  */
-      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);
-    }
-
-  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);
-
-      bol = nl + 1;
-    }
-
-  /* If there's anything left, output the last line: BUF .. BOL-1.
-     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);
-
-  /* FIXME: this is work in progress.... */
-}
-
-/* FIXME: describe */
-
-static bool
-tac_stdin_to_mem (void)
-{
-  char *buf = NULL;
-  size_t bufsiz = 8 * BUFSIZ;
-  size_t delta = 8 * BUFSIZ;
-  size_t n_bytes = 0;
-
-  while (1)
-    {
-      size_t bytes_read;
-      char *new_buf = realloc (buf, bufsiz);
-
-      if (new_buf == NULL)
-       {
-         /* Write contents of buf to a temporary file, ... */
-         /* FIXME */
-
-         /* Free the buffer and fall back on the code that relies on a
-            temporary file.  */
-         free (buf);
-         /* FIXME */
-         abort ();
-       }
-
-      buf = new_buf;
-      bytes_read = safe_read (STDIN_FILENO, buf + n_bytes, bufsiz - n_bytes);
-      if (bytes_read == 0)
-       break;
-      if (bytes_read == SAFE_READ_ERROR)
-       error (EXIT_FAILURE, errno, _("stdin: read error"));
-      n_bytes += bytes_read;
-
-      bufsiz += delta;
-    }
-
-  tac_mem (buf, n_bytes, stdout);
-
-  return true;
-}
-#endif
-
 int
 main (int argc, char **argv)
 {