]> git.cameronkatri.com Git - mandoc.git/blobdiff - manpath.c
During validation, drop .br before a text line starting with a
[mandoc.git] / manpath.c
index f43ace60694ea3a6126fa4b4160d4b1b778c3ff1..74f38a95db9ee9c5f15d57763826216c217d4d77 100644 (file)
--- a/manpath.c
+++ b/manpath.c
@@ -1,6 +1,6 @@
-/*     $Id: manpath.c,v 1.33 2017/02/10 15:45:28 schwarze Exp $        */
+/*     $Id: manpath.c,v 1.37 2018/11/22 11:30:23 schwarze Exp $ */
 /*
- * Copyright (c) 2011, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2011,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -91,6 +91,13 @@ manconf_parse(struct manconf *conf, const char *file,
        manpath_parseline(&conf->manpath, defp, 0);
 }
 
+void
+manpath_base(struct manpaths *dirs)
+{
+       char path_base[] = MANPATH_BASE;
+       manpath_parseline(dirs, path_base, 0);
+}
+
 /*
  * Parse a FULL pathname from a colon-separated list of arrays.
  */
@@ -225,8 +232,8 @@ int
 manconf_output(struct manoutput *conf, const char *cp, int fromfile)
 {
        const char *const toks[] = {
-           "includes", "man", "paper", "style",
-           "indent", "width", "fragment", "mdoc", "noval"
+           "includes", "man", "paper", "style", "indent", "width",
+           "tag", "fragment", "mdoc", "noval", "toc"
        };
 
        const char      *errstr;
@@ -250,7 +257,7 @@ manconf_output(struct manoutput *conf, const char *cp, int fromfile)
                warnx("-O %s=?: Missing argument value", toks[tok]);
                return -1;
        }
-       if ((tok == 6 || tok == 7) && *cp != '\0') {
+       if (tok > 6 && *cp != '\0') {
                warnx("-O %s: Does not take a value: %s", toks[tok], cp);
                return -1;
        }
@@ -299,20 +306,30 @@ manconf_output(struct manoutput *conf, const char *cp, int fromfile)
                        mandoc_asprintf(&oldval, "%zu", conf->width);
                        break;
                }
-               conf->width = strtonum(cp, 58, 1000, &errstr);
+               conf->width = strtonum(cp, 1, 1000, &errstr);
                if (errstr == NULL)
                        return 0;
                warnx("-O width=%s is %s", cp, errstr);
                return -1;
        case 6:
-               conf->fragment = 1;
+               if (conf->tag != NULL) {
+                       oldval = mandoc_strdup(conf->tag);
+                       break;
+               }
+               conf->tag = mandoc_strdup(cp);
                return 0;
        case 7:
-               conf->mdoc = 1;
+               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);