- if (ss_equals_case (ds_ss (val), ss_cstr ("auto")))
- {
- if (!(this->device & OUTP_DEV_SCREEN))
- {
- /* We only let `screen' devices have `auto'
- length or width because output to such devices
- is flushed before each new command. Resizing
- a device in the middle of output seems like a
- bad idea. */
- error (0, 0, _("ascii: only screen devices may have `auto' "
- "length or width"));
- }
- else if (subcat == 0)
- x->auto_length = true;
- else
- x->auto_width = true;
- }
- else
- {
- errno = 0;
- arg = strtol (value, &tail, 0);
- if (arg < 1 || errno == ERANGE || *tail)
- {
- error (0, 0, _("ascii: positive integer required as "
- "`%s' value"),
- key);
- break;
- }
- switch (subcat)
- {
- case 0:
- x->page_length = arg;
- break;
- case 1:
- this->width = arg;
- break;
- default:
- NOT_REACHED ();
- }
- }
- }
- break;
- case emphasis_arg:
- if (!strcmp (value, "bold"))
- x->emphasis = EMPH_BOLD;
- else if (!strcmp (value, "underline"))
- x->emphasis = EMPH_UNDERLINE;
- else if (!strcmp (value, "none"))
- x->emphasis = EMPH_NONE;
- else
- error (0, 0,
- _("ascii: `emphasis' value must be `bold', "
- "`underline', or `none'"));
- break;
- case nonneg_int_arg:
- {
- char *tail;
- int arg;
-
- errno = 0;
- arg = strtol (value, &tail, 0);
- if (arg < 0 || errno == ERANGE || *tail)
- {
- error (0, 0,
- _("ascii: zero or positive integer required as `%s' value"),
- key);
- break;
- }
- switch (subcat)
- {
- case 0:
- x->top_margin = arg;
- break;
- case 1:
- x->bottom_margin = arg;
- break;
- case 2:
- x->tab_width = arg;
- break;
- default:
- NOT_REACHED ();
- }
- }
- break;
- case boolean_arg:
- {
- bool setting;
- if (!strcmp (value, "on") || !strcmp (value, "true")
- || !strcmp (value, "yes") || atoi (value))
- setting = true;
- else if (!strcmp (value, "off") || !strcmp (value, "false")
- || !strcmp (value, "no") || !strcmp (value, "0"))
- setting = false;
- else
- {
- error (0, 0, _("ascii: boolean value expected for `%s'"), key);
- return false;
- }
- switch (subcat)
- {
- case 0:
- x->headers = setting;
- break;
- case 1:
- x->paginate = setting;
- break;
- case 2:
- x->squeeze_blank_lines = setting;
- break;
- case 3:
- x->append = setting;
- break;
- default:
- NOT_REACHED ();
- }
- }
- break;
- case string_arg:
- switch (subcat)