- struct sigaction action;
- sigemptyset (&action.sa_mask);
- action.sa_flags = 0;
- action.sa_handler = winch_handler;
- the_driver = a;
- sigaction (SIGWINCH, &action, NULL);
-#endif
- a->auto_width = true;
- a->auto_length = true;
- }
- }
- else
- {
- msg_error (errno, _("ascii: opening output file `%s'"),
- fh_get_file_name (a->handle));
- a->error = true;
- return false;
- }
- }
-
- a->page_number++;
-
- reallocate_lines (a);
-
- for (i = 0; i < a->length; i++)
- u8_line_clear (&a->lines[i]);
-
- return true;
-}
-
-static void
-output_title_line (FILE *out, int width, const char *left, const char *right)
-{
- struct string s = DS_EMPTY_INITIALIZER;
- ds_put_byte_multiple (&s, ' ', width);
- if (left != NULL)
- {
- size_t length = MIN (strlen (left), width);
- memcpy (ds_end (&s) - width, left, length);
- }
- if (right != NULL)
- {
- size_t length = MIN (strlen (right), width);
- memcpy (ds_end (&s) - length, right, length);
- }
- ds_put_byte (&s, '\n');
- fputs (ds_cstr (&s), out);
- ds_destroy (&s);
-}
-
-static void
-ascii_close_page (struct ascii_driver *a)
-{
- bool any_blank;
- int i, y;
-
- a->y = 0;
- if (a->file == NULL)
- return;
-
- if (!a->top_margin && !a->bottom_margin && a->squeeze_blank_lines
- && !a->paginate && a->page_number > 1)
- putc ('\n', a->file);
-
- for (i = 0; i < a->top_margin; i++)
- putc ('\n', a->file);
- if (a->headers)