diff options
Diffstat (limited to 'src/tac-pipe.c')
-rw-r--r-- | src/tac-pipe.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/src/tac-pipe.c b/src/tac-pipe.c index 17e86c070..1612e2d48 100644 --- a/src/tac-pipe.c +++ b/src/tac-pipe.c @@ -62,52 +62,52 @@ buf_init_from_stdin (Buf *x, char eol_byte) size_t bytes_read; if (buf == NULL) - { - /* Fall back on the code that relies on a temporary file. - Write all buffers to that file and free them. */ - /* FIXME */ - ok = false; - break; - } + { + /* Fall back on the code that relies on a temporary file. + Write all buffers to that file and free them. */ + /* FIXME */ + ok = false; + break; + } bytes_read = full_read (STDIN_FILENO, buf, BUFFER_SIZE); if (bytes_read != buffer_size && errno != 0) - error (EXIT_FAILURE, errno, _("read error")); + error (EXIT_FAILURE, errno, _("read error")); { - struct B_pair bp; - bp.start = buf; - bp.one_past_end = buf + bytes_read; - obstack_grow (OBS, &bp, sizeof (bp)); + struct B_pair bp; + bp.start = buf; + bp.one_past_end = buf + bytes_read; + obstack_grow (OBS, &bp, sizeof (bp)); } if (bytes_read != 0) - last_byte_is_eol_byte = (buf[bytes_read - 1] == eol_byte); + last_byte_is_eol_byte = (buf[bytes_read - 1] == eol_byte); if (bytes_read < BUFFER_SIZE) - break; + break; } if (ok) { /* If the file was non-empty and lacked an EOL_BYTE at its end, - then add a buffer containing just that one byte. */ + then add a buffer containing just that one byte. */ if (!last_byte_is_eol_byte) - { - char *buf = malloc (1); - if (buf == NULL) - { - /* FIXME: just like above */ - ok = false; - } - else - { - struct B_pair bp; - *buf = eol_byte; - bp.start = buf; - bp.one_past_end = buf + 1; - obstack_grow (OBS, &bp, sizeof (bp)); - } - } + { + char *buf = malloc (1); + if (buf == NULL) + { + /* FIXME: just like above */ + ok = false; + } + else + { + struct B_pair bp; + *buf = eol_byte; + bp.start = buf; + bp.one_past_end = buf + 1; + obstack_grow (OBS, &bp, sizeof (bp)); + } + } } x->n_bufs = obstack_object_size (OBS) / sizeof (x->p[0]); @@ -172,7 +172,7 @@ line_ptr_increment (const Buf *x, const Line_ptr *lp) static bool find_bol (const Buf *x, - const Line_ptr *last_bol, Line_ptr *new_bol, char eol_byte) + const Line_ptr *last_bol, Line_ptr *new_bol, char eol_byte) { size_t i; Line_ptr tmp; @@ -188,16 +188,16 @@ find_bol (const Buf *x, { char *nl = memrchr (x->p[i].start, last_bol_ptr, eol_byte); if (nl) - { - Line_ptr nl_pos; - nl_pos.i = i; - nl_pos.ptr = nl; - *new_bol = line_ptr_increment (x, &nl_pos); - return true; - } + { + Line_ptr nl_pos; + nl_pos.i = i; + nl_pos.ptr = nl; + *new_bol = line_ptr_increment (x, &nl_pos); + return true; + } if (i == 0) - break; + break; --i; last_bol_ptr = ONE_PAST_END (x, i); @@ -218,7 +218,7 @@ find_bol (const Buf *x, static void print_line (FILE *out_stream, const Buf *x, - const Line_ptr *bol, const Line_ptr *bol_next) + const Line_ptr *bol, const Line_ptr *bol_next) { size_t i; for (i = bol->i; i <= bol_next->i; i++) @@ -254,7 +254,7 @@ tac_mem () { Line_ptr new_bol; if (! find_bol (&x, &bol, &new_bol, eol_byte)) - break; + break; print_line (stdout, &x, &new_bol, &bol); bol = new_bol; } |