diff --git a/external/bsd/mdocml/dist/Makefile b/external/bsd/mdocml/dist/Makefile index 8b4009540811..1e188fb0bd54 100644 --- a/external/bsd/mdocml/dist/Makefile +++ b/external/bsd/mdocml/dist/Makefile @@ -1,4 +1,4 @@ -.SUFFIXES: .html .xml .sgml .1 .3 .7 .md5 .tar.gz .1.txt .3.txt .7.txt .1.sgml .3.sgml .7.sgml +.SUFFIXES: .html .xml .sgml .1 .3 .7 .md5 .tar.gz .1.txt .3.txt .7.txt .1.sgml .3.sgml .7.sgml .h .h.html BINDIR = $(PREFIX)/bin INCLUDEDIR = $(PREFIX)/include @@ -10,8 +10,8 @@ INSTALL_DATA = install -m 0444 INSTALL_LIB = install -m 0644 INSTALL_MAN = $(INSTALL_DATA) -VERSION = 1.9.22 -VDATE = 31 March 2010 +VERSION = 1.9.23 +VDATE = 07 April 2010 VFLAGS = -DVERSION="\"$(VERSION)\"" WFLAGS = -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings @@ -68,7 +68,7 @@ HEADS = mdoc.h libmdoc.h man.h libman.h term.h \ GSGMLS = mandoc.1.sgml mdoc.3.sgml mdoc.7.sgml manuals.7.sgml \ mandoc_char.7.sgml man.7.sgml man.3.sgml SGMLS = index.sgml -HTMLS = ChangeLog.html index.html +HTMLS = ChangeLog.html index.html man.h.html mdoc.h.html XSLS = ChangeLog.xsl GHTMLS = mandoc.1.html mdoc.3.html man.3.html mdoc.7.html \ man.7.html mandoc_char.7.html manuals.7.html @@ -123,7 +123,7 @@ install: mkdir -p $(MANDIR)/man7 $(INSTALL_PROGRAM) mandoc $(BINDIR) $(INSTALL_MAN) mandoc.1 $(MANDIR)/man1 - $(INSTALL_MAN) man.7 mdoc.7 $(MANDIR)/man7 + $(INSTALL_MAN) man.7 mdoc.7 mandoc_char.7 $(MANDIR)/man7 $(INSTALL_DATA) example.style.css $(EXAMPLEDIR) uninstall: @@ -131,6 +131,7 @@ uninstall: rm -f $(MANDIR)/man1/mandoc.1 rm -f $(MANDIR)/man7/mdoc.7 rm -f $(MANDIR)/man7/man.7 + rm -f $(MANDIR)/man7/mandoc_char.7 rm -f $(EXAMPLEDIR)/example.style.css $(OBJS): config.h @@ -241,6 +242,9 @@ mandoc: $(MAINOBJS) libmdoc.a libman.a .tar.gz.md5: md5 $< > $@ +.h.h.html: + highlight -I $< >$@ + config.h: config.h.pre config.h.post rm -f config.log ( cat config.h.pre; \ diff --git a/external/bsd/mdocml/dist/html.c b/external/bsd/mdocml/dist/html.c index e4c05341c9e5..43791335fe2d 100644 --- a/external/bsd/mdocml/dist/html.c +++ b/external/bsd/mdocml/dist/html.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: html.c,v 1.96 2010/02/17 19:48:33 kristaps Exp $ */ +/* $Vendor-Id: html.c,v 1.97 2010/04/03 12:46:35 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -507,8 +507,6 @@ print_text(struct html *h, const char *p) case(')'): /* FALLTHROUGH */ case(']'): - /* FALLTHROUGH */ - case('}'): if ( ! (HTML_IGNDELIM & h->flags)) h->flags |= HTML_NOSPACE; break; @@ -525,11 +523,11 @@ print_text(struct html *h, const char *p) if (*p && 0 == *(p + 1)) switch (*p) { + case('|'): + /* FALLTHROUGH */ case('('): /* FALLTHROUGH */ case('['): - /* FALLTHROUGH */ - case('{'): h->flags |= HTML_NOSPACE; break; default: diff --git a/external/bsd/mdocml/dist/html.h b/external/bsd/mdocml/dist/html.h index 89aeddcf4246..65bd07c039a3 100644 --- a/external/bsd/mdocml/dist/html.h +++ b/external/bsd/mdocml/dist/html.h @@ -1,4 +1,4 @@ -/* $Vendor-Id: html.h,v 1.22 2010/01/29 14:39:38 kristaps Exp $ */ +/* $Vendor-Id: html.h,v 1.23 2010/04/05 08:51:56 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -90,18 +90,17 @@ struct htmlpair { const char *val; }; -#define PAIR_CLASS_INIT(p, v) \ - do { (p)->key = ATTR_CLASS; \ - (p)->val = (v); } while (/* CONSTCOND */ 0) -#define PAIR_HREF_INIT(p, v) \ - do { (p)->key = ATTR_HREF; \ - (p)->val = (v); } while (/* CONSTCOND */ 0) -#define PAIR_STYLE_INIT(p, h) \ - do { (p)->key = ATTR_STYLE; \ - (p)->val = (h)->buf; } while (/* CONSTCOND */ 0) -#define PAIR_SUMMARY_INIT(p, v) \ - do { (p)->key = ATTR_SUMMARY; \ - (p)->val = (v); } while (/* CONSTCOND */ 0) +#define PAIR_INIT(p, t, v) \ + do { \ + (p)->key = (t); \ + (p)->val = (v); \ + } while (/* CONSTCOND */ 0) + +#define PAIR_ID_INIT(p, v) PAIR_INIT(p, ATTR_ID, v) +#define PAIR_CLASS_INIT(p, v) PAIR_INIT(p, ATTR_CLASS, v) +#define PAIR_HREF_INIT(p, v) PAIR_INIT(p, ATTR_HREF, v) +#define PAIR_STYLE_INIT(p, h) PAIR_INIT(p, ATTR_STYLE, (h)->buf) +#define PAIR_SUMMARY_INIT(p, v) PAIR_INIT(p, ATTR_SUMMARY, v) enum htmltype { HTML_HTML_4_01_STRICT, diff --git a/external/bsd/mdocml/dist/libmdoc.h b/external/bsd/mdocml/dist/libmdoc.h index ef2930dbd24c..bb3fec7e84a8 100644 --- a/external/bsd/mdocml/dist/libmdoc.h +++ b/external/bsd/mdocml/dist/libmdoc.h @@ -1,4 +1,4 @@ -/* $Vendor-Id: libmdoc.h,v 1.31 2010/03/31 07:13:53 kristaps Exp $ */ +/* $Vendor-Id: libmdoc.h,v 1.33 2010/04/06 11:33:00 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -137,8 +137,7 @@ int mdoc_block_alloc(struct mdoc *, int, int, int mdoc_head_alloc(struct mdoc *, int, int, enum mdoct); int mdoc_tail_alloc(struct mdoc *, int, int, enum mdoct); int mdoc_body_alloc(struct mdoc *, int, int, enum mdoct); -void mdoc_node_free(struct mdoc_node *); -void mdoc_node_freelist(struct mdoc_node *); +void mdoc_node_delete(struct mdoc *, struct mdoc_node *); void mdoc_hash_init(void); enum mdoct mdoc_hash_find(const char *); int mdoc_iscdelim(char); @@ -167,6 +166,7 @@ int mdoc_argv(struct mdoc *, int, enum mdoct, #define ARGV_ARG (1) #define ARGV_WORD (2) void mdoc_argv_free(struct mdoc_arg *); +void mdoc_argn_free(struct mdoc_arg *, int); int mdoc_args(struct mdoc *, int, int *, char *, enum mdoct, char **); int mdoc_zargs(struct mdoc *, int, diff --git a/external/bsd/mdocml/dist/man.7 b/external/bsd/mdocml/dist/man.7 index dae1655b9b06..2dab1b06f8c0 100644 --- a/external/bsd/mdocml/dist/man.7 +++ b/external/bsd/mdocml/dist/man.7 @@ -1,4 +1,4 @@ -.\" $Vendor-Id: man.7,v 1.60 2010/03/27 10:22:28 kristaps Exp $ +.\" $Vendor-Id: man.7,v 1.61 2010/04/05 07:25:23 kristaps Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 27 2010 $ +.Dd $Mdocdate: April 5 2010 $ .Dt MAN 7 .Os . @@ -440,7 +440,6 @@ If a next-line macro is followed by a non-next-line macro, an error is raised (unless in the case of .Sx \&br , .Sx \&sp , -.Sx \&Sp , or .Sx \&na ) . .Pp diff --git a/external/bsd/mdocml/dist/man_validate.c b/external/bsd/mdocml/dist/man_validate.c index 368255ce6030..e06582249158 100644 --- a/external/bsd/mdocml/dist/man_validate.c +++ b/external/bsd/mdocml/dist/man_validate.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: man_validate.c,v 1.33 2010/03/29 10:10:35 kristaps Exp $ */ +/* $Vendor-Id: man_validate.c,v 1.34 2010/04/03 14:12:48 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -167,8 +167,19 @@ check_root(CHKARGS) if (NULL == m->first->child) return(man_nerr(m, n, WNODATA)); - if (NULL == m->meta.title) - return(man_nerr(m, n, WNOTITLE)); + if (NULL == m->meta.title) { + if ( ! man_nwarn(m, n, WNOTITLE)) + return(0); + /* + * If a title hasn't been set, do so now (by + * implication, date and section also aren't set). + * + * FIXME: this should be in man_action.c. + */ + m->meta.title = mandoc_strdup("unknown"); + m->meta.date = time(NULL); + m->meta.msec = 1; + } return(1); } diff --git a/external/bsd/mdocml/dist/mandoc.c b/external/bsd/mdocml/dist/mandoc.c index e06e002d2b36..884d29da074d 100644 --- a/external/bsd/mdocml/dist/mandoc.c +++ b/external/bsd/mdocml/dist/mandoc.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: mandoc.c,v 1.10 2010/01/05 19:51:10 kristaps Exp $ */ +/* $Vendor-Id: mandoc.c,v 1.11 2010/04/07 11:25:38 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -73,10 +73,6 @@ mandoc_special(const char *p) return(2); case ('e'): return(2); - case ('f'): - if ('\0' == *++p || ! isgraph((u_char)*p)) - return(0); - return(3); case ('s'): if ('\0' == *++p) return(2); @@ -152,6 +148,10 @@ mandoc_special(const char *p) } return(c); + case ('f'): + /* FALLTHROUGH */ + case ('F'): + /* FALLTHROUGH */ case ('*'): if (0 == *++p || ! isgraph((u_char)*p)) return(0); diff --git a/external/bsd/mdocml/dist/mandoc_char.7 b/external/bsd/mdocml/dist/mandoc_char.7 index 8546087e9b5e..55f35509a553 100644 --- a/external/bsd/mdocml/dist/mandoc_char.7 +++ b/external/bsd/mdocml/dist/mandoc_char.7 @@ -1,4 +1,4 @@ -.\" $Vendor-Id: mandoc_char.7,v 1.34 2010/03/30 19:20:33 kristaps Exp $ +.\" $Vendor-Id: mandoc_char.7,v 1.35 2010/04/05 10:33:20 kristaps Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 30 2010 $ +.Dd $Mdocdate: April 5 2010 $ .Dt MANDOC_CHAR 7 .Os . @@ -244,7 +244,7 @@ Logical: . .Pp Mathematical: -.Bl -column -compact -offset indent "Input" "Rendered" "Description" +.Bl -column -compact -offset indent "\[coproduct]X" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(pl Ta \(pl Ta plus .It \e(mi Ta \(mi Ta minus diff --git a/external/bsd/mdocml/dist/mdoc.7 b/external/bsd/mdocml/dist/mdoc.7 index 24d2f26f26e3..adeb96dce9c8 100644 --- a/external/bsd/mdocml/dist/mdoc.7 +++ b/external/bsd/mdocml/dist/mdoc.7 @@ -1,4 +1,4 @@ -.\" $Vendor-Id: mdoc.7,v 1.87 2010/03/31 07:13:53 kristaps Exp $ +.\" $Vendor-Id: mdoc.7,v 1.91 2010/04/07 08:17:16 kristaps Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 31 2010 $ +.Dd $Mdocdate: April 7 2010 $ .Dt MDOC 7 .Os . @@ -860,7 +860,7 @@ then the macro accepts an arbitrary number of arguments. .It Sx \&Ot Ta \&No Ta \&No Ta n .It Sx \&Ox Ta Yes Ta Yes Ta n .It Sx \&Pa Ta Yes Ta Yes Ta n -.It Sx \&Pf Ta \&No Ta Yes Ta 1 +.It Sx \&Pf Ta Yes Ta Yes Ta 1 .It Sx \&Pp Ta \&No Ta \&No Ta 0 .It Sx \&Rv Ta \&No Ta \&No Ta n .It Sx \&Sm Ta \&No Ta \&No Ta 1 @@ -974,10 +974,8 @@ Address construct: usually in the context of an computational address in memory, not a physical (post) address. .Pp Examples: -.Bd -literal -offset indent -\&.Ad [0,$] -\&.Ad 0x00000000 -.Ed +.D1 \&.Ad [0,$] +.D1 \&.Ad 0x00000000 . .Ss \&An Author name. This macro may alternatively accepts the following @@ -998,11 +996,8 @@ will cause the first listing also to be split. If not in the AUTHORS section, the default is not to split. .Pp Examples: -.Bd -literal -offset indent -\&.An -nosplit -\&.An J. E. Hopcraft , -\&.An J. D. Ullman . -.Ed +.D1 \&.An -nosplit +.D1 \&.An J. D. Ullman . .Pp .Em Remarks : the effects of @@ -1019,9 +1014,7 @@ Begins a block enclosed by angled brackets. Does not have any head arguments. .Pp Examples: -.Bd -literal -offset indent -\&.Fl -key= Ns Ao Ar val Ac -.Ed +.D1 \&.Fl -key= \&Ns \&Ao \&Ar val \&Ac .Pp See also .Sx \&Aq . @@ -1038,9 +1031,7 @@ a function: Encloses its arguments in angled brackets. .Pp Examples: -.Bd -literal -offset indent -\&.Fl -key= Ns Aq Ar val -.Ed +.D1 \&.Fl -key= \&Ns \&Aq \&Ar val .Pp .Em Remarks : this macro is often abused for rendering URIs, which should instead use @@ -1061,11 +1052,9 @@ Command arguments. If an argument is not provided, the string is used as a default. .Pp Examples: -.Bd -literal -offset indent -\&.Fl o Ns Ar file1 -\&.Ar -\&.Ar arg1 , arg2 . -.Ed +.D1 \&.Fl o \&Ns \&Ar file1 +.D1 \&.Ar +.D1 \&.Ar arg1 , arg2 . . .Ss \&At Formats an AT&T version. Accepts at most one parameter: @@ -1081,10 +1070,8 @@ A system version of Note that these parameters do not begin with a hyphen. .Pp Examples: -.Bd -literal -offset indent -\&.At -\&.At V.1 -.Ed +.D1 \&.At +.D1 \&.At V.1 .Pp See also .Sx \&Bsx , @@ -1244,7 +1231,7 @@ arguments. Examples: .Bd -literal -offset indent \&.Bo 1 , -\&.Dv BUFSIZ Bc +\&.Dv BUFSIZ \&Bc .Ed .Pp See also @@ -1254,9 +1241,7 @@ See also Encloses its arguments in square brackets. .Pp Examples: -.Bd -literal -offset indent -\&.Bq 1 , Dv BUFSIZ -.Ed +.D1 \&.Bq 1 , \&Dv BUFSIZ .Pp .Em Remarks : this macro is sometimes abused to emulate optional arguments for @@ -1281,7 +1266,7 @@ arguments. Examples: .Bd -literal -offset indent \&.Bro 1 , ... , -\&.Va n Brc +\&.Va n \&Brc .Ed .Pp See also @@ -1291,9 +1276,7 @@ See also Encloses its arguments in curly braces. .Pp Examples: -.Bd -literal -offset indent -\&.Brq 1 , ... , Va n -.Ed +.D1 \&.Brq 1 , ... , \&Va n .Pp See also .Sx \&Bro . @@ -1303,10 +1286,8 @@ Format the BSD/OS version provided as an argument, or a default value if no argument is provided. .Pp Examples: -.Bd -literal -offset indent -\&.Bsx 1.0 -\&.Bsx -.Ed +.D1 \&.Bsx 1.0 +.D1 \&.Bsx .Pp See also .Sx \&At , @@ -1327,10 +1308,8 @@ Format the BSD version provided as an argument, or a default value if no argument is provided. .Pp Examples: -.Bd -literal -offset indent -\&.Bx 4.4 -\&.Bx -.Ed +.D1 \&.Bx 4.4 +.D1 \&.Bx .Pp See also .Sx \&At , @@ -1348,9 +1327,7 @@ manuals). This denotes strings accepted by .Xr config 8 . .Pp Examples: -.Bd -literal -offset indent -\&.Cd device le0 at scode? -.Ed +.D1 \&.Cd device le0 at scode? .Pp .Em Remarks : this macro is commonly abused by using quoted literals to retain @@ -1363,10 +1340,8 @@ Command modifiers. Useful when specifying configuration options or keys. .Pp Examples: -.Bd -literal -offset indent -\&.Cm ControlPath -\&.Cm ControlMaster -.Ed +.D1 \&.Cm ControlPath +.D1 \&.Cm ControlMaster .Pp See also .Sx \&Fl . @@ -1376,9 +1351,7 @@ One-line indented display. This is formatted by the default rules and is useful for simple indented statements. It is followed by a newline. .Pp Examples: -.Bd -literal -offset indent -\&.D1 Fl abcdefgh -.Ed +.D1 \&.D1 \&Fl abcdefgh .Pp See also .Sx \&Bd @@ -1409,11 +1382,9 @@ or instead a valid canonical date as specified by If a date does not conform, the current date is used instead. .Pp Examples: -.Bd -literal -offset indent -\&.Dd $\&Mdocdate$ -\&.Dd $\&Mdocdate: July 21 2007$ -\&.Dd July 21, 2007 -.Ed +.D1 \&.Dd $\&Mdocdate$ +.D1 \&.Dd $\&Mdocdate: July 21 2007$ +.D1 \&.Dd July 21, 2007 .Pp See also .Sx \&Dt @@ -1425,9 +1396,7 @@ One-line intended display. This is formatted as literal text and is useful for commands and invocations. It is followed by a newline. .Pp Examples: -.Bd -literal -offset indent -\&.Dl % mandoc mdoc.7 | less -.Ed +.D1 \&.Dl % mandoc mdoc.7 | less .Pp See also .Sx \&Bd @@ -1439,9 +1408,7 @@ Begins a block enclosed by double quotes. Does not have any head arguments. .Pp Examples: -.Bd -literal -offset indent -\&.D1 Do April is the cruellest month Dc \e(em T.S. Eliot -.Ed +.D1 \&.D1 \&Do April is the cruellest month \&Dc \e(em T.S. Eliot .Pp See also .Sx \&Dq . @@ -1450,7 +1417,7 @@ See also Encloses its arguments in double quotes. .Pp Examples: -.Bd -literal -offset indent +.Bd -literal -offset indent -compact \&.Dq April is the cruellest month \e(em T.S. Eliot .Ed @@ -1572,12 +1539,10 @@ or .El .Pp Examples: -.Bd -literal -offset indent -\&.Dt FOO 1 -\&.Dt FOO 4 KM -\&.Dt FOO 9 i386 -\&.Dt FOO 9 KM i386 -.Ed +.D1 \&.Dt FOO 1 +.D1 \&.Dt FOO 4 KM +.D1 \&.Dt FOO 9 i386 +.D1 \&.Dt FOO 9 KM i386 .Pp See also .Sx \&Dd @@ -1588,10 +1553,8 @@ and Defined variables such as preprocessor constants. .Pp Examples: -.Bd -literal -offset indent -\&.Dv BUFSIZ -\&.Dv STDOUT_FILENO -.Ed +.D1 \&.Dv BUFSIZ +.D1 \&.Dv STDOUT_FILENO .Pp See also .Sx \&Er . @@ -1601,10 +1564,8 @@ Format the DragonFly BSD version provided as an argument, or a default value if no argument is provided. .Pp Examples: -.Bd -literal -offset indent -\&.Dx 2.4.1 -\&.Dx -.Ed +.D1 \&.Dx 2.4.1 +.D1 \&.Dx .Pp See also .Sx \&At , @@ -1621,27 +1582,24 @@ and .Ss \&Ef .Ss \&Ek .Ss \&El +. .Ss \&Em Denotes text that should be emphasised. Note that this is a presentation term and should not be used for stylistically decorating technical terms. .Pp Examples: -.Bd -literal -offset indent -\&.Ed Warnings! -\&.Ed Remarks : -.Ed +.D1 \&.Em Warnings! +.D1 \&.Em Remarks : . .Ss \&En .Ss \&Eo .Ss \&Er -Error constants (suggested for use only in section two manuals). +Display error constants. .Pp Examples: -.Bd -literal -offset indent -\&.Er EPERM -\&.Er ENOENT -.Ed +.D1 \&.Er EPERM +.D1 \&.Er ENOENT .Pp See also .Sx \&Dv . @@ -1653,10 +1611,8 @@ Environmental variables such as those specified in .Xr environ 7 . .Pp Examples: -.Bd -literal -offset indent -\&.Ev DISPLAY -\&.Ev PATH -.Ed +.D1 \&.Ev DISPLAY +.D1 \&.Ev PATH . .Ss \&Ex Inserts text regarding a utility's exit values. This macro must have @@ -1676,15 +1632,15 @@ is provided. Command-line flag. Used when listing arguments to command-line utilities. Prints a fixed-width hyphen .Sq \- -before each delimited argument. If no arguments are provided, a hyphen -is still printed. +directly followed by each argument. If no arguments are provided, a hyphen is +printed followed by a space. If the argument is a macro, a hyphen is +prefixed to the subsequent macro output. .Pp Examples: -.Bd -literal -offset indent -\&.Fl a b c -\&.Fl -\&.Op Fl o Ns Ar file -.Ed +.D1 \&.Fl a b c +.D1 \&.Fl \&Pf a b +.D1 \&.Fl +.D1 \&.Op \&Fl o \&Ns \&Ar file .Pp See also .Sx \&Cm . @@ -1698,10 +1654,8 @@ Format the FreeBSD version provided as an argument, or a default value if no argument is provided. .Pp Examples: -.Bd -literal -offset indent -\&.Fx 7.1 -\&.Fx -.Ed +.D1 \&.Fx 7.1 +.D1 \&.Fx .Pp See also .Sx \&At , @@ -1725,10 +1679,8 @@ Format a hyperlink. The calling syntax is as follows: .D1 \. Ns Sx \&Lk Cm uri Op Cm name .Pp Examples: -.Bd -literal -offset indent -\&.Lk http://bsd.lv "The BSD.lv Project" -\&.Lk http://bsd.lv -.Ed +.D1 \&.Lk http://bsd.lv "The BSD.lv Project" +.D1 \&.Lk http://bsd.lv .Pp See also .Sx \&Mt . @@ -1745,10 +1697,8 @@ Format the NetBSD version provided as an argument, or a default value if no argument is provided. .Pp Examples: -.Bd -literal -offset indent -\&.Nx 5.01 -\&.Nx -.Ed +.D1 \&.Nx 5.01 +.D1 \&.Nx .Pp See also .Sx \&At , @@ -1778,11 +1728,9 @@ unspecified, it defaults to the local operating system version. This is the suggested form. .Pp Examples: -.Bd -literal -offset indent -\&.Os -\&.Os KTH/CSC/TCS -\&.Os BSD 4.3 -.Ed +.D1 \&.Os +.D1 \&.Os KTH/CSC/TCS +.D1 \&.Os BSD 4.3 .Pp See also .Sx \&Dd @@ -1800,10 +1748,8 @@ Format the OpenBSD version provided as an argument, or a default value if no argument is provided. .Pp Examples: -.Bd -literal -offset indent -\&.Ox 4.5 -\&.Ox -.Ed +.D1 \&.Ox 4.5 +.D1 \&.Ox .Pp See also .Sx \&At , @@ -1853,7 +1799,7 @@ and child macros (at least one must be specified). .Pp Examples: -.Bd -literal -offset indent +.Bd -literal -offset indent -compact \&.Rs \&.%A J. E. Hopcroft \&.%A J. D. Ullman @@ -1886,9 +1832,7 @@ line. Format the UNIX name. Accepts no argument. .Pp Examples: -.Bd -literal -offset indent -\&.Ux -.Ed +.D1 \&.Ux .Pp See also .Sx \&At , @@ -1916,10 +1860,8 @@ Note that this should not be confused with which is used for function return types. .Pp Examples: -.Bd -literal -offset indent -\&.Vt unsigned char -\&.Vt extern const char * const sys_signame[] ; -.Ed +.D1 \&.Vt unsigned char +.D1 \&.Vt extern const char * const sys_signame[] ; .Pp See also .Sx \&Ft @@ -1955,11 +1897,9 @@ with .Xr groff 1 . .Pp Examples: -.Bd -literal -offset indent -\&.Xr mandoc 1 -\&.Xr mandoc 1 ; -\&.Xr mandoc 1 s behaviour -.Ed +.D1 \&.Xr mandoc 1 +.D1 \&.Xr mandoc 1 ; +.D1 \&.Xr mandoc 1 \&Ns s behaviour . .Ss \&br .Ss \&sp diff --git a/external/bsd/mdocml/dist/mdoc.c b/external/bsd/mdocml/dist/mdoc.c index 36edbc828d4e..fba6384081fd 100644 --- a/external/bsd/mdocml/dist/mdoc.c +++ b/external/bsd/mdocml/dist/mdoc.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: mdoc.c,v 1.118 2010/03/31 07:42:04 kristaps Exp $ */ +/* $Vendor-Id: mdoc.c,v 1.121 2010/04/06 11:33:00 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -26,6 +26,7 @@ #include #include #include +#include #include "libmdoc.h" #include "libmandoc.h" @@ -140,6 +141,9 @@ const char *const __mdoc_argnames[MDOC_ARG_MAX] = { const char * const *mdoc_macronames = __mdoc_macronames; const char * const *mdoc_argnames = __mdoc_argnames; +static void mdoc_node_free(struct mdoc_node *); +static void mdoc_node_unlink(struct mdoc *, + struct mdoc_node *); static void mdoc_free1(struct mdoc *); static void mdoc_alloc1(struct mdoc *); static struct mdoc_node *node_alloc(struct mdoc *, int, int, @@ -176,7 +180,7 @@ mdoc_free1(struct mdoc *mdoc) { if (mdoc->first) - mdoc_node_freelist(mdoc->first); + mdoc_node_delete(mdoc, mdoc->first); if (mdoc->meta.title) free(mdoc->meta.title); if (mdoc->meta.os) @@ -351,8 +355,22 @@ mdoc_macro(struct mdoc *m, enum mdoct tok, * we're in the body, deny prologue calls. */ if (MDOC_PROLOGUE & mdoc_macros[tok].flags && - MDOC_PBODY & m->flags) - return(mdoc_perr(m, ln, pp, EPROLBODY)); + MDOC_PBODY & m->flags) { + if ( ! mdoc_pwarn(m, ln, pp, EBODYPROL)) + return(0); + /* + * FIXME: do this in mdoc_action.c. + */ + if (NULL == m->meta.title) + m->meta.title = mandoc_strdup("unknown"); + if (NULL == m->meta.vol) + m->meta.vol = mandoc_strdup("local"); + if (NULL == m->meta.os) + m->meta.os = mandoc_strdup("local"); + if (0 == m->meta.date) + m->meta.date = time(NULL); + m->flags |= MDOC_PBODY; + } if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) && ! (MDOC_PBODY & m->flags)) return(mdoc_perr(m, ln, pp, EBODYPROL)); @@ -550,8 +568,6 @@ void mdoc_node_free(struct mdoc_node *p) { - if (p->parent) - p->parent->nchild--; if (p->string) free(p->string); if (p->args) @@ -560,16 +576,53 @@ mdoc_node_free(struct mdoc_node *p) } -void -mdoc_node_freelist(struct mdoc_node *p) +static void +mdoc_node_unlink(struct mdoc *m, struct mdoc_node *n) { - if (p->child) - mdoc_node_freelist(p->child); - if (p->next) - mdoc_node_freelist(p->next); + /* Adjust siblings. */ + if (n->prev) + n->prev->next = n->next; + if (n->next) + n->next->prev = n->prev; + + /* Adjust parent. */ + + if (n->parent) { + n->parent->nchild--; + if (n->parent->child == n) + n->parent->child = n->prev ? n->prev : n->next; + } + + /* Adjust parse point, if applicable. */ + + if (m && m->last == n) { + if (n->prev) { + m->last = n->prev; + m->next = MDOC_NEXT_SIBLING; + } else { + m->last = n->parent; + m->next = MDOC_NEXT_CHILD; + } + } + + if (m && m->first == n) + m->first = NULL; +} + + +void +mdoc_node_delete(struct mdoc *m, struct mdoc_node *p) +{ + + while (p->child) { + assert(p->nchild); + mdoc_node_delete(m, p->child); + } assert(0 == p->nchild); + + mdoc_node_unlink(m, p); mdoc_node_free(p); } @@ -600,8 +653,18 @@ parsetext(struct mdoc *m, int line, char *buf) for (i = 0; ' ' == buf[i]; i++) /* Skip leading whitespace. */ ; - if ('\0' == buf[i]) - return(mdoc_perr(m, line, 0, ENOBLANK)); + if ('\0' == buf[i]) { + if ( ! mdoc_pwarn(m, line, 0, ENOBLANK)) + return(0); + /* + * Assume that a `Pp' should be inserted in the case of + * a blank line. Technically, blank lines aren't + * allowed, but enough manuals assume this behaviour + * that we want to work around it. + */ + if ( ! mdoc_elem_alloc(m, line, 0, MDOC_Pp, NULL)) + return(0); + } /* * Break apart a free-form line into tokens. Spaces are diff --git a/external/bsd/mdocml/dist/mdoc_argv.c b/external/bsd/mdocml/dist/mdoc_argv.c index 380543db108a..71fd256e3f77 100644 --- a/external/bsd/mdocml/dist/mdoc_argv.c +++ b/external/bsd/mdocml/dist/mdoc_argv.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: mdoc_argv.c,v 1.36 2010/03/31 07:42:04 kristaps Exp $ */ +/* $Vendor-Id: mdoc_argv.c,v 1.37 2010/04/03 14:02:10 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -288,7 +288,7 @@ mdoc_argv(struct mdoc *m, int line, enum mdoct tok, void mdoc_argv_free(struct mdoc_arg *p) { - int i, j; + int i; if (NULL == p) return; @@ -300,26 +300,31 @@ mdoc_argv_free(struct mdoc_arg *p) } assert(p->argc); - /* LINTED */ - for (i = 0; i < (int)p->argc; i++) { - if (0 == p->argv[i].sz) - continue; - if (NULL == p->argv[i].value) - continue; - - /* LINTED */ - for (j = 0; j < (int)p->argv[i].sz; j++) - if (p->argv[i].value[j]) - free(p->argv[i].value[j]); - - free(p->argv[i].value); - } + for (i = (int)p->argc - 1; i >= 0; i--) + mdoc_argn_free(p, i); free(p->argv); free(p); } +void +mdoc_argn_free(struct mdoc_arg *p, int iarg) +{ + struct mdoc_argv *arg = &p->argv[iarg]; + int j; + + if (arg->sz && arg->value) { + for (j = (int)arg->sz - 1; j >= 0; j--) + free(arg->value[j]); + free(arg->value); + } + + for (--p->argc; iarg < (int)p->argc; iarg++) + p->argv[iarg] = p->argv[iarg+1]; +} + + int mdoc_zargs(struct mdoc *m, int line, int *pos, char *buf, int flags, char **v) diff --git a/external/bsd/mdocml/dist/mdoc_html.c b/external/bsd/mdocml/dist/mdoc_html.c index f3e10e6f38a7..243884987cb5 100644 --- a/external/bsd/mdocml/dist/mdoc_html.c +++ b/external/bsd/mdocml/dist/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: mdoc_html.c,v 1.55 2010/03/29 19:28:04 kristaps Exp $ */ +/* $Vendor-Id: mdoc_html.c,v 1.60 2010/04/07 07:49:38 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -589,14 +589,9 @@ mdoc_sh_pre(MDOC_ARGS) html_idcat(buf, " ", BUFSIZ); } - /* - * TODO: make sure there are no duplicates, as HTML does not - * allow for multiple `id' tags of the same name. - */ - PAIR_CLASS_INIT(&tag[0], "sec-head"); - tag[1].key = ATTR_ID; - tag[1].val = buf; + PAIR_ID_INIT(&tag[1], buf); + print_otag(h, TAG_DIV, 2, tag); return(1); } @@ -648,8 +643,8 @@ mdoc_ss_pre(MDOC_ARGS) PAIR_CLASS_INIT(&tag[0], "ssec-head"); PAIR_STYLE_INIT(&tag[1], h); - tag[2].key = ATTR_ID; - tag[2].val = buf; + PAIR_ID_INIT(&tag[2], buf); + print_otag(h, TAG_DIV, 3, tag); return(1); } @@ -671,10 +666,10 @@ mdoc_fl_pre(MDOC_ARGS) print_text(h, "\\-"); - /* A blank `Fl' should incur a subsequent space. */ - if (n->child) h->flags |= HTML_NOSPACE; + else if (n->next && n->next->line == n->line) + h->flags |= HTML_NOSPACE; return(1); } @@ -756,14 +751,16 @@ mdoc_xr_pre(MDOC_ARGS) struct htmlpair tag[2]; const struct mdoc_node *nn; + if (NULL == n->child) + return(0); + PAIR_CLASS_INIT(&tag[0], "link-man"); if (h->base_man) { buffmt_man(h, n->child->string, n->child->next ? n->child->next->string : NULL); - tag[1].key = ATTR_HREF; - tag[1].val = h->buf; + PAIR_HREF_INIT(&tag[1], h->buf); print_otag(h, TAG_A, 2, tag); } else print_otag(h, TAG_A, 1, tag); @@ -1119,6 +1116,8 @@ mdoc_bl_pre(MDOC_ARGS) { struct ord *ord; + if (MDOC_HEAD == n->type) + return(0); if (MDOC_BLOCK != n->type) return(1); if (MDOC_Enum != a2list(n)) @@ -1306,8 +1305,6 @@ mdoc_sx_pre(MDOC_ARGS) const struct mdoc_node *nn; char buf[BUFSIZ]; - /* FIXME: duplicates? */ - strlcpy(buf, "#", BUFSIZ); for (nn = n->child; nn; nn = nn->next) { html_idcat(buf, nn->string, BUFSIZ); @@ -1316,8 +1313,7 @@ mdoc_sx_pre(MDOC_ARGS) } PAIR_CLASS_INIT(&tag[0], "link-sec"); - tag[1].key = ATTR_HREF; - tag[1].val = buf; + PAIR_HREF_INIT(&tag[1], buf); print_otag(h, TAG_A, 2, tag); return(1); @@ -1392,6 +1388,7 @@ mdoc_bd_pre(MDOC_ARGS) } /* FIXME: -centered, etc. formatting. */ + /* FIXME: does not respect -offset ??? */ if (MDOC_BLOCK == n->type) { bufcat_su(h, "margin-left", &su); @@ -1583,15 +1580,15 @@ mdoc_vt_pre(MDOC_ARGS) struct htmlpair tag; struct roffsu su; - if (MDOC_BLOCK == n->type) { - if (n->prev && MDOC_Vt != n->prev->tok) { + if (SEC_SYNOPSIS == n->sec && MDOC_BLOCK == n->type) { + if (n->next && MDOC_Vt != n->next->tok) { SCALE_VS_INIT(&su, 1); - bufcat_su(h, "margin-top", &su); + bufcat_su(h, "margin-bottom", &su); PAIR_STYLE_INIT(&tag, h); print_otag(h, TAG_DIV, 1, &tag); } else print_otag(h, TAG_DIV, 0, NULL); - + return(1); } else if (MDOC_HEAD == n->type) return(0); @@ -1607,17 +1604,9 @@ static int mdoc_ft_pre(MDOC_ARGS) { struct htmlpair tag; - struct roffsu su; - if (SEC_SYNOPSIS == n->sec) { - if (n->prev && MDOC_Fo == n->prev->tok) { - SCALE_VS_INIT(&su, 1); - bufcat_su(h, "margin-top", &su); - PAIR_STYLE_INIT(&tag, h); - print_otag(h, TAG_DIV, 1, &tag); - } else - print_otag(h, TAG_DIV, 0, NULL); - } + if (SEC_SYNOPSIS == n->sec) + print_otag(h, TAG_DIV, 0, NULL); PAIR_CLASS_INIT(&tag, "ftype"); print_otag(h, TAG_SPAN, 1, &tag); @@ -1671,10 +1660,27 @@ mdoc_fn_pre(MDOC_ARGS) } PAIR_CLASS_INIT(&tag[0], "fname"); + + /* + * FIXME: only refer to IDs that we know exist. + */ + +#if 0 + if (SEC_SYNOPSIS == n->sec) { + nbuf[0] = '\0'; + html_idcat(nbuf, sp, BUFSIZ); + PAIR_ID_INIT(&tag[1], nbuf); + } else { + strlcpy(nbuf, "#", BUFSIZ); + html_idcat(nbuf, sp, BUFSIZ); + PAIR_HREF_INIT(&tag[1], nbuf); + } +#endif + t = print_otag(h, TAG_SPAN, 1, tag); if (sp) { - (void)strlcpy(nbuf, sp, BUFSIZ); + strlcpy(nbuf, sp, BUFSIZ); print_text(h, nbuf); } @@ -1775,8 +1781,7 @@ mdoc_lk_pre(MDOC_ARGS) nn = n->child; PAIR_CLASS_INIT(&tag[0], "link-ext"); - tag[1].key = ATTR_HREF; - tag[1].val = nn->string; + PAIR_HREF_INIT(&tag[1], nn->string); print_otag(h, TAG_A, 2, tag); if (NULL == nn->next) @@ -1803,7 +1808,7 @@ mdoc_mt_pre(MDOC_ARGS) bufinit(h); bufcat(h, "mailto:"); bufcat(h, nn->string); - PAIR_STYLE_INIT(&tag[1], h); + PAIR_HREF_INIT(&tag[1], h->buf); t = print_otag(h, TAG_A, 2, tag); print_text(h, nn->string); print_tagq(h, t); @@ -1818,14 +1823,20 @@ static int mdoc_fo_pre(MDOC_ARGS) { struct htmlpair tag; + struct roffsu su; if (MDOC_BODY == n->type) { h->flags |= HTML_NOSPACE; print_text(h, "("); h->flags |= HTML_NOSPACE; return(1); - } else if (MDOC_BLOCK == n->type) + } else if (MDOC_BLOCK == n->type && n->next) { + SCALE_VS_INIT(&su, 1); + bufcat_su(h, "margin-bottom", &su); + PAIR_STYLE_INIT(&tag, h); + print_otag(h, TAG_DIV, 1, &tag); return(1); + } PAIR_CLASS_INIT(&tag, "fname"); print_otag(h, TAG_SPAN, 1, &tag); @@ -1885,8 +1896,8 @@ mdoc_in_pre(MDOC_ARGS) bufinit(h); if (h->base_includes) { buffmt_includes(h, nn->string); - tag[i].key = ATTR_HREF; - tag[i++].val = h->buf; + PAIR_HREF_INIT(&tag[i], h->buf); + i++; } t = print_otag(h, TAG_A, i, tag); print_mdoc_node(m, nn, h); diff --git a/external/bsd/mdocml/dist/mdoc_macro.c b/external/bsd/mdocml/dist/mdoc_macro.c index 4a9258dd0a9f..309ebe616382 100644 --- a/external/bsd/mdocml/dist/mdoc_macro.c +++ b/external/bsd/mdocml/dist/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: mdoc_macro.c,v 1.49 2010/03/31 08:04:57 kristaps Exp $ */ +/* $Vendor-Id: mdoc_macro.c,v 1.52 2010/04/06 07:17:51 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -27,9 +27,11 @@ #include "libmdoc.h" -#define REWIND_REWIND (1 << 0) -#define REWIND_NOHALT (1 << 1) -#define REWIND_HALT (1 << 2) +enum rew { + REWIND_REWIND, + REWIND_NOHALT, + REWIND_HALT +}; static int ctx_synopsis(MACRO_PROT_ARGS); static int obsolete(MACRO_PROT_ARGS); @@ -42,7 +44,7 @@ static int blk_exp_close(MACRO_PROT_ARGS); static int blk_part_imp(MACRO_PROT_ARGS); static int phrase(struct mdoc *, int, int, char *); -static int rew_dohalt(enum mdoct, enum mdoc_type, +static enum rew rew_dohalt(enum mdoct, enum mdoc_type, const struct mdoc_node *); static enum mdoct rew_alt(enum mdoct); static int rew_dobreak(enum mdoct, const struct mdoc_node *); @@ -137,7 +139,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Nx */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ox */ { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Pc */ - { in_line_argn, MDOC_PARSED | MDOC_IGNDELIM }, /* Pf */ + { in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_IGNDELIM }, /* Pf */ { blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Po */ { blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Pq */ { blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Qc */ @@ -368,7 +370,7 @@ rew_alt(enum mdoct tok) * close our current scope (REWIND_REWIND), or continue (REWIND_NOHALT). * The scope-closing and so on occurs in the various rew_* routines. */ -static int +static enum rew rew_dohalt(enum mdoct tok, enum mdoc_type type, const struct mdoc_node *p) { @@ -574,7 +576,7 @@ rew_sub(enum mdoc_type t, struct mdoc *m, enum mdoct tok, int line, int ppos) { struct mdoc_node *n; - int c; + enum rew c; /* LINTED */ for (n = m->last; n; n = n->parent) { @@ -818,7 +820,7 @@ in_line(MACRO_PROT_ARGS) * the word. */ - d = mdoc_isdelim(p); + d = ARGS_QWORD == w ? 0 : mdoc_isdelim(p); if (ARGS_QWORD != w && d) { if (0 == lastpunct && ! rew_elem(m, tok)) @@ -954,6 +956,7 @@ blk_full(MACRO_PROT_ARGS) /* Don't emit leading punct. for phrases. */ if (NULL == head && ARGS_PHRASE != c && + ARGS_QWORD != c && 1 == mdoc_isdelim(p)) { if ( ! mdoc_word_alloc(m, line, la, p)) return(0); @@ -1077,7 +1080,8 @@ blk_part_imp(MACRO_PROT_ARGS) if (ARGS_PUNCT == c) break; - if (NULL == body && 1 == mdoc_isdelim(p)) { + if (NULL == body && ARGS_QWORD != c && + 1 == mdoc_isdelim(p)) { if ( ! mdoc_word_alloc(m, line, la, p)) return(0); continue; @@ -1169,7 +1173,8 @@ blk_part_exp(MACRO_PROT_ARGS) /* Flush out leading punctuation. */ - if (NULL == head && 1 == mdoc_isdelim(p)) { + if (NULL == head && ARGS_QWORD != c && + 1 == mdoc_isdelim(p)) { assert(NULL == body); if ( ! mdoc_word_alloc(m, line, la, p)) return(0); @@ -1305,6 +1310,7 @@ in_line_argn(MACRO_PROT_ARGS) break; if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) && + ARGS_QWORD != c && 0 == j && 1 == mdoc_isdelim(p)) { if ( ! mdoc_word_alloc(m, line, la, p)) return(0); @@ -1330,6 +1336,7 @@ in_line_argn(MACRO_PROT_ARGS) } if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) && + ARGS_QWORD != c && ! flushed && mdoc_isdelim(p)) { if ( ! rew_elem(m, tok)) return(0); diff --git a/external/bsd/mdocml/dist/mdoc_strings.c b/external/bsd/mdocml/dist/mdoc_strings.c index 3fe2c0298c14..79c80c4f35ca 100644 --- a/external/bsd/mdocml/dist/mdoc_strings.c +++ b/external/bsd/mdocml/dist/mdoc_strings.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: mdoc_strings.c,v 1.15 2010/03/29 19:28:04 kristaps Exp $ */ +/* $Vendor-Id: mdoc_strings.c,v 1.16 2010/04/03 12:46:35 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -61,18 +61,20 @@ static const struct mdoc_secname secnames[SECNAME_MAX] = { }; +/* + * FIXME: this is repeated in print_text() (html.c) and term_word() + * (term.c). + */ int mdoc_iscdelim(char p) { switch (p) { - case('|'): + case('|'): /* FIXME! */ /* FALLTHROUGH */ case('('): /* FALLTHROUGH */ case('['): - /* FALLTHROUGH */ - case('{'): return(1); case('.'): /* FALLTHROUGH */ @@ -89,8 +91,6 @@ mdoc_iscdelim(char p) case(')'): /* FALLTHROUGH */ case(']'): - /* FALLTHROUGH */ - case('}'): return(2); default: break; diff --git a/external/bsd/mdocml/dist/mdoc_term.c b/external/bsd/mdocml/dist/mdoc_term.c index d29871fc7ed3..abc6dd78ae86 100644 --- a/external/bsd/mdocml/dist/mdoc_term.c +++ b/external/bsd/mdocml/dist/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: mdoc_term.c,v 1.112 2010/03/29 19:28:04 kristaps Exp $ */ +/* $Vendor-Id: mdoc_term.c,v 1.116 2010/04/06 16:27:53 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -99,6 +99,7 @@ static int termp_ap_pre(DECL_ARGS); static int termp_aq_pre(DECL_ARGS); static int termp_bd_pre(DECL_ARGS); static int termp_bf_pre(DECL_ARGS); +static int termp_bl_pre(DECL_ARGS); static int termp_bold_pre(DECL_ARGS); static int termp_bq_pre(DECL_ARGS); static int termp_brq_pre(DECL_ARGS); @@ -148,7 +149,7 @@ static const struct termact termacts[MDOC_MAX] = { { termp_d1_pre, termp_d1_post }, /* Dl */ { termp_bd_pre, termp_bd_post }, /* Bd */ { NULL, NULL }, /* Ed */ - { NULL, termp_bl_post }, /* Bl */ + { termp_bl_pre, termp_bl_post }, /* Bl */ { NULL, NULL }, /* El */ { termp_it_pre, termp_it_post }, /* It */ { NULL, NULL }, /* Ad */ @@ -1070,10 +1071,10 @@ termp_fl_pre(DECL_ARGS) term_fontpush(p, TERMFONT_BOLD); term_word(p, "\\-"); - /* A blank `Fl' should incur a subsequent space. */ - if (n->child) p->flags |= TERMP_NOSPACE; + else if (n->next && n->next->line == n->line) + p->flags |= TERMP_NOSPACE; return(1); } @@ -1249,6 +1250,15 @@ termp_nd_pre(DECL_ARGS) } +/* ARGSUSED */ +static int +termp_bl_pre(DECL_ARGS) +{ + + return(MDOC_HEAD != n->type); +} + + /* ARGSUSED */ static void termp_bl_post(DECL_ARGS) @@ -1277,7 +1287,10 @@ termp_xr_pre(DECL_ARGS) { const struct mdoc_node *nn; - assert(n->child && MDOC_TEXT == n->child->type); + if (NULL == n->child) + return(0); + + assert(MDOC_TEXT == n->child->type); nn = n->child; term_word(p, nn->string); @@ -1591,8 +1604,8 @@ termp_bd_pre(DECL_ARGS) if (MDOC_BLOCK == n->type) { print_bvspace(p, n, n); return(1); - } else if (MDOC_BODY != n->type) - return(1); + } else if (MDOC_HEAD == n->type) + return(0); nn = n->parent; diff --git a/external/bsd/mdocml/dist/mdoc_validate.c b/external/bsd/mdocml/dist/mdoc_validate.c index 0d20648f7b6b..fd1741e4ef76 100644 --- a/external/bsd/mdocml/dist/mdoc_validate.c +++ b/external/bsd/mdocml/dist/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: mdoc_validate.c,v 1.59 2010/03/31 07:13:53 kristaps Exp $ */ +/* $Vendor-Id: mdoc_validate.c,v 1.67 2010/04/06 17:01:27 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -77,6 +77,7 @@ static int ewarn_ge1(POST_ARGS); static int herr_eq0(POST_ARGS); static int herr_ge1(POST_ARGS); static int hwarn_eq1(POST_ARGS); +static int hwarn_eq0(POST_ARGS); static int hwarn_le1(POST_ARGS); static int post_an(POST_ARGS); @@ -101,7 +102,6 @@ static int pre_cd(PRE_ARGS); static int pre_dd(PRE_ARGS); static int pre_display(PRE_ARGS); static int pre_dt(PRE_ARGS); -static int pre_er(PRE_ARGS); static int pre_ex(PRE_ARGS); static int pre_fd(PRE_ARGS); static int pre_it(PRE_ARGS); @@ -113,7 +113,7 @@ static int pre_ss(PRE_ARGS); static v_post posts_an[] = { post_an, NULL }; static v_post posts_at[] = { post_at, NULL }; -static v_post posts_bd[] = { herr_eq0, bwarn_ge1, NULL }; +static v_post posts_bd[] = { hwarn_eq0, bwarn_ge1, NULL }; static v_post posts_bf[] = { hwarn_le1, post_bf, NULL }; static v_post posts_bl[] = { bwarn_ge1, post_bl, NULL }; static v_post posts_bool[] = { eerr_eq1, ebool, NULL }; @@ -133,7 +133,7 @@ static v_post posts_text1[] = { eerr_eq1, NULL }; static v_post posts_vt[] = { post_vt, NULL }; static v_post posts_wline[] = { bwarn_ge1, herr_eq0, NULL }; static v_post posts_wtext[] = { ewarn_ge1, NULL }; -static v_post posts_xr[] = { eerr_ge1, NULL }; +static v_post posts_xr[] = { ewarn_ge1, NULL }; static v_pre pres_an[] = { pre_an, NULL }; static v_pre pres_bd[] = { pre_display, pre_bd, NULL }; static v_pre pres_bl[] = { pre_bl, NULL }; @@ -141,7 +141,7 @@ static v_pre pres_cd[] = { pre_cd, NULL }; static v_pre pres_d1[] = { pre_display, NULL }; static v_pre pres_dd[] = { pre_dd, NULL }; static v_pre pres_dt[] = { pre_dt, NULL }; -static v_pre pres_er[] = { pre_er, NULL }; +static v_pre pres_er[] = { NULL, NULL }; static v_pre pres_ex[] = { pre_ex, NULL }; static v_pre pres_fd[] = { pre_fd, NULL }; static v_pre pres_it[] = { pre_it, NULL }; @@ -414,6 +414,7 @@ CHECK_HEAD_DEFN(eq0, err, err_child_eq, 0) /* herr_eq0() */ CHECK_HEAD_DEFN(le1, warn, warn_child_lt, 2) /* hwarn_le1() */ CHECK_HEAD_DEFN(ge1, err, err_child_gt, 0) /* herr_ge1() */ CHECK_HEAD_DEFN(eq1, warn, warn_child_eq, 1) /* hwarn_eq1() */ +CHECK_HEAD_DEFN(eq0, warn, warn_child_eq, 0) /* hwarn_eq0() */ static int @@ -621,8 +622,21 @@ pre_bl(PRE_ARGS) case (MDOC_Inset): /* FALLTHROUGH */ case (MDOC_Column): - if (type >= 0) - return(mdoc_nerr(mdoc, n, EMULTILIST)); + /* + * Note that if a duplicate is detected, we + * remove the duplicate instead of passing it + * over. If we don't do this, mdoc_action will + * become confused when it scans over multiple + * types whilst setting its bitmasks. + * + * FIXME: this should occur in mdoc_action.c. + */ + if (type >= 0) { + if ( ! mdoc_nwarn(mdoc, n, EMULTILIST)) + return(0); + mdoc_argn_free(n->args, pos); + break; + } type = n->args->argv[pos].arg; break; case (MDOC_Compact): @@ -788,14 +802,6 @@ pre_ex(PRE_ARGS) } -static int -pre_er(PRE_ARGS) -{ - - return(check_msec(mdoc, n, 2, 3, 9, 0)); -} - - static int pre_cd(PRE_ARGS) { @@ -1082,21 +1088,23 @@ post_bl_head(POST_ARGS) { int i; const struct mdoc_node *n; + const struct mdoc_argv *a; n = mdoc->last->parent; assert(n->args); - for (i = 0; i < (int)n->args->argc; i++) - if (n->args->argv[i].arg == MDOC_Column) - break; + for (i = 0; i < (int)n->args->argc; i++) { + a = &n->args->argv[i]; + if (a->arg == MDOC_Column) { + if (a->sz && mdoc->last->nchild) + return(mdoc_nerr(mdoc, n, ECOLMIS)); + return(1); + } + } - if (i == (int)n->args->argc) + if (0 == (i = mdoc->last->nchild)) return(1); - - if (n->args->argv[i].sz && mdoc->last->child) - return(mdoc_nerr(mdoc, n, ECOLMIS)); - - return(1); + return(warn_count(mdoc, "==", 0, "line arguments", i)); } @@ -1308,8 +1316,9 @@ post_sh_head(POST_ARGS) * non-CUSTOM has a conventional order to be followed. */ - if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed) - return(mdoc_nerr(mdoc, mdoc->last, ESECNAME)); + if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed && + ! mdoc_nwarn(mdoc, mdoc->last, ESECNAME)) + return(0); if (SEC_CUSTOM == sec) return(1); if (sec == mdoc->lastnamed) diff --git a/external/bsd/mdocml/dist/out.c b/external/bsd/mdocml/dist/out.c index de895de77b61..de4c53efd652 100644 --- a/external/bsd/mdocml/dist/out.c +++ b/external/bsd/mdocml/dist/out.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: out.c,v 1.12 2010/01/01 17:14:30 kristaps Exp $ */ +/* $Vendor-Id: out.c,v 1.15 2010/04/07 11:29:55 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons * @@ -197,14 +197,14 @@ int a2roffdeco(enum roffdeco *d, const char **word, size_t *sz) { - int j, type, term, lim; + int j, term, lim; + char set; const char *wp, *sp; *d = DECO_NONE; wp = *word; - type = 1; - switch (*wp) { + switch ((set = *wp)) { case ('\0'): return(0); @@ -219,6 +219,67 @@ a2roffdeco(enum roffdeco *d, *word = wp; return(3); + case ('F'): + /* FALLTHROUGH */ + case ('f'): + /* + * FIXME: this needs work and consolidation (it should + * follow the sequence that special characters do, for + * one), but isn't a priority at the moment. Note, for + * one, that in reality \fB != \FB, although here we let + * these slip by. + */ + switch (*(++wp)) { + case ('\0'): + return(1); + case ('3'): + /* FALLTHROUGH */ + case ('B'): + *d = DECO_BOLD; + return(2); + case ('2'): + /* FALLTHROUGH */ + case ('I'): + *d = DECO_ITALIC; + return(2); + case ('P'): + *d = DECO_PREVIOUS; + return(2); + case ('1'): + /* FALLTHROUGH */ + case ('R'): + *d = DECO_ROMAN; + return(2); + case ('('): + if ('\0' == *(++wp)) + return(2); + if ('\0' == *(wp + 1)) + return(3); + + *d = 'F' == set ? DECO_FFONT : DECO_FONT; + *sz = 2; + *word = wp; + return(4); + case ('['): + *word = ++wp; + for (j = 0; *wp && ']' != *wp; wp++, j++) + /* Loop... */ ; + + if ('\0' == *wp) + return(j + 2); + + *d = 'F' == set ? DECO_FFONT : DECO_FONT; + *sz = (size_t)j; + return(j + 3); + default: + break; + } + + *d = 'F' == set ? DECO_FFONT : DECO_FONT; + *sz = 1; + *word = wp; + return(2); + case ('*'): switch (*(++wp)) { case ('\0'): @@ -236,16 +297,25 @@ a2roffdeco(enum roffdeco *d, return(4); case ('['): - type = 0; - break; + *word = ++wp; + for (j = 0; *wp && ']' != *wp; wp++, j++) + /* Loop... */ ; + + if ('\0' == *wp) + return(j + 2); + + *d = DECO_RESERVED; + *sz = (size_t)j; + return(j + 3); default: - *d = DECO_RESERVED; - *sz = 1; - *word = wp; - return(2); + break; } - break; + + *d = DECO_RESERVED; + *sz = 1; + *word = wp; + return(2); case ('s'): sp = wp; @@ -300,36 +370,18 @@ a2roffdeco(enum roffdeco *d, *d = DECO_SIZE; return((int)(wp - sp)); - case ('f'): - switch (*(++wp)) { - case ('\0'): - return(1); - case ('3'): - /* FALLTHROUGH */ - case ('B'): - *d = DECO_BOLD; - break; - case ('2'): - /* FALLTHROUGH */ - case ('I'): - *d = DECO_ITALIC; - break; - case ('P'): - *d = DECO_PREVIOUS; - break; - case ('1'): - /* FALLTHROUGH */ - case ('R'): - *d = DECO_ROMAN; - break; - default: - break; - } - - return(2); - case ('['): - break; + *word = ++wp; + + for (j = 0; *wp && ']' != *wp; wp++, j++) + /* Loop... */ ; + + if ('\0' == *wp) + return(j + 1); + + *d = DECO_SPECIAL; + *sz = (size_t)j; + return(j + 2); case ('c'): *d = DECO_NOSPACE; @@ -337,20 +389,11 @@ a2roffdeco(enum roffdeco *d, return(1); default: - *d = DECO_SPECIAL; - *word = wp; - *sz = 1; - return(1); + break; } - *word = ++wp; - for (j = 0; *wp && ']' != *wp; wp++, j++) - /* Loop... */ ; - - if ('\0' == *wp) - return(j + 1); - - *d = type ? DECO_SPECIAL : DECO_RESERVED; - *sz = (size_t)j; - return (j + 2); + *d = DECO_SPECIAL; + *word = wp; + *sz = 1; + return(1); } diff --git a/external/bsd/mdocml/dist/out.h b/external/bsd/mdocml/dist/out.h index e68794966e9a..acbf446788d5 100644 --- a/external/bsd/mdocml/dist/out.h +++ b/external/bsd/mdocml/dist/out.h @@ -1,4 +1,4 @@ -/* $Vendor-Id: out.h,v 1.9 2009/11/12 08:21:05 kristaps Exp $ */ +/* $Vendor-Id: out.h,v 1.10 2010/04/07 11:25:38 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons * @@ -45,6 +45,8 @@ enum roffdeco { DECO_PREVIOUS, DECO_SIZE, DECO_NOSPACE, + DECO_FONT, /* font */ + DECO_FFONT, /* font family */ DECO_MAX }; diff --git a/external/bsd/mdocml/dist/style.css b/external/bsd/mdocml/dist/style.css index 0b84e0478e8b..090c7331c76b 100644 --- a/external/bsd/mdocml/dist/style.css +++ b/external/bsd/mdocml/dist/style.css @@ -4,10 +4,12 @@ div.body { color: #333333; font-size: smaller; font-family: Verdana, Tahoma, Arial, sans-serif; } -div.sec-head { font-weight: bold; color: blue; } /* Sections (Sh). */ +div.sec-head { color: #000000; + font-weight: bold; } div.sec-body { } -div.sec-block { } -div.ssec-head { font-weight: bold; color: blue; } /* Sub-sections (Ss). */ +div.sec-block { padding-bottom: 1em; } +div.ssec-head { color: #000000; + font-weight: bold; } div.ssec-body { } div.ssec-block { } @@ -31,7 +33,7 @@ span.includes { font-weight: bold; } /* Header includes (In). */ span.lib { } /* Library (Lb). */ span.lit { font-family: monospace; } /* Literals (Bf -literal). */ span.macro { font-weight: bold; } /* Macro-ish thing (Fd). */ -span.name { font-weight: bold; } /* Name of utility (Nm). */ +span.name { color: #003333; font-weight: bold; } /* Name of utility (Nm). */ span.opt { } /* Options (Op, Oo/Oc). */ span.ref { } /* Citations (Rs). */ span.ref-auth { } /* Reference author (%A). */ @@ -57,12 +59,19 @@ a.link-ext { background: transparent url(external.png) center right no-repeat; p a.link-includes { } /* Include-file link (In). */ a.link-mail { background: transparent url(external.png) center right no-repeat; padding-right: 12px; }/* Mailto links (Mt). */ a.link-man { } /* Manual links (Xr). */ -a.link-sec { } /* Section links (Sx). */ +a.link-sec { text-decoration: none; border-bottom: 1px dotted #339999; } /* Section links (Sx). */ div.emph { font-style: italic; } /* Emphasis (Bl -emphasis). */ -div.lit { font-family: monospace; } /* Literal (D1, Bd -literal, Dl, Bd -literal). */ +div.lit { margin: 3px; + padding: 3px; + background-color: #EEEEEE; + border: 1px solid #339999; + color: #000000; + font-family: monospace; } div.symb { font-weight: bold; } /* Symbols (Bl -symbolic). */ -table.header { border-bottom: 1px dotted #cccccc; }/* Document footer. */ -table.footer { border-top: 1px dotted #cccccc; }/* Document header. */ +table.header { border-bottom: 1px dotted #dddddd; + color: #999999; } +table.footer { border-top: 1px dotted #dddddd; + color: #999999; } diff --git a/external/bsd/mdocml/dist/term.c b/external/bsd/mdocml/dist/term.c index f51e03eb8d84..c0e032a0590c 100644 --- a/external/bsd/mdocml/dist/term.c +++ b/external/bsd/mdocml/dist/term.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: term.c,v 1.129 2010/03/23 12:42:22 kristaps Exp $ */ +/* $Vendor-Id: term.c,v 1.130 2010/04/03 12:46:35 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -92,12 +92,10 @@ term_alloc(enum termenc enc) * Flush a line of text. A "line" is loosely defined as being something * that should be followed by a newline, regardless of whether it's * broken apart by newlines getting there. A line can also be a - * fragment of a columnar list. + * fragment of a columnar list (`Bl -tag' or `Bl -column'), which does + * not have a trailing newline. * - * Specifically, a line is whatever's in p->buf of length p->col, which - * is zeroed after this function returns. - * - * The usage of termp:flags is as follows: + * The following flags may be specified: * * - TERMP_NOLPAD: when beginning to write the line, don't left-pad the * offset value. This is useful when doing columnar lists where the @@ -133,6 +131,7 @@ term_flushln(struct termp *p) size_t vbl; /* number of blanks to prepend to output */ size_t vsz; /* visual characters to write to output */ size_t bp; /* visual right border position */ + size_t hyph; /* visible position of hyphen */ int j; /* temporary loop index */ size_t maxvis, mmax; @@ -178,16 +177,23 @@ term_flushln(struct termp *p) * (starting with the CSI) aren't counted. A space * generates a non-printing word, which is valid (the * space is printed according to regular spacing rules). + * Collect the number of printable characters until the + * first hyphen, if found. Hyphens aren't included if + * they're the first character (so `Fl' doesn't break) + * or second consecutive character (`Fl -'). */ /* LINTED */ - for (j = i, vsz = 0; j < (int)p->col; j++) { + for (j = i, vsz = 0, hyph = 0; j < (int)p->col; j++) { if (j && ' ' == p->buf[j]) break; - else if (8 == p->buf[j]) + if (8 == p->buf[j]) vsz--; else vsz++; + if (j > i && '-' == p->buf[j] && 0 == hyph) + if ('-' != p->buf[j - 1]) + hyph = vsz; } /* @@ -195,14 +201,43 @@ term_flushln(struct termp *p) * beginning of a line, one between words -- but do not * actually write them yet. */ + vbl = (size_t)(0 == vis ? 0 : 1); /* * Find out whether we would exceed the right margin. - * If so, break to the next line. (TODO: hyphenate) - * Otherwise, write the chosen number of blanks now. + * If so, break to the next line, possibly after + * emittign character up to a hyphen. Otherwise, write + * the chosen number of blanks. */ + if (vis && vis + vbl + vsz > bp) { + /* + * Has a hyphen been found before the breakpoint + * that we can use? + */ + if (hyph && vis + vbl + hyph <= bp) { + /* First prepend blanks. */ + for (j = 0; j < (int)vbl; j++) + putchar(' '); + + /* Emit up to the character. */ + do { + if (31 == p->buf[i]) + putchar(' '); + else + putchar(p->buf[i]); + if (8 != p->buf[i]) + vsz--; + } while ('-' != p->buf[i++]); + + /* Emit trailing decoration. */ + if (8 == p->buf[i]) { + putchar(p->buf[i]); + putchar(p->buf[i + 1]); + } + } + putchar('\n'); if (TERMP_NOBREAK & p->flags) { for (j = 0; j < (int)p->rmargin; j++) @@ -213,7 +248,9 @@ term_flushln(struct termp *p) putchar(' '); vis = 0; } + /* Remove the p->overstep width. */ + bp += (int)/* LINTED */ p->overstep; p->overstep = 0; @@ -223,19 +260,15 @@ term_flushln(struct termp *p) vis += vbl; } - /* - * Finally, write out the word. - */ - for ( ; i < (int)p->col; i++) { + /* Write out the [remaining] word. */ + for ( ; i < (int)p->col; i++) if (' ' == p->buf[i]) break; - - /* The unit sep. is a non-breaking space. */ - if (31 == p->buf[i]) + else if (31 == p->buf[i]) putchar(' '); else putchar(p->buf[i]); - } + vis += vsz; } @@ -440,8 +473,6 @@ term_word(struct termp *p, const char *word) case(')'): /* FALLTHROUGH */ case(']'): - /* FALLTHROUGH */ - case('}'): if ( ! (TERMP_IGNDELIM & p->flags)) p->flags |= TERMP_NOSPACE; break; @@ -497,11 +528,11 @@ term_word(struct termp *p, const char *word) if (sv[0] && 0 == sv[1]) switch (sv[0]) { + case('|'): + /* FALLTHROUGH */ case('('): /* FALLTHROUGH */ case('['): - /* FALLTHROUGH */ - case('{'): p->flags |= TERMP_NOSPACE; break; default: