summaryrefslogtreecommitdiff
path: root/src/tac.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-06-19 09:10:28 +0000
committerJim Meyering <jim@meyering.net>2005-06-19 09:10:28 +0000
commit82dddb9c389f54785ab0ac91b809cb390bfc6230 (patch)
tree3a0904fb5eadf9336add295296b8066776aca5e7 /src/tac.c
parentfc8a42d6462a43e7d228a6a3ee91bb6fd3e0f68b (diff)
downloadcoreutils-82dddb9c389f54785ab0ac91b809cb390bfc6230.tar.xz
(tac_mem, tac_stdin_to_mem): Remove #if-0'd functions.
Diffstat (limited to 'src/tac.c')
-rw-r--r--src/tac.c91
1 files changed, 0 insertions, 91 deletions
diff --git a/src/tac.c b/src/tac.c
index 8b8274667..f7066745b 100644
--- 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)
{