diff options
-rw-r--r-- | usr.bin/mandoc/libman.h | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/libmdoc.h | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/man.c | 8 | ||||
-rw-r--r-- | usr.bin/mandoc/man.h | 13 | ||||
-rw-r--r-- | usr.bin/mandoc/man_html.c | 8 | ||||
-rw-r--r-- | usr.bin/mandoc/man_term.c | 34 | ||||
-rw-r--r-- | usr.bin/mandoc/man_validate.c | 28 | ||||
-rw-r--r-- | usr.bin/mandoc/mandocdb.c | 48 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.c | 10 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc.h | 14 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_man.c | 6 | ||||
-rw-r--r-- | usr.bin/mandoc/mdoc_term.c | 20 | ||||
-rw-r--r-- | usr.bin/mandoc/roff.h | 13 | ||||
-rw-r--r-- | usr.bin/mandoc/term.c | 8 | ||||
-rw-r--r-- | usr.bin/mandoc/term.h | 13 |
16 files changed, 110 insertions, 125 deletions
diff --git a/usr.bin/mandoc/libman.h b/usr.bin/mandoc/libman.h index 25eb39d13dc..33125dc3f2c 100644 --- a/usr.bin/mandoc/libman.h +++ b/usr.bin/mandoc/libman.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libman.h,v 1.44 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: libman.h,v 1.45 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -33,7 +33,7 @@ struct man { enum man_next next; /* where to put the next node */ struct roff_node *last; /* the last parsed node */ struct roff_node *first; /* the first parsed node */ - struct man_meta meta; /* document meta-data */ + struct roff_meta meta; /* document meta-data */ struct roff *roff; }; diff --git a/usr.bin/mandoc/libmdoc.h b/usr.bin/mandoc/libmdoc.h index 8a0aeb86ec6..e11608cc12e 100644 --- a/usr.bin/mandoc/libmdoc.h +++ b/usr.bin/mandoc/libmdoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libmdoc.h,v 1.69 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: libmdoc.h,v 1.70 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -40,7 +40,7 @@ struct mdoc { struct roff_node *last; /* the last node parsed */ struct roff_node *first; /* the first node parsed */ struct roff_node *last_es; /* the most recent Es node */ - struct mdoc_meta meta; /* document meta-data */ + struct roff_meta meta; /* document meta-data */ enum roff_sec lastnamed; enum roff_sec lastsec; struct roff *roff; diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c index 641422ed66a..c3321fefb10 100644 --- a/usr.bin/mandoc/man.c +++ b/usr.bin/mandoc/man.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man.c,v 1.99 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: man.c,v 1.100 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -67,7 +67,7 @@ man_node(const struct man *man) return(man->first); } -const struct man_meta * +const struct roff_meta * man_meta(const struct man *man) { @@ -134,7 +134,7 @@ man_free1(struct man *man) if (man->first) man_node_delete(man, man->first); free(man->meta.title); - free(man->meta.source); + free(man->meta.os); free(man->meta.date); free(man->meta.vol); free(man->meta.msec); @@ -144,7 +144,7 @@ static void man_alloc1(struct man *man) { - memset(&man->meta, 0, sizeof(struct man_meta)); + memset(&man->meta, 0, sizeof(man->meta)); man->flags = 0; man->last = mandoc_calloc(1, sizeof(*man->last)); man->first = man->last; diff --git a/usr.bin/mandoc/man.h b/usr.bin/mandoc/man.h index af4c3d1b274..50d05d1a31d 100644 --- a/usr.bin/mandoc/man.h +++ b/usr.bin/mandoc/man.h @@ -1,4 +1,4 @@ -/* $OpenBSD: man.h,v 1.51 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: man.h,v 1.52 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -56,15 +56,6 @@ #define MAN_ll 37 #define MAN_MAX 38 -struct man_meta { - char *msec; /* `TH' section (1, 3p, etc.) */ - char *date; /* `TH' normalised date */ - char *vol; /* `TH' volume */ - char *title; /* `TH' title (e.g., FOO) */ - char *source; /* `TH' source (e.g., GNU) */ - int hasbody; /* document is not empty */ -}; - /* Names of macros. */ extern const char *const *man_macronames; @@ -73,7 +64,7 @@ __BEGIN_DECLS struct man; const struct roff_node *man_node(const struct man *); -const struct man_meta *man_meta(const struct man *); +const struct roff_meta *man_meta(const struct man *); const struct mparse *man_mparse(const struct man *); void man_deroff(char **, const struct roff_node *); diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c index 68d61825e03..a476cf8153d 100644 --- a/usr.bin/mandoc/man_html.c +++ b/usr.bin/mandoc/man_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_html.c,v 1.67 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: man_html.c,v 1.68 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -35,7 +35,7 @@ #define INDENT 5 -#define MAN_ARGS const struct man_meta *man, \ +#define MAN_ARGS const struct roff_meta *man, \ const struct roff_node *n, \ struct mhtml *mh, \ struct html *h @@ -346,8 +346,8 @@ man_root_post(MAN_ARGS) PAIR_CLASS_INIT(&tag, "foot-os"); print_otag(h, TAG_TD, 1, &tag); - if (man->source) - print_text(h, man->source); + if (man->os) + print_text(h, man->os); print_tagq(h, t); } diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 448af796bda..131d552344b 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_term.c,v 1.125 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: man_term.c,v 1.126 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -47,7 +47,7 @@ struct mtermp { #define DECL_ARGS struct termp *p, \ struct mtermp *mt, \ struct roff_node *n, \ - const struct man_meta *meta + const struct roff_meta *meta struct termact { int (*pre)(DECL_ARGS); @@ -58,8 +58,10 @@ struct termact { static void print_man_nodelist(DECL_ARGS); static void print_man_node(DECL_ARGS); -static void print_man_head(struct termp *, const void *); -static void print_man_foot(struct termp *, const void *); +static void print_man_head(struct termp *, + const struct roff_meta *); +static void print_man_foot(struct termp *, + const struct roff_meta *); static void print_bvspace(struct termp *, const struct roff_node *, int); @@ -137,7 +139,7 @@ void terminal_man(void *arg, const struct man *man) { struct termp *p; - const struct man_meta *meta; + const struct roff_meta *meta; struct roff_node *n; struct mtermp mt; @@ -1010,13 +1012,11 @@ print_man_nodelist(DECL_ARGS) } static void -print_man_foot(struct termp *p, const void *arg) +print_man_foot(struct termp *p, const struct roff_meta *meta) { - const struct man_meta *meta; char *title; size_t datelen, titlen; - meta = (const struct man_meta *)arg; assert(meta->title); assert(meta->msec); assert(meta->date); @@ -1028,8 +1028,8 @@ print_man_foot(struct termp *p, const void *arg) /* * Temporary, undocumented option to imitate mdoc(7) output. - * In the bottom right corner, use the source instead of - * the title. + * In the bottom right corner, use the operating system + * instead of the title. */ if ( ! p->mdocstyle) { @@ -1039,14 +1039,14 @@ print_man_foot(struct termp *p, const void *arg) } mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec); - } else if (meta->source) { - title = mandoc_strdup(meta->source); + } else if (meta->os) { + title = mandoc_strdup(meta->os); } else { title = mandoc_strdup(""); } datelen = term_strlen(p, meta->date); - /* Bottom left corner: manual source. */ + /* Bottom left corner: operating system. */ p->flags |= TERMP_NOSPACE | TERMP_NOBREAK; p->trailspace = 1; @@ -1054,8 +1054,8 @@ print_man_foot(struct termp *p, const void *arg) p->rmargin = p->maxrmargin > datelen ? (p->maxrmargin + term_len(p, 1) - datelen) / 2 : 0; - if (meta->source) - term_word(p, meta->source); + if (meta->os) + term_word(p, meta->os); term_flushln(p); /* At the bottom in the middle: manual date. */ @@ -1082,14 +1082,12 @@ print_man_foot(struct termp *p, const void *arg) } static void -print_man_head(struct termp *p, const void *arg) +print_man_head(struct termp *p, const struct roff_meta *meta) { - const struct man_meta *meta; const char *volume; char *title; size_t vollen, titlen; - meta = (const struct man_meta *)arg; assert(meta->title); assert(meta->msec); diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c index 5dff3c59eb4..ba01575fb5d 100644 --- a/usr.bin/mandoc/man_validate.c +++ b/usr.bin/mandoc/man_validate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: man_validate.c,v 1.86 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: man_validate.c,v 1.87 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -303,16 +303,16 @@ post_TH(CHKARGS) free(man->meta.title); free(man->meta.vol); - free(man->meta.source); + free(man->meta.os); free(man->meta.msec); free(man->meta.date); man->meta.title = man->meta.vol = man->meta.date = - man->meta.msec = man->meta.source = NULL; + man->meta.msec = man->meta.os = NULL; nb = n; - /* ->TITLE<- MSEC DATE SOURCE VOL */ + /* ->TITLE<- MSEC DATE OS VOL */ n = n->child; if (n && n->string) { @@ -334,7 +334,7 @@ post_TH(CHKARGS) nb->line, nb->pos, "TH"); } - /* TITLE ->MSEC<- DATE SOURCE VOL */ + /* TITLE ->MSEC<- DATE OS VOL */ if (n) n = n->next; @@ -346,7 +346,7 @@ post_TH(CHKARGS) nb->line, nb->pos, "TH %s", man->meta.title); } - /* TITLE MSEC ->DATE<- SOURCE VOL */ + /* TITLE MSEC ->DATE<- OS VOL */ if (n) n = n->next; @@ -362,14 +362,14 @@ post_TH(CHKARGS) n ? n->pos : nb->pos, "TH"); } - /* TITLE MSEC DATE ->SOURCE<- VOL */ + /* TITLE MSEC DATE ->OS<- VOL */ if (n && (n = n->next)) - man->meta.source = mandoc_strdup(n->string); + man->meta.os = mandoc_strdup(n->string); else if (man->defos != NULL) - man->meta.source = mandoc_strdup(man->defos); + man->meta.os = mandoc_strdup(man->defos); - /* TITLE MSEC DATE SOURCE ->VOL<- */ + /* TITLE MSEC DATE OS ->VOL<- */ /* If missing, use the default VOL name for MSEC. */ if (n && (n = n->next)) @@ -444,8 +444,8 @@ post_UC(CHKARGS) p = bsd_versions[0]; } - free(man->meta.source); - man->meta.source = mandoc_strdup(p); + free(man->meta.os); + man->meta.os = mandoc_strdup(p); } static void @@ -483,8 +483,8 @@ post_AT(CHKARGS) p = unix_versions[0]; } - free(man->meta.source); - man->meta.source = mandoc_strdup(p); + free(man->meta.os); + man->meta.os = mandoc_strdup(p); } static void diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c index 682dc2c4cdf..b819f7613a8 100644 --- a/usr.bin/mandoc/mandocdb.c +++ b/usr.bin/mandoc/mandocdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mandocdb.c,v 1.142 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: mandocdb.c,v 1.143 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -120,7 +120,7 @@ enum stmt { STMT__MAX }; -typedef int (*mdoc_fp)(struct mpage *, const struct mdoc_meta *, +typedef int (*mdoc_fp)(struct mpage *, const struct roff_meta *, const struct roff_node *); struct mdoc_handler { @@ -146,28 +146,28 @@ static void mpages_free(void); static void mpages_merge(struct mparse *); static void names_check(void); static void parse_cat(struct mpage *, int); -static void parse_man(struct mpage *, const struct man_meta *, +static void parse_man(struct mpage *, const struct roff_meta *, const struct roff_node *); -static void parse_mdoc(struct mpage *, const struct mdoc_meta *, +static void parse_mdoc(struct mpage *, const struct roff_meta *, const struct roff_node *); -static int parse_mdoc_body(struct mpage *, const struct mdoc_meta *, +static int parse_mdoc_body(struct mpage *, const struct roff_meta *, const struct roff_node *); -static int parse_mdoc_head(struct mpage *, const struct mdoc_meta *, +static int parse_mdoc_head(struct mpage *, const struct roff_meta *, const struct roff_node *); -static int parse_mdoc_Fd(struct mpage *, const struct mdoc_meta *, +static int parse_mdoc_Fd(struct mpage *, const struct roff_meta *, const struct roff_node *); static void parse_mdoc_fname(struct mpage *, const struct roff_node *); -static int parse_mdoc_Fn(struct mpage *, const struct mdoc_meta *, +static int parse_mdoc_Fn(struct mpage *, const struct roff_meta *, const struct roff_node *); -static int parse_mdoc_Fo(struct mpage *, const struct mdoc_meta *, +static int parse_mdoc_Fo(struct mpage *, const struct roff_meta *, const struct roff_node *); -static int parse_mdoc_Nd(struct mpage *, const struct mdoc_meta *, +static int parse_mdoc_Nd(struct mpage *, const struct roff_meta *, const struct roff_node *); -static int parse_mdoc_Nm(struct mpage *, const struct mdoc_meta *, +static int parse_mdoc_Nm(struct mpage *, const struct roff_meta *, const struct roff_node *); -static int parse_mdoc_Sh(struct mpage *, const struct mdoc_meta *, +static int parse_mdoc_Sh(struct mpage *, const struct roff_meta *, const struct roff_node *); -static int parse_mdoc_Xr(struct mpage *, const struct mdoc_meta *, +static int parse_mdoc_Xr(struct mpage *, const struct roff_meta *, const struct roff_node *); static void putkey(const struct mpage *, char *, uint64_t); static void putkeys(const struct mpage *, char *, size_t, uint64_t); @@ -1425,7 +1425,7 @@ putmdockey(const struct mpage *mpage, } static void -parse_man(struct mpage *mpage, const struct man_meta *meta, +parse_man(struct mpage *mpage, const struct roff_meta *meta, const struct roff_node *n) { const struct roff_node *head, *body; @@ -1551,7 +1551,7 @@ parse_man(struct mpage *mpage, const struct man_meta *meta, } static void -parse_mdoc(struct mpage *mpage, const struct mdoc_meta *meta, +parse_mdoc(struct mpage *mpage, const struct roff_meta *meta, const struct roff_node *n) { @@ -1584,7 +1584,7 @@ parse_mdoc(struct mpage *mpage, const struct mdoc_meta *meta, } static int -parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_meta *meta, +parse_mdoc_Fd(struct mpage *mpage, const struct roff_meta *meta, const struct roff_node *n) { char *start, *end; @@ -1649,7 +1649,7 @@ parse_mdoc_fname(struct mpage *mpage, const struct roff_node *n) } static int -parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_meta *meta, +parse_mdoc_Fn(struct mpage *mpage, const struct roff_meta *meta, const struct roff_node *n) { @@ -1666,7 +1666,7 @@ parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_meta *meta, } static int -parse_mdoc_Fo(struct mpage *mpage, const struct mdoc_meta *meta, +parse_mdoc_Fo(struct mpage *mpage, const struct roff_meta *meta, const struct roff_node *n) { @@ -1680,7 +1680,7 @@ parse_mdoc_Fo(struct mpage *mpage, const struct mdoc_meta *meta, } static int -parse_mdoc_Xr(struct mpage *mpage, const struct mdoc_meta *meta, +parse_mdoc_Xr(struct mpage *mpage, const struct roff_meta *meta, const struct roff_node *n) { char *cp; @@ -1700,7 +1700,7 @@ parse_mdoc_Xr(struct mpage *mpage, const struct mdoc_meta *meta, } static int -parse_mdoc_Nd(struct mpage *mpage, const struct mdoc_meta *meta, +parse_mdoc_Nd(struct mpage *mpage, const struct roff_meta *meta, const struct roff_node *n) { @@ -1710,7 +1710,7 @@ parse_mdoc_Nd(struct mpage *mpage, const struct mdoc_meta *meta, } static int -parse_mdoc_Nm(struct mpage *mpage, const struct mdoc_meta *meta, +parse_mdoc_Nm(struct mpage *mpage, const struct roff_meta *meta, const struct roff_node *n) { @@ -1732,7 +1732,7 @@ parse_mdoc_Nm(struct mpage *mpage, const struct mdoc_meta *meta, } static int -parse_mdoc_Sh(struct mpage *mpage, const struct mdoc_meta *meta, +parse_mdoc_Sh(struct mpage *mpage, const struct roff_meta *meta, const struct roff_node *n) { @@ -1740,7 +1740,7 @@ parse_mdoc_Sh(struct mpage *mpage, const struct mdoc_meta *meta, } static int -parse_mdoc_head(struct mpage *mpage, const struct mdoc_meta *meta, +parse_mdoc_head(struct mpage *mpage, const struct roff_meta *meta, const struct roff_node *n) { @@ -1748,7 +1748,7 @@ parse_mdoc_head(struct mpage *mpage, const struct mdoc_meta *meta, } static int -parse_mdoc_body(struct mpage *mpage, const struct mdoc_meta *meta, +parse_mdoc_body(struct mpage *mpage, const struct roff_meta *meta, const struct roff_node *n) { diff --git a/usr.bin/mandoc/mdoc.c b/usr.bin/mandoc/mdoc.c index a48056048ae..251cf24da2c 100644 --- a/usr.bin/mandoc/mdoc.c +++ b/usr.bin/mandoc/mdoc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc.c,v 1.129 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: mdoc.c,v 1.130 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -7,9 +7,9 @@ * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF @@ -100,7 +100,7 @@ mdoc_node(const struct mdoc *mdoc) return(mdoc->first); } -const struct mdoc_meta * +const struct roff_meta * mdoc_meta(const struct mdoc *mdoc) { @@ -132,7 +132,7 @@ static void mdoc_alloc1(struct mdoc *mdoc) { - memset(&mdoc->meta, 0, sizeof(struct mdoc_meta)); + memset(&mdoc->meta, 0, sizeof(mdoc->meta)); mdoc->flags = 0; mdoc->lastnamed = mdoc->lastsec = SEC_NONE; mdoc->last = mandoc_calloc(1, sizeof(*mdoc->last)); diff --git a/usr.bin/mandoc/mdoc.h b/usr.bin/mandoc/mdoc.h index bec7b57ac21..046255cae45 100644 --- a/usr.bin/mandoc/mdoc.h +++ b/usr.bin/mandoc/mdoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc.h,v 1.63 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: mdoc.h,v 1.64 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -172,16 +172,6 @@ enum mdocargt { MDOC_ARG_MAX }; -struct mdoc_meta { - char *msec; /* `Dt' section (1, 3p, etc.) */ - char *vol; /* `Dt' volume (implied) */ - char *arch; /* `Dt' arch (i386, etc.) */ - char *date; /* `Dd' normalised date */ - char *title; /* `Dt' title (FOO, etc.) */ - char *os; /* `Os' system (OpenBSD, etc.) */ - char *name; /* leading `Nm' name */ -}; - /* * An argument to a macro (multiple values = `-column xxx yyy'). */ @@ -295,7 +285,7 @@ __BEGIN_DECLS struct mdoc; const struct roff_node *mdoc_node(const struct mdoc *); -const struct mdoc_meta *mdoc_meta(const struct mdoc *); +const struct roff_meta *mdoc_meta(const struct mdoc *); void mdoc_deroff(char **, const struct roff_node *); __END_DECLS diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index bd2d4ba06ed..3bb09c979ac 100644 --- a/usr.bin/mandoc/mdoc_html.c +++ b/usr.bin/mandoc/mdoc_html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_html.c,v 1.103 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.104 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -33,7 +33,7 @@ #define INDENT 5 -#define MDOC_ARGS const struct mdoc_meta *meta, \ +#define MDOC_ARGS const struct roff_meta *meta, \ struct roff_node *n, \ struct html *h diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c index 303f17a4fca..a212740a5a7 100644 --- a/usr.bin/mandoc/mdoc_man.c +++ b/usr.bin/mandoc/mdoc_man.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_man.c,v 1.88 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: mdoc_man.c,v 1.89 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org> * @@ -28,7 +28,7 @@ #include "out.h" #include "main.h" -#define DECL_ARGS const struct mdoc_meta *meta, struct roff_node *n +#define DECL_ARGS const struct roff_meta *meta, struct roff_node *n struct manact { int (*cond)(DECL_ARGS); /* DON'T run actions */ @@ -545,7 +545,7 @@ man_man(void *arg, const struct man *man) void man_mdoc(void *arg, const struct mdoc *mdoc) { - const struct mdoc_meta *meta; + const struct roff_meta *meta; struct roff_node *n; meta = mdoc_meta(mdoc); diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 3a1359d39c7..a55fd47a1ce 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_term.c,v 1.214 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: mdoc_term.c,v 1.215 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -41,7 +41,7 @@ struct termpair { #define DECL_ARGS struct termp *p, \ struct termpair *pair, \ - const struct mdoc_meta *meta, \ + const struct roff_meta *meta, \ struct roff_node *n struct termact { @@ -56,8 +56,8 @@ static void print_bvspace(struct termp *, const struct roff_node *); static void print_mdoc_node(DECL_ARGS); static void print_mdoc_nodelist(DECL_ARGS); -static void print_mdoc_head(struct termp *, const void *); -static void print_mdoc_foot(struct termp *, const void *); +static void print_mdoc_head(struct termp *, const struct roff_meta *); +static void print_mdoc_foot(struct termp *, const struct roff_meta *); static void synopsis_pre(struct termp *, const struct roff_node *); @@ -251,7 +251,7 @@ static const struct termact termacts[MDOC_MAX] = { void terminal_mdoc(void *arg, const struct mdoc *mdoc) { - const struct mdoc_meta *meta; + const struct roff_meta *meta; struct roff_node *n; struct termp *p; @@ -405,13 +405,10 @@ print_mdoc_node(DECL_ARGS) } static void -print_mdoc_foot(struct termp *p, const void *arg) +print_mdoc_foot(struct termp *p, const struct roff_meta *meta) { - const struct mdoc_meta *meta; size_t sz; - meta = (const struct mdoc_meta *)arg; - term_fontrepl(p, TERMFONT_NONE); /* @@ -457,14 +454,11 @@ print_mdoc_foot(struct termp *p, const void *arg) } static void -print_mdoc_head(struct termp *p, const void *arg) +print_mdoc_head(struct termp *p, const struct roff_meta *meta) { - const struct mdoc_meta *meta; char *volume, *title; size_t vollen, titlen; - meta = (const struct mdoc_meta *)arg; - /* * The header is strange. It has three components, which are * really two with the first duplicated. It goes like this: diff --git a/usr.bin/mandoc/roff.h b/usr.bin/mandoc/roff.h index a1ffea4b862..ece2613cb89 100644 --- a/usr.bin/mandoc/roff.h +++ b/usr.bin/mandoc/roff.h @@ -1,4 +1,4 @@ -/* $OpenBSD: roff.h,v 1.11 2015/04/02 22:06:17 schwarze Exp $ */ +/* $OpenBSD: roff.h,v 1.12 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> @@ -104,3 +104,14 @@ struct roff_node { enum roff_sec sec; /* Current named section. */ enum mdoc_endbody end; /* BODY */ }; + +struct roff_meta { + char *msec; /* Manual section, usually a digit. */ + char *vol; /* Manual volume title. */ + char *os; /* Operating system. */ + char *arch; /* Machine architecture. */ + char *title; /* Manual title, usually CAPS. */ + char *name; /* Leading manual name. */ + char *date; /* Normalized date. */ + int hasbody; /* Document is not empty. */ +}; diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c index 79ac841a665..dce82c28501 100644 --- a/usr.bin/mandoc/term.c +++ b/usr.bin/mandoc/term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: term.c,v 1.105 2015/03/09 17:35:13 schwarze Exp $ */ +/* $OpenBSD: term.c,v 1.106 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org> @@ -7,9 +7,9 @@ * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF @@ -47,7 +47,7 @@ term_free(struct termp *p) void term_begin(struct termp *p, term_margin head, - term_margin foot, const void *arg) + term_margin foot, const struct roff_meta *arg) { p->headf = head; diff --git a/usr.bin/mandoc/term.h b/usr.bin/mandoc/term.h index 35fe140277c..ea080580a22 100644 --- a/usr.bin/mandoc/term.h +++ b/usr.bin/mandoc/term.h @@ -1,15 +1,15 @@ -/* $OpenBSD: term.h,v 1.55 2015/01/31 00:11:52 schwarze Exp $ */ +/* $OpenBSD: term.h,v 1.56 2015/04/02 23:47:43 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF @@ -38,9 +38,10 @@ enum termfont { #define TERM_MAXMARGIN 100000 /* FIXME */ +struct roff_meta; struct termp; -typedef void (*term_margin)(struct termp *, const void *); +typedef void (*term_margin)(struct termp *, const struct roff_meta *); struct termp_tbl { int width; /* width in fixed chars */ @@ -117,7 +118,7 @@ void term_vspace(struct termp *); void term_word(struct termp *, const char *); void term_flushln(struct termp *); void term_begin(struct termp *, term_margin, - term_margin, const void *); + term_margin, const struct roff_meta *); void term_end(struct termp *); void term_setwidth(struct termp *, const char *); |