- p[len] = '\0';
- while (isspace((unsigned char)*p))
- p++;
- if (strncmp(MAN_CONF_KEY, p, keysz))
- continue;
- p += keysz;
- while (isspace(*p))
- p++;
- if ('\0' == *p)
- continue;
- if (NULL == (q = strrchr(p, '/')))
- continue;
- *q = '\0';
- manpath_add(dirs, p);
+ }
+ conf->includes = mandoc_strdup(cp);
+ return 0;
+ case 1:
+ if (conf->man != NULL) {
+ oldval = mandoc_strdup(conf->man);
+ break;
+ }
+ conf->man = mandoc_strdup(cp);
+ return 0;
+ case 2:
+ if (conf->paper != NULL) {
+ oldval = mandoc_strdup(conf->paper);
+ break;
+ }
+ conf->paper = mandoc_strdup(cp);
+ return 0;
+ case 3:
+ if (conf->style != NULL) {
+ oldval = mandoc_strdup(conf->style);
+ break;
+ }
+ conf->style = mandoc_strdup(cp);
+ return 0;
+ case 4:
+ if (conf->indent) {
+ mandoc_asprintf(&oldval, "%zu", conf->indent);
+ break;
+ }
+ conf->indent = strtonum(cp, 0, 1000, &errstr);
+ if (errstr == NULL)
+ return 0;
+ warnx("-O indent=%s is %s", cp, errstr);
+ return -1;
+ case 5:
+ if (conf->width) {
+ mandoc_asprintf(&oldval, "%zu", conf->width);
+ break;
+ }
+ conf->width = strtonum(cp, 1, 1000, &errstr);
+ if (errstr == NULL)
+ return 0;
+ warnx("-O width=%s is %s", cp, errstr);
+ return -1;
+ case 6:
+ if (conf->tag != NULL) {
+ oldval = mandoc_strdup(conf->tag);
+ break;
+ }
+ conf->tag = mandoc_strdup(cp);
+ return 0;
+ case 7:
+ conf->fragment = 1;
+ return 0;
+ case 8:
+ conf->mdoc = 1;
+ return 0;
+ case 9:
+ conf->noval = 1;
+ return 0;
+ case 10:
+ conf->toc = 1;
+ return 0;
+ default:
+ if (fromfile)
+ warnx("-O %s: Bad argument", cp);
+ return -1;