diff options
| author | joerg <joerg@NetBSD.org> | 2010-02-19 22:54:40 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2010-02-19 22:54:40 +0000 |
| commit | d5e63c8d559baaaa548d19ec2a93a2195686e430 (patch) | |
| tree | cd2093c0158fce45aa0854a57c1a29d53833875b /external/bsd | |
| parent | 754590e0925b7cb06fac3f2282d7aab8ffe0d07c (diff) | |
Import mdocml 1.9.15 modulo a patch for .Xr handling:
- XHTML output support, more human-readable HTML output
- end-of-line white space detected in all lines
- fix subtle bug for list displays in some modes
- fix column handling
- full support for \f etc
- imporoved column handling
- various other bug fixes
- compatiblity support for strlcat/strlcpy
- groff-compatible .Xr [backed out]
Diffstat (limited to 'external/bsd')
45 files changed, 1195 insertions, 325 deletions
diff --git a/external/bsd/mdocml/dist/Makefile b/external/bsd/mdocml/dist/Makefile new file mode 100644 index 00000000000..d53fd91cf0a --- /dev/null +++ b/external/bsd/mdocml/dist/Makefile @@ -0,0 +1,278 @@ +.SUFFIXES: .html .xml .sgml .1 .3 .7 .md5 .tar.gz .1.txt .3.txt .7.txt .1.sgml .3.sgml .7.sgml + +BINDIR = $(PREFIX)/bin +INCLUDEDIR = $(PREFIX)/include +LIBDIR = $(PREFIX)/lib +MANDIR = $(PREFIX)/man +EXAMPLEDIR = $(PREFIX)/share/examples/mandoc +INSTALL_PROGRAM = install -m 0755 +INSTALL_DATA = install -m 0444 +INSTALL_LIB = install -m 0644 +INSTALL_MAN = $(INSTALL_DATA) + +VERSION = 1.9.15 +VDATE = 18 February 2010 + +VFLAGS = -DVERSION="\"$(VERSION)\"" -DHAVE_CONFIG_H +WFLAGS = -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings +CFLAGS += -g $(VFLAGS) $(WFLAGS) +#CFLAGS += -DOSNAME="\"OpenBSD 4.5\"" +LINTFLAGS += $(VFLAGS) + +MANDOCFLAGS = -Wall -fstrict +MANDOCHTML = -Thtml -Ostyle=style.css,man=%N.%S.html,includes=%I.html + +MDOCLNS = mdoc_macro.ln mdoc.ln mdoc_hash.ln mdoc_strings.ln \ + mdoc_argv.ln mdoc_validate.ln mdoc_action.ln \ + lib.ln att.ln arch.ln vol.ln msec.ln st.ln \ + mandoc.ln +MDOCOBJS = mdoc_macro.o mdoc.o mdoc_hash.o mdoc_strings.o \ + mdoc_argv.o mdoc_validate.o mdoc_action.o lib.o att.o \ + arch.o vol.o msec.o st.o mandoc.o +MDOCSRCS = mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \ + mdoc_argv.c mdoc_validate.c mdoc_action.c lib.c att.c \ + arch.c vol.c msec.c st.c mandoc.c + +MANLNS = man_macro.ln man.ln man_hash.ln man_validate.ln \ + man_action.ln mandoc.ln man_argv.ln +MANOBJS = man_macro.o man.o man_hash.o man_validate.o \ + man_action.o mandoc.o man_argv.o +MANSRCS = man_macro.c man.c man_hash.c man_validate.c \ + man_action.c mandoc.c man_argv.c + +MAINLNS = main.ln mdoc_term.ln chars.ln term.ln tree.ln \ + compat.ln man_term.ln html.ln mdoc_html.ln \ + man_html.ln out.ln +MAINOBJS = main.o mdoc_term.o chars.o term.o tree.o compat.o \ + man_term.o html.o mdoc_html.o man_html.o out.o +MAINSRCS = main.c mdoc_term.c chars.c term.c tree.c compat.c \ + man_term.c html.c mdoc_html.c man_html.c out.c + +LLNS = llib-llibmdoc.ln llib-llibman.ln llib-lmandoc.ln +LNS = $(MAINLNS) $(MDOCLNS) $(MANLNS) +LIBS = libmdoc.a libman.a +OBJS = $(MDOCOBJS) $(MAINOBJS) $(MANOBJS) +SRCS = $(MDOCSRCS) $(MAINSRCS) $(MANSRCS) +DATAS = arch.in att.in lib.in msec.in st.in \ + vol.in chars.in +HEADS = mdoc.h libmdoc.h man.h libman.h term.h \ + libmandoc.h html.h chars.h out.h main.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 +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 +TEXTS = mandoc.1.txt mdoc.3.txt man.3.txt mdoc.7.txt man.7.txt \ + mandoc_char.7.txt manuals.7.txt ChangeLog.txt +EXAMPLES = example.style.css +XMLS = ChangeLog.xml +STATICS = index.css style.css external.png +MD5S = mdocml-$(VERSION).md5 +TARGZS = mdocml-$(VERSION).tar.gz +MANS = mandoc.1 mdoc.3 mdoc.7 manuals.7 mandoc_char.7 \ + man.7 man.3 +BINS = mandoc +TESTS = test-strlcat.c test-strlcpy.c +CONFIGS = config.h.pre config.h.post +CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \ + $(TARGZS) tags $(MD5S) $(XMLS) $(TEXTS) $(GSGMLS) \ + $(GHTMLS) config.h config.log +INSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \ + $(DATAS) $(XSLS) $(EXAMPLES) $(TESTS) $(CONFIGS) + +all: $(BINS) + +lint: $(LLNS) + +clean: + rm -f $(CLEAN) + +cleanlint: + rm -f $(LNS) $(LLNS) + +cleanhtml: + rm -f $(HTMLS) $(GSGMLS) $(GHTMLS) + +dist: mdocml-$(VERSION).tar.gz + +www: all $(GSGMLS) $(GHTMLS) $(HTMLS) $(TEXTS) $(MD5S) $(TARGZS) + +htmls: all $(GSGMLS) $(GHTMLS) + +installwww: www + install -m 0444 $(GHTMLS) $(HTMLS) $(TEXTS) $(STATICS) $(PREFIX)/ + install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/ + install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/ + install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz + install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/mdocml.md5 + +install: + mkdir -p $(BINDIR) + mkdir -p $(EXAMPLEDIR) + mkdir -p $(MANDIR)/man1 + mkdir -p $(MANDIR)/man7 + $(INSTALL_PROGRAM) mandoc $(BINDIR) + $(INSTALL_MAN) mandoc.1 $(MANDIR)/man1 + $(INSTALL_MAN) man.7 mdoc.7 $(MANDIR)/man7 + $(INSTALL_DATA) example.style.css $(EXAMPLEDIR) + +uninstall: + rm -f $(BINDIR)/mandoc + rm -f $(MANDIR)/man1/mandoc.1 + rm -f $(MANDIR)/man7/mdoc.7 + rm -f $(MANDIR)/man7/man.7 + rm -f $(EXAMPLEDIR)/example.style.css + +$(OBJS): config.h + +$(LNS): config.h + +man_macro.ln: man_macro.c libman.h +man_macro.o: man_macro.c libman.h + +lib.ln: lib.c lib.in libmdoc.h +lib.o: lib.c lib.in libmdoc.h + +att.ln: att.c att.in libmdoc.h +att.o: att.c att.in libmdoc.h + +arch.ln: arch.c arch.in libmdoc.h +arch.o: arch.c arch.in libmdoc.h + +vol.ln: vol.c vol.in libmdoc.h +vol.o: vol.c vol.in libmdoc.h + +chars.ln: chars.c chars.in chars.h +chars.o: chars.c chars.in chars.h + +msec.ln: msec.c msec.in libmdoc.h +msec.o: msec.c msec.in libmdoc.h + +st.ln: st.c st.in libmdoc.h +st.o: st.c st.in libmdoc.h + +mdoc_macro.ln: mdoc_macro.c libmdoc.h +mdoc_macro.o: mdoc_macro.c libmdoc.h + +mdoc_term.ln: mdoc_term.c term.h mdoc.h +mdoc_term.o: mdoc_term.c term.h mdoc.h + +mdoc_strings.ln: mdoc_strings.c libmdoc.h +mdoc_strings.o: mdoc_strings.c libmdoc.h + +man_hash.ln: man_hash.c libman.h +man_hash.o: man_hash.c libman.h + +mdoc_hash.ln: mdoc_hash.c libmdoc.h +mdoc_hash.o: mdoc_hash.c libmdoc.h + +mdoc.ln: mdoc.c libmdoc.h +mdoc.o: mdoc.c libmdoc.h + +man.ln: man.c libman.h +man.o: man.c libman.h + +main.ln: main.c mdoc.h +main.o: main.c mdoc.h + +compat.ln: compat.c +compat.o: compat.c + +term.ln: term.c term.h man.h mdoc.h chars.h +term.o: term.c term.h man.h mdoc.h chars.h + +html.ln: html.c html.h chars.h +html.o: html.c html.h chars.h + +mdoc_html.ln: mdoc_html.c html.h mdoc.h +mdoc_html.o: mdoc_html.c html.h mdoc.h + +man_html.ln: man_html.c html.h man.h out.h +man_html.o: man_html.c html.h man.h out.h + +out.ln: out.c out.h +out.o: out.c out.h + +tree.ln: tree.c man.h mdoc.h +tree.o: tree.c man.h mdoc.h + +mdoc_argv.ln: mdoc_argv.c libmdoc.h +mdoc_argv.o: mdoc_argv.c libmdoc.h + +man_argv.ln: man_argv.c libman.h +man_argv.o: man_argv.c libman.h + +man_validate.ln: man_validate.c libman.h +man_validate.o: man_validate.c libman.h + +mdoc_validate.ln: mdoc_validate.c libmdoc.h +mdoc_validate.o: mdoc_validate.c libmdoc.h + +mdoc_action.ln: mdoc_action.c libmdoc.h +mdoc_action.o: mdoc_action.c libmdoc.h + +libmdoc.h: mdoc.h + +ChangeLog.xml: + cvs2cl --xml --xml-encoding iso-8859-15 -t --noxmlns -f $@ + +ChangeLog.txt: + cvs2cl -t -f $@ + +ChangeLog.html: ChangeLog.xml ChangeLog.xsl + xsltproc -o $@ ChangeLog.xsl ChangeLog.xml + +mdocml-$(VERSION).tar.gz: $(INSTALL) + mkdir -p .dist/mdocml/mdocml-$(VERSION)/ + cp -f $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/ + ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ ) + rm -rf .dist/ + +llib-llibmdoc.ln: $(MDOCLNS) + $(LINT) -Clibmdoc $(MDOCLNS) + +llib-llibman.ln: $(MANLNS) + $(LINT) -Clibman $(MANLNS) + +llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln + $(LINT) -Cmandoc $(MAINLNS) llib-llibmdoc.ln + +libmdoc.a: $(MDOCOBJS) + $(AR) rs $@ $(MDOCOBJS) + +libman.a: $(MANOBJS) + $(AR) rs $@ $(MANOBJS) + +mandoc: $(MAINOBJS) libmdoc.a libman.a + $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libmdoc.a libman.a + +.sgml.html: + validate --warn $< + sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@ + +.1.1.txt .3.3.txt .7.7.txt: + ./mandoc $(MANDOCFLAGS) $< | col -b > $@ + +.1.1.sgml .3.3.sgml .7.7.sgml: + ./mandoc $(MANDOCFLAGS) $(MANDOCHTML) $< > $@ + +.tar.gz.md5: + md5 $< > $@ + +config.h: config.h.pre config.h.post + rm -f config.log + ( cat config.h.pre; \ + echo; \ + if $(CC) $(CFLAGS) -Werror -c test-strlcat.c >> config.log 2>&1; then \ + echo '#define HAVE_STRLCAT'; \ + rm test-strlcat.o; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -c test-strlcpy.c >> config.log 2>&1; then \ + echo '#define HAVE_STRLCPY'; \ + rm test-strlcpy.o; \ + fi; \ + echo; \ + cat config.h.post \ + ) > $@ diff --git a/external/bsd/mdocml/dist/arch.c b/external/bsd/mdocml/dist/arch.c index 2d98fc5b6bf..37eb607e762 100644 --- a/external/bsd/mdocml/dist/arch.c +++ b/external/bsd/mdocml/dist/arch.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: arch.c,v 1.5 2009/10/26 17:05:43 kristaps Exp $ */ +/* $Vendor-Id: arch.c,v 1.6 2010/01/01 17:14:26 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdlib.h> #include <string.h> #include <time.h> diff --git a/external/bsd/mdocml/dist/att.c b/external/bsd/mdocml/dist/att.c index 72b3d3591a3..0456b44fe9b 100644 --- a/external/bsd/mdocml/dist/att.c +++ b/external/bsd/mdocml/dist/att.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: att.c,v 1.5 2009/10/26 17:05:44 kristaps Exp $ */ +/* $Vendor-Id: att.c,v 1.6 2010/01/01 17:14:26 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdlib.h> #include <string.h> #include <time.h> diff --git a/external/bsd/mdocml/dist/chars.c b/external/bsd/mdocml/dist/chars.c index 1e931a92325..5df6ba70ee4 100644 --- a/external/bsd/mdocml/dist/chars.c +++ b/external/bsd/mdocml/dist/chars.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: chars.c,v 1.13 2009/11/05 07:21:01 kristaps Exp $ */ +/* $Vendor-Id: chars.c,v 1.16 2010/01/28 06:04:59 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <assert.h> #include <stdio.h> #include <stdlib.h> @@ -38,7 +42,7 @@ struct ln { #define CHARS_BOTH (CHARS_CHAR | CHARS_STRING) }; -#define LINES_MAX 351 +#define LINES_MAX 350 #define CHAR(w, x, y, z, a, b) \ { NULL, (w), (y), (a), (x), (z), (b), CHARS_CHAR }, @@ -162,18 +166,6 @@ find(struct tbl *tab, const char *p, size_t sz, size_t *rsz, int type) if (NULL == (pp = htab[hash])) return(NULL); - if (NULL == pp->next) { - if ( ! match(pp, p, sz, type)) - return(NULL); - - if (CHARS_HTML == tab->type) { - *rsz = pp->htmlsz; - return(pp->html); - } - *rsz = pp->asciisz; - return(pp->ascii); - } - for (prev = NULL; pp; pp = pp->next) { if ( ! match(pp, p, sz, type)) { prev = pp; diff --git a/external/bsd/mdocml/dist/chars.in b/external/bsd/mdocml/dist/chars.in index 178843af5bb..b31810a6dbc 100644 --- a/external/bsd/mdocml/dist/chars.in +++ b/external/bsd/mdocml/dist/chars.in @@ -1,4 +1,4 @@ -/* $Vendor-Id: chars.in,v 1.19 2009/11/05 07:21:02 kristaps Exp $ */ +/* $Vendor-Id: chars.in,v 1.20 2010/01/05 19:51:10 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -412,7 +412,6 @@ CHAR("r?", 2, "c", 1, "¿", 6) CHAR("em", 2, "--", 2, "—", 7) CHAR("en", 2, "-", 1, "–", 7) CHAR("hy", 2, "-", 1, "‐", 7) -CHAR("\\", 1, "\\", 1, "\\", 1) CHAR("e", 1, "\\", 1, "\\", 1) /* Units. */ diff --git a/external/bsd/mdocml/dist/compat.c b/external/bsd/mdocml/dist/compat.c index 8665ffa8c85..f00cc5c6b4f 100644 --- a/external/bsd/mdocml/dist/compat.c +++ b/external/bsd/mdocml/dist/compat.c @@ -15,12 +15,16 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include <sys/types.h> #include <string.h> -#ifdef __linux__ +int dummy; /* To prevent an empty object file */ +#ifndef HAVE_STRLCAT /* * Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters @@ -55,7 +59,9 @@ strlcat(char *dst, const char *src, size_t siz) return(dlen + (s - src)); /* count does not include NUL */ } +#endif +#ifndef HAVE_STRLCPY /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). @@ -86,5 +92,4 @@ strlcpy(char *dst, const char *src, size_t siz) return(s - src - 1); /* count does not include NUL */ } - #endif diff --git a/external/bsd/mdocml/dist/config.h.post b/external/bsd/mdocml/dist/config.h.post new file mode 100644 index 00000000000..81c01b93161 --- /dev/null +++ b/external/bsd/mdocml/dist/config.h.post @@ -0,0 +1,25 @@ +#include <sys/types.h> + +#if !defined(__BEGIN_DECLS) +# ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# else +# define __BEGIN_DECLS +# endif +#endif +#if !defined(__END_DECLS) +# ifdef __cplusplus +# define __END_DECLS } +# else +# define __END_DECLS +# endif +#endif + +#ifndef HAVE_STRLCAT +extern size_t strlcat(char *, const char *, size_t); +#endif +#ifndef HAVE_STRLCPY +extern size_t strlcpy(char *, const char *, size_t); +#endif + +#endif /* MANDOC_CONFIG_H */ diff --git a/external/bsd/mdocml/dist/config.h.pre b/external/bsd/mdocml/dist/config.h.pre new file mode 100644 index 00000000000..a309ed95690 --- /dev/null +++ b/external/bsd/mdocml/dist/config.h.pre @@ -0,0 +1,6 @@ +#ifndef MANDOC_CONFIG_H +#define MANDOC_CONFIG_H + +#if defined(__linux__) || defined(__MINT__) +# define _GNU_SOURCE /* strptime(), getsubopt() */ +#endif diff --git a/external/bsd/mdocml/dist/html.c b/external/bsd/mdocml/dist/html.c index 0349fb8cf42..e4c05341c9e 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.91 2009/11/16 08:46:58 kristaps Exp $ */ +/* $Vendor-Id: html.c,v 1.96 2010/02/17 19:48:33 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> @@ -32,38 +36,34 @@ #define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) -#define DOCTYPE "-//W3C//DTD HTML 4.01//EN" -#define DTD "http://www.w3.org/TR/html4/strict.dtd" - struct htmldata { const char *name; int flags; #define HTML_CLRLINE (1 << 0) #define HTML_NOSTACK (1 << 1) +#define HTML_AUTOCLOSE (1 << 2) /* Tag has auto-closure. */ }; static const struct htmldata htmltags[TAG_MAX] = { {"html", HTML_CLRLINE}, /* TAG_HTML */ {"head", HTML_CLRLINE}, /* TAG_HEAD */ {"body", HTML_CLRLINE}, /* TAG_BODY */ - {"meta", HTML_CLRLINE | HTML_NOSTACK}, /* TAG_META */ + {"meta", HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_META */ {"title", HTML_CLRLINE}, /* TAG_TITLE */ {"div", HTML_CLRLINE}, /* TAG_DIV */ {"h1", 0}, /* TAG_H1 */ {"h2", 0}, /* TAG_H2 */ - {"p", HTML_CLRLINE}, /* TAG_P */ {"span", 0}, /* TAG_SPAN */ {"link", HTML_CLRLINE | HTML_NOSTACK}, /* TAG_LINK */ - {"br", HTML_CLRLINE | HTML_NOSTACK}, /* TAG_LINK */ + {"br", HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_BR */ {"a", 0}, /* TAG_A */ {"table", HTML_CLRLINE}, /* TAG_TABLE */ - {"col", HTML_CLRLINE | HTML_NOSTACK}, /* TAG_COL */ + {"col", HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_COL */ {"tr", HTML_CLRLINE}, /* TAG_TR */ {"td", HTML_CLRLINE}, /* TAG_TD */ {"li", HTML_CLRLINE}, /* TAG_LI */ {"ul", HTML_CLRLINE}, /* TAG_UL */ {"ol", HTML_CLRLINE}, /* TAG_OL */ - {"base", HTML_CLRLINE | HTML_NOSTACK}, /* TAG_BASE */ }; static const char *const htmlfonts[HTMLFONT_MAX] = { @@ -89,20 +89,20 @@ static const char *const htmlattrs[ATTR_MAX] = { "summary", }; -#ifdef __linux__ -extern int getsubopt(char **, char * const *, char **); -#endif - - static void print_spec(struct html *, const char *, size_t); static void print_res(struct html *, const char *, size_t); static void print_ctag(struct html *, enum htmltag); +static void print_doctype(struct html *); +static void print_xmltype(struct html *); static int print_encode(struct html *, const char *, int); static void print_metaf(struct html *, enum roffdeco); +static void print_attr(struct html *, + const char *, const char *); +static void *ml_alloc(char *, enum htmltype); -void * -html_alloc(char *outopts) +static void * +ml_alloc(char *outopts, enum htmltype type) { struct html *h; const char *toks[4]; @@ -119,6 +119,7 @@ html_alloc(char *outopts) exit(EXIT_FAILURE); } + h->type = type; h->tags.head = NULL; h->ords.head = NULL; h->symtab = chars_init(CHARS_HTML); @@ -141,6 +142,21 @@ html_alloc(char *outopts) return(h); } +void * +html_alloc(char *outopts) +{ + + return(ml_alloc(outopts, HTML_HTML_4_01_STRICT)); +} + + +void * +xhtml_alloc(char *outopts) +{ + + return(ml_alloc(outopts, HTML_XHTML_1_0_STRICT)); +} + void html_free(void *p) @@ -337,6 +353,15 @@ print_encode(struct html *h, const char *p, int norecurse) } +static void +print_attr(struct html *h, const char *key, const char *val) +{ + printf(" %s=\"", key); + (void)print_encode(h, val, 1); + putchar('\"'); +} + + struct tag * print_otag(struct html *h, enum htmltag tag, int sz, const struct htmlpair *p) @@ -344,6 +369,8 @@ print_otag(struct html *h, enum htmltag tag, int i; struct tag *t; + /* Push this tags onto the stack of open scopes. */ + if ( ! (HTML_NOSTACK & htmltags[tag].flags)) { t = malloc(sizeof(struct tag)); if (NULL == t) { @@ -360,13 +387,31 @@ print_otag(struct html *h, enum htmltag tag, if ( ! (HTML_CLRLINE & htmltags[tag].flags)) putchar(' '); + /* Print out the tag name and attributes. */ + printf("<%s", htmltags[tag].name); - for (i = 0; i < sz; i++) { - printf(" %s=\"", htmlattrs[p[i].key]); - assert(p->val); - (void)print_encode(h, p[i].val, 1); - putchar('\"'); + for (i = 0; i < sz; i++) + print_attr(h, htmlattrs[p[i].key], p[i].val); + + /* Add non-overridable attributes. */ + + if (TAG_HTML == tag && HTML_XHTML_1_0_STRICT == h->type) { + print_attr(h, "xmlns", "http://www.w3.org/1999/xhtml"); + print_attr(h, "xml:lang", "en"); + print_attr(h, "lang", "en"); } + + /* Accomodate for XML "well-formed" singleton escaping. */ + + if (HTML_AUTOCLOSE & htmltags[tag].flags) + switch (h->type) { + case (HTML_XHTML_1_0_STRICT): + putchar('/'); + break; + default: + break; + } + putchar('>'); h->flags |= HTML_NOSPACE; @@ -386,12 +431,58 @@ print_ctag(struct html *h, enum htmltag tag) } -/* ARGSUSED */ void -print_gen_doctype(struct html *h) +print_gen_decls(struct html *h) { - - printf("<!DOCTYPE HTML PUBLIC \"%s\" \"%s\">", DOCTYPE, DTD); + + print_xmltype(h); + print_doctype(h); +} + + +static void +print_xmltype(struct html *h) +{ + const char *decl; + + switch (h->type) { + case (HTML_XHTML_1_0_STRICT): + decl = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; + break; + default: + decl = NULL; + break; + } + + if (NULL == decl) + return; + + printf("%s\n", decl); +} + + +static void +print_doctype(struct html *h) +{ + const char *doctype; + const char *dtd; + const char *name; + + switch (h->type) { + case (HTML_HTML_4_01_STRICT): + name = "HTML"; + doctype = "-//W3C//DTD HTML 4.01//EN"; + dtd = "http://www.w3.org/TR/html4/strict.dtd"; + break; + default: + name = "html"; + doctype = "-//W3C//DTD XHTML 1.0 Strict//EN"; + dtd = "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"; + break; + } + + printf("<!DOCTYPE %s PUBLIC \"%s\" \"%s\">\n", + name, doctype, dtd); } diff --git a/external/bsd/mdocml/dist/html.h b/external/bsd/mdocml/dist/html.h index a767cf50244..89aeddcf424 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.21 2009/11/16 06:07:49 kristaps Exp $ */ +/* $Vendor-Id: html.h,v 1.22 2010/01/29 14:39:38 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -28,7 +28,6 @@ enum htmltag { TAG_DIV, TAG_H1, TAG_H2, - TAG_P, TAG_SPAN, TAG_LINK, TAG_BR, @@ -40,7 +39,6 @@ enum htmltag { TAG_LI, TAG_UL, TAG_OL, - TAG_BASE, TAG_MAX }; @@ -105,6 +103,11 @@ struct htmlpair { do { (p)->key = ATTR_SUMMARY; \ (p)->val = (v); } while (/* CONSTCOND */ 0) +enum htmltype { + HTML_HTML_4_01_STRICT, + HTML_XHTML_1_0_STRICT +}; + struct html { int flags; #define HTML_NOSPACE (1 << 0) @@ -121,11 +124,12 @@ struct html { struct tag *metaf; enum htmlfont metal; enum htmlfont metac; + enum htmltype type; }; struct roffsu; -void print_gen_doctype(struct html *); +void print_gen_decls(struct html *); void print_gen_head(struct html *); struct tag *print_ofont(struct html *, enum htmlfont); struct tag *print_otag(struct html *, enum htmltag, diff --git a/external/bsd/mdocml/dist/lib.c b/external/bsd/mdocml/dist/lib.c index b8ec7999696..417fc6c6907 100644 --- a/external/bsd/mdocml/dist/lib.c +++ b/external/bsd/mdocml/dist/lib.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: lib.c,v 1.5 2009/10/26 17:05:44 kristaps Exp $ */ +/* $Vendor-Id: lib.c,v 1.6 2010/01/01 17:14:27 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdlib.h> #include <string.h> #include <time.h> diff --git a/external/bsd/mdocml/dist/main.c b/external/bsd/mdocml/dist/main.c index dbe7f3f26d6..76357ec4dc2 100644 --- a/external/bsd/mdocml/dist/main.c +++ b/external/bsd/mdocml/dist/main.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: main.c,v 1.57 2009/11/02 08:29:25 kristaps Exp $ */ +/* $Vendor-Id: main.c,v 1.59 2010/01/29 14:39:38 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/stat.h> #include <assert.h> @@ -38,11 +42,6 @@ # endif #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */ -#ifdef __linux__ -extern int getsubopt(char **, char * const *, char **); -extern size_t strlcat(char *, const char *, size_t); -#endif - typedef void (*out_mdoc)(void *, const struct mdoc *); typedef void (*out_man)(void *, const struct man *); typedef void (*out_free)(void *); @@ -62,6 +61,7 @@ enum outt { OUTT_ASCII = 0, OUTT_TREE, OUTT_HTML, + OUTT_XHTML, OUTT_LINT }; @@ -429,6 +429,12 @@ fdesc(struct buf *blk, struct buf *ln, struct curparse *curp) if ( ! (curp->outman && curp->outmdoc)) { switch (curp->outtype) { + case (OUTT_XHTML): + curp->outdata = xhtml_alloc(curp->outopts); + curp->outman = html_man; + curp->outmdoc = html_mdoc; + curp->outfree = html_free; + break; case (OUTT_HTML): curp->outdata = html_alloc(curp->outopts); curp->outman = html_man; @@ -551,6 +557,8 @@ toptions(enum outt *tflags, char *arg) *tflags = OUTT_TREE; else if (0 == strcmp(arg, "html")) *tflags = OUTT_HTML; + else if (0 == strcmp(arg, "xhtml")) + *tflags = OUTT_XHTML; else { fprintf(stderr, "%s: Bad argument\n", arg); return(0); diff --git a/external/bsd/mdocml/dist/main.h b/external/bsd/mdocml/dist/main.h index c2ce9b61a17..a6782d2535c 100644 --- a/external/bsd/mdocml/dist/main.h +++ b/external/bsd/mdocml/dist/main.h @@ -1,4 +1,4 @@ -/* $Vendor-Id: main.h,v 1.1 2009/10/13 10:57:25 kristaps Exp $ */ +/* $Vendor-Id: main.h,v 1.2 2010/01/29 14:39:38 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -30,6 +30,7 @@ struct man; */ void *html_alloc(char *); +void *xhtml_alloc(char *); void html_mdoc(void *, const struct mdoc *); void html_man(void *, const struct man *); void html_free(void *); diff --git a/external/bsd/mdocml/dist/man.3 b/external/bsd/mdocml/dist/man.3 index f15dbde2f50..e82d7e69e62 100644 --- a/external/bsd/mdocml/dist/man.3 +++ b/external/bsd/mdocml/dist/man.3 @@ -1,6 +1,6 @@ -.\" $Vendor-Id: man.3,v 1.10 2009/10/03 16:36:06 kristaps Exp $ +.\" $Vendor-Id: man.3,v 1.12 2010/02/17 19:22:01 kristaps Exp $ .\" -.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> +.\" Copyright (c) 2009-2010 Kristaps Dzonsons <kristaps@bsd.lv> .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -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$ +.Dd $Mdocdate: February 17 2010 $ .Dt MAN 3 .Os .\" SECTION @@ -91,7 +91,7 @@ Both functions (see and variables (see .Sx Variables ) may use the following types: -.Bl -ohang -offset "XXXX" +.Bl -ohang .\" LIST-ITEM .It Vt struct man An opaque type defined in @@ -112,7 +112,7 @@ for details. .\" SUBSECTION .Ss Functions Function descriptions follow: -.Bl -ohang -offset "XXXX" +.Bl -ohang .\" LIST-ITEM .It Fn man_alloc Allocates a parsing structure. The @@ -166,7 +166,7 @@ return 0, the data will be incomplete. .\" SUBSECTION .Ss Variables The following variables are also defined: -.Bl -ohang -offset "XXXX" +.Bl -ohang .\" LIST-ITEM .It Va man_macronames An array of string-ified token names. @@ -215,7 +215,7 @@ fields) and some type-specific data. The tree itself is arranged according to the following normal form, where capitalised non-terminals represent nodes. .Pp -.Bl -tag -width "ELEMENTXX" -compact -offset "XXXX" +.Bl -tag -width "ELEMENTXX" -compact .\" LIST-ITEM .It ROOT \(<- mnode+ @@ -242,11 +242,8 @@ next-lint scope as documented in The following example reads lines from stdin and parses them, operating on the finished parse tree with .Fn parsed . -Note that, if the last line of the file isn't newline-terminated, this -will truncate the file's last character (see -.Xr fgetln 3 ) . -Further, this example does not error-check nor free memory upon failure. -.Bd -literal -offset "XXXX" +This example does not error-check nor free memory upon failure. +.Bd -literal -offset indent struct man *man; struct man_node *node; char *buf; @@ -255,18 +252,23 @@ int line; line = 1; man = man_alloc(NULL, 0, NULL); +buf = NULL; +alloc_len = 0; -while ((buf = fgetln(fp, &len))) { - buf[len - 1] = '\\0'; - if ( ! man_parseln(man, line, buf)) - errx(1, "man_parseln"); - line++; +while ((len = getline(&buf, &alloc_len, stdin)) >= 0) { + if (len && buflen[len - 1] = '\en') + buf[len - 1] = '\e0'; + if ( ! man_parseln(man, line, buf)) + errx(1, "man_parseln"); + line++; } +free(buf); + if ( ! man_endparse(man)) - errx(1, "man_endparse"); + errx(1, "man_endparse"); if (NULL == (node = man_node(man))) - errx(1, "man_node"); + errx(1, "man_node"); parsed(man, node); man_free(man); @@ -280,4 +282,4 @@ man_free(man); The .Nm utility was written by -.An Kristaps Dzonsons Aq kristaps@kth.se . +.An Kristaps Dzonsons Aq kristaps@bsd.lv . diff --git a/external/bsd/mdocml/dist/man.7 b/external/bsd/mdocml/dist/man.7 index e21543e0167..942a3f0983a 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.54 2009/11/16 08:46:59 kristaps Exp $ +.\" $Vendor-Id: man.7,v 1.55 2010/01/07 19:10:09 kristaps Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> .\" @@ -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$ +.Dd $Mdocdate: January 7 2010 $ .Dt MAN 7 .Os . @@ -102,7 +102,7 @@ and Terms may be text-decorated using the .Sq \ef escape followed by an indicator: B (bold), I, (italic), R (Roman), or P -(revert to previous mode): +(revert to previous mode): .Pp .D1 \efBbold\efR \efIitalic\efP .Pp @@ -295,7 +295,7 @@ the C library, this may be as follows: .D1 Standard C Library (libc, -lc) .It Em SYNOPSIS Documents the utility invocation syntax, function call syntax, or device -configuration. +configuration. .Pp For the first, utilities (sections 1, 6, and 8), this is generally structured as follows: @@ -310,10 +310,10 @@ And for the third, configurations (section 4): .Pp .D1 \&.B name* at cardbus ? function ? .Pp -Manuals not in these sections generally don't need a +Manuals not in these sections generally don't need a .Em SYNOPSIS . .It Em DESCRIPTION -This expands upon the brief, one-line description in +This expands upon the brief, one-line description in .Em NAME . It usually contains a break-down of the options (if documenting a command). @@ -361,7 +361,7 @@ Documents error handling in sections 2, 3, and 9. . .It Em SEE ALSO References other manuals with related topics. This section should exist -for most manuals. +for most manuals. .Pp .D1 \&.BR bar \&( 1 \&), .Pp @@ -504,7 +504,7 @@ sub-section, closed by a section or .Sx \&SS ; part, closed by a section, sub-section, or .Sx \&RE ; -or paragraph, closed by a section, sub-section, part, +or paragraph, closed by a section, sub-section, part, .Sx \&HP , .Sx \&IP , .Sx \&LP , @@ -563,13 +563,13 @@ and . . .Ss \&BI -Text is rendered alternately in bold face and italic. Thus, +Text is rendered alternately in bold face and italic. Thus, .Sq .BI this word and that causes .Sq this and .Sq and -to render in bold face, while +to render in bold face, while .Sq word and .Sq that @@ -819,7 +819,7 @@ The .Cm width argument must conform to .Sx Scaling Widths . -If not specified, the saved or default width is used. +If not specified, the saved or default width is used. . . .Ss \&SB @@ -960,7 +960,7 @@ Insert vertical spaces into output with the following syntax: .Op Cm height .Ed .Pp -Insert +Insert .Cm height spaces, which must conform to .Sx Scaling Widths . diff --git a/external/bsd/mdocml/dist/man.c b/external/bsd/mdocml/dist/man.c index d4e3586bcec..5ecc1c7d84d 100644 --- a/external/bsd/mdocml/dist/man.c +++ b/external/bsd/mdocml/dist/man.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: man.c,v 1.46 2009/11/02 08:40:31 kristaps Exp $ */ +/* $Vendor-Id: man.c,v 1.49 2010/01/07 10:24:43 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> @@ -72,10 +76,6 @@ static int pstring(struct man *, int, int, const char *, size_t); static int macrowarn(struct man *, int, const char *); -#ifdef __linux__ -extern size_t strlcpy(char *, const char *, size_t); -#endif - const struct man_node * man_node(const struct man *m) @@ -365,6 +365,7 @@ static int man_ptext(struct man *m, int line, char *buf) { int i, j; + char sv; /* Literal free-form text whitespace is preserved. */ @@ -378,7 +379,12 @@ man_ptext(struct man *m, int line, char *buf) for (i = 0; ' ' == buf[i]; i++) /* Skip leading whitespace. */ ; - if (0 == buf[i]) { + + if ('\0' == buf[i]) { + /* Trailing whitespace? */ + if (i && ' ' == buf[i - 1]) + if ( ! man_pwarn(m, line, i - 1, WTSPACE)) + return(0); if ( ! pstring(m, line, 0, &buf[i], 0)) return(0); goto descope; @@ -392,15 +398,30 @@ man_ptext(struct man *m, int line, char *buf) if (i && ' ' == buf[i] && '\\' == buf[i - 1]) continue; - buf[i++] = 0; + sv = buf[i]; + buf[i++] = '\0'; + if ( ! pstring(m, line, j, &buf[j], (size_t)(i - j))) return(0); + /* Trailing whitespace? Check at overwritten byte. */ + + if (' ' == sv && '\0' == buf[i]) + if ( ! man_pwarn(m, line, i - 1, WTSPACE)) + return(0); + for ( ; ' ' == buf[i]; i++) /* Skip trailing whitespace. */ ; j = i; - if (0 == buf[i]) + + /* Trailing whitespace? */ + + if (' ' == buf[i - 1] && '\0' == buf[i]) + if ( ! man_pwarn(m, line, i - 1, WTSPACE)) + return(0); + + if ('\0' == buf[i]) break; } @@ -463,7 +484,7 @@ man_pmacro(struct man *m, int ln, char *buf) i++; while (buf[i] && ' ' == buf[i]) i++; - if (0 == buf[i]) + if ('\0' == buf[i]) goto out; } @@ -472,7 +493,7 @@ man_pmacro(struct man *m, int ln, char *buf) /* Copy the first word into a nil-terminated buffer. */ for (j = 0; j < 4; j++, i++) { - if (0 == (mac[j] = buf[i])) + if ('\0' == (mac[j] = buf[i])) break; else if (' ' == buf[i]) break; @@ -507,6 +528,12 @@ man_pmacro(struct man *m, int ln, char *buf) while (buf[i] && ' ' == buf[i]) i++; + /* Trailing whitespace? */ + + if ('\0' == buf[i] && ' ' == buf[i - 1]) + if ( ! man_pwarn(m, ln, i - 1, WTSPACE)) + goto err; + /* Remove prior ELINE macro, if applicable. */ if (m->flags & MAN_ELINE) { diff --git a/external/bsd/mdocml/dist/man_action.c b/external/bsd/mdocml/dist/man_action.c index 800fe4944e7..c5a9aed1960 100644 --- a/external/bsd/mdocml/dist/man_action.c +++ b/external/bsd/mdocml/dist/man_action.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: man_action.c,v 1.24 2009/11/02 06:22:45 kristaps Exp $ */ +/* $Vendor-Id: man_action.c,v 1.25 2010/01/01 17:14:27 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/utsname.h> #include <assert.h> diff --git a/external/bsd/mdocml/dist/man_argv.c b/external/bsd/mdocml/dist/man_argv.c index fa1f5e5c884..4f6d3ae4035 100644 --- a/external/bsd/mdocml/dist/man_argv.c +++ b/external/bsd/mdocml/dist/man_argv.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: man_argv.c,v 1.1 2009/08/13 11:45:29 kristaps Exp $ */ +/* $Vendor-Id: man_argv.c,v 1.2 2010/01/01 17:14:28 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> diff --git a/external/bsd/mdocml/dist/man_hash.c b/external/bsd/mdocml/dist/man_hash.c index 3c0951b58a7..05e731cc490 100644 --- a/external/bsd/mdocml/dist/man_hash.c +++ b/external/bsd/mdocml/dist/man_hash.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: man_hash.c,v 1.15 2009/09/23 11:53:45 kristaps Exp $ */ +/* $Vendor-Id: man_hash.c,v 1.16 2010/01/01 17:14:28 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> diff --git a/external/bsd/mdocml/dist/man_html.c b/external/bsd/mdocml/dist/man_html.c index 16d2741aae4..458b3c834a2 100644 --- a/external/bsd/mdocml/dist/man_html.c +++ b/external/bsd/mdocml/dist/man_html.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: man_html.c,v 1.24 2009/11/16 08:46:59 kristaps Exp $ */ +/* $Vendor-Id: man_html.c,v 1.26 2010/01/29 14:39:38 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> @@ -66,11 +70,6 @@ static int man_SH_pre(MAN_ARGS); static int man_SM_pre(MAN_ARGS); static int man_SS_pre(MAN_ARGS); -#ifdef __linux__ -extern size_t strlcpy(char *, const char *, size_t); -extern size_t strlcat(char *, const char *, size_t); -#endif - static const struct htmlman mans[MAN_MAX] = { { man_br_pre, NULL }, /* br */ { NULL, NULL }, /* TH */ @@ -115,7 +114,7 @@ html_man(void *arg, const struct man *m) h = (struct html *)arg; - print_gen_doctype(h); + print_gen_decls(h); t = print_otag(h, TAG_HTML, 0, NULL); print_man(man_meta(m), man_node(m), h); diff --git a/external/bsd/mdocml/dist/man_macro.c b/external/bsd/mdocml/dist/man_macro.c index eb67facfe0a..eedbd0ace14 100644 --- a/external/bsd/mdocml/dist/man_macro.c +++ b/external/bsd/mdocml/dist/man_macro.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: man_macro.c,v 1.29 2009/10/24 05:45:05 kristaps Exp $ */ +/* $Vendor-Id: man_macro.c,v 1.30 2010/01/01 17:14:28 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <assert.h> #include <ctype.h> #include <stdlib.h> diff --git a/external/bsd/mdocml/dist/man_term.c b/external/bsd/mdocml/dist/man_term.c index 9fa0f51da30..05e08f0d46f 100644 --- a/external/bsd/mdocml/dist/man_term.c +++ b/external/bsd/mdocml/dist/man_term.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: man_term.c,v 1.54 2009/11/12 08:21:05 kristaps Exp $ */ +/* $Vendor-Id: man_term.c,v 1.55 2010/01/01 17:14:28 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> @@ -63,11 +67,6 @@ struct termact { void (*post)(DECL_ARGS); }; -#ifdef __linux__ -extern size_t strlcpy(char *, const char *, size_t); -extern size_t strlcat(char *, const char *, size_t); -#endif - static int a2width(const struct man_node *); static int a2height(const struct man_node *); diff --git a/external/bsd/mdocml/dist/man_validate.c b/external/bsd/mdocml/dist/man_validate.c index b3da7ebab88..f28ba6a7b39 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.27 2009/11/02 06:22:45 kristaps Exp $ */ +/* $Vendor-Id: man_validate.c,v 1.28 2010/01/01 17:14:28 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> diff --git a/external/bsd/mdocml/dist/mandoc.1 b/external/bsd/mdocml/dist/mandoc.1 index 7cb90793e27..1da6ba7d65d 100644 --- a/external/bsd/mdocml/dist/mandoc.1 +++ b/external/bsd/mdocml/dist/mandoc.1 @@ -1,4 +1,4 @@ -.\" $Vendor-Id: mandoc.1,v 1.48 2009/11/16 09:52:47 kristaps Exp $ +.\" $Vendor-Id: mandoc.1,v 1.50 2010/01/29 14:39:38 kristaps Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> .\" @@ -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$ +.Dd $Mdocdate: January 29 2010 $ .Dt MANDOC 1 .Os . @@ -167,6 +167,10 @@ styles. This is the default. See Produce strict HTML-4.01 output, with a sane default style. See .Sx HTML Output . . +.It Fl T Ns Ar xhtml +Produce strict XHTML-1.0 output, with a sane default style. See +.Sx XHTML Output . +. .It Fl T Ns Ar tree Produce an indented parse tree. . @@ -231,7 +235,7 @@ relative URI. .It Fl O Ns Ar includes=fmt The string .Ar fmt , -for example, +for example, .Ar ../src/%I.html , is used as a template for linked header files (usually via the .Sq \&In @@ -242,7 +246,7 @@ hyperlink. .It Fl O Ns Ar man=fmt The string .Ar fmt , -for example, +for example, .Ar ../html%S/%N.%S.html , is used as a template for linked manuals (usually via the .Sq \&Xr @@ -260,7 +264,7 @@ present a hyperlink. This section documents output details of .Nm . In general, output conforms to the traditional manual style of a header, -a body composed of sections and sub-sections, and a footer. +a body composed of sections and sub-sections, and a footer. .Pp The text style of output characters (non-macro characters, punctuation, and white-space) is dictated by context. @@ -307,7 +311,7 @@ however, these rules are also applied to macro arguments when appropriate. . . .Ss ASCII Output -Output produced by +Output produced by .Fl T Ns Ar ascii , which is the default, is rendered in standard 7-bit ASCII documented in .Xr ascii 7 . @@ -333,7 +337,7 @@ exceed this limit. .Ss HTML Output Output produced by .Fl T Ns Ar html -comforms to HTML-4.01 strict. +conforms to HTML-4.01 strict. .Pp Font styles and page structure are applied using CSS2. By default, no font style is applied to any text, although CSS2 is hard-coded to format @@ -348,6 +352,17 @@ cause rendered documents to appear as they do in Special characters are rendered in decimal-encoded UTF-8. . . +.Ss XHTML Output +Output produced by +.Fl T Ns Ar xhtml +conforms to XHTML-1.0 strict. +.Pp +See +.Sx HTML Output +for details; beyond generating XHTML tags instead of HTML tags, these +output modes are identical. +. +. .Sh EXAMPLES To page manuals to the terminal: . @@ -379,15 +394,15 @@ Each input and output format is separately noted. .Ss ASCII Compatibility .Bl -bullet -compact .It -The +The .Sq \e~ -special character doesn't produce expected behaviour in +special character doesn't produce expected behaviour in .Fl T Ns Ar ascii . . .It -The +The .Sq \&Bd \-literal -and +and .Sq \&Bd \-unfilled macros of .Xr mdoc 7 @@ -396,7 +411,7 @@ in are synonyms, as are \-filled and \-ragged. . .It -In +In .Xr groff 1 , the .Sq \&Pa @@ -437,7 +452,7 @@ Sentences are unilaterally monospaced. .El . . -.Ss HTML Compatibility +.Ss HTML/XHTML Compatibility .Bl -bullet -compact .It The @@ -446,7 +461,7 @@ escape will revert the font to the previous .Sq \ef escape, not to the last rendered decoration, which is now dictated by CSS instead of hard-coded. It also will not span past the current -scope, for the same reason. Note that in +scope, for the same reason. Note that in .Sx ASCII Output mode, this will work fine. .It @@ -483,13 +498,17 @@ utility was written by .Sh CAVEATS The .Fl T Ns Ar html +and +.Fl T Ns Ar xhtml CSS2 styling used for .Fl m Ns Ar doc input lists does not render properly in brain-dead browsers, such as Internet Explorer 6 and earlier. .Pp In -.Fl T Ns Ar html , +.Fl T Ns Ar html +and +.Fl T Ns Ar xhtml , the maximum size of an element attribute is determined by .Dv BUFSIZ , which is usually 1024 bytes. Be aware of this when setting long link @@ -498,7 +517,9 @@ formats, e.g., .Pp The .Fl T Ns Ar html -output mode doesn't render the +and +.Fl T Ns Ar xhtml +output modes don't render the .Sq \es font size escape documented in .Xr mdoc 7 diff --git a/external/bsd/mdocml/dist/mandoc.c b/external/bsd/mdocml/dist/mandoc.c index ce5baa0a9f9..e06e002d2b3 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.8 2009/11/05 10:16:01 kristaps Exp $ */ +/* $Vendor-Id: mandoc.c,v 1.10 2010/01/05 19:51:10 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,8 +14,8 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#if defined(__linux__) || defined(__MINT__) -# define _GNU_SOURCE /* strptime() */ +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <sys/types.h> @@ -43,8 +43,6 @@ mandoc_special(const char *p) return(0); switch (*p) { - case ('\\'): - /* FALLTHROUGH */ case ('\''): /* FALLTHROUGH */ case ('`'): diff --git a/external/bsd/mdocml/dist/mandoc_char.7 b/external/bsd/mdocml/dist/mandoc_char.7 index 6001c8bb3a3..be5dff03733 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.29 2009/11/16 09:52:47 kristaps Exp $ +.\" $Vendor-Id: mandoc_char.7,v 1.31 2010/01/07 09:16:19 kristaps Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> .\" @@ -13,8 +13,8 @@ .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.Dd $Mdocdate$ +.\" +.Dd $Mdocdate: January 7 2010 $ .Dt MANDOC_CHAR 7 .Os . @@ -25,7 +25,7 @@ . . .Sh DESCRIPTION -This documents the special characters and predefined strings accepted by +This page documents the special characters and predefined strings accepted by .Xr mandoc 1 to format .Xr mdoc 7 @@ -38,7 +38,7 @@ Both .Xr mdoc 7 and .Xr man 7 -encode special characters with +encode special characters with .Sq \eX .Pq for a one-character escape , .Sq \e(XX @@ -54,7 +54,7 @@ and .Sq \eX as .Sq \e[X] . -Predefined strings are functionally similar to special characters, using +Predefined strings are functionally similar to special characters, using .Sq \e*X .Pq for a one-character escape , .Sq \e*(XX @@ -73,7 +73,8 @@ as . .Pp Note that each output mode will have a different rendering of the -characters. It's guaranteed that each input symbol will correspond to a +characters. +It's guaranteed that each input symbol will correspond to a (more or less) meaningful output rendering, regardless the mode. . . @@ -82,7 +83,7 @@ These are the preferred input symbols for producing special characters. . .Pp Spacing: -.Bl -column -compact -offset indent 10m 20m +.Bl -column -compact -offset indent "Input" "Description" .It Em Input Ta Em Description .It \e~ Ta non-breaking, non-collapsing space .It \e Ta breaking, non-collapsing n-width space @@ -96,7 +97,7 @@ Spacing: . .Pp Lines: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(ba Ta \(ba Ta bar .It \e(br Ta \(br Ta box rule @@ -109,7 +110,7 @@ Lines: . .Pp Text markers: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(ci Ta \(ci Ta circle .It \e(bu Ta \(bu Ta bullet @@ -129,7 +130,7 @@ Text markers: . .Pp Legal symbols: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(co Ta \(co Ta copyright .It \e(rg Ta \(rg Ta registered @@ -138,12 +139,11 @@ Legal symbols: . .Pp Punctuation: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(em Ta \(em Ta em-dash .It \e(en Ta \(en Ta en-dash .It \e(hy Ta \(hy Ta hyphen -.It \e\e Ta \\ Ta back-slash .It \ee Ta \e Ta back-slash .It \e. Ta \. Ta period .It \e(r! Ta \(r! Ta upside-down exclamation @@ -152,7 +152,7 @@ Punctuation: . .Pp Quotes: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(Bq Ta \(Bq Ta right low double-quote .It \e(bq Ta \(bq Ta right low single-quote @@ -170,7 +170,7 @@ Quotes: . .Pp Brackets: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "x[bracketrightbp]" Rendered Description .It Em Input Ta Em Rendered Ta Em Description .It \e(lB Ta \(lB Ta left bracket .It \e(rB Ta \(rB Ta right bracket @@ -210,7 +210,7 @@ Brackets: . .Pp Arrows: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(<- Ta \(<- Ta left arrow .It \e(-> Ta \(-> Ta right arrow @@ -228,7 +228,7 @@ Arrows: . .Pp Logical: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(AN Ta \(AN Ta logical and .It \e(OR Ta \(OR Ta logical or @@ -244,7 +244,7 @@ Logical: . .Pp Mathematical: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "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 @@ -310,7 +310,7 @@ Mathematical: . .Pp Ligatures: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(ff Ta \(ff Ta ff ligature .It \e(fi Ta \(fi Ta fi ligature @@ -328,7 +328,7 @@ Ligatures: . .Pp Accents: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(a" Ta \(a" Ta Hungarian umlaut .It \e(a- Ta \(a- Ta macron @@ -351,7 +351,7 @@ Accents: . .Pp Accented letters: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e('A Ta \('A Ta acute A .It \e('E Ta \('E Ta acute E @@ -412,7 +412,7 @@ Accented letters: . .Pp Special letters: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(-D Ta \(-D Ta Eth .It \e(Sd Ta \(Sd Ta eth @@ -424,7 +424,7 @@ Special letters: . .Pp Currency: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(Do Ta \(Do Ta dollar .It \e(ct Ta \(ct Ta cent @@ -438,7 +438,7 @@ Currency: . .Pp Units: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(de Ta \(de Ta degree .It \e(%0 Ta \(%0 Ta per-thousand @@ -449,7 +449,7 @@ Units: . .Pp Greek letters: -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e(*A Ta \(*A Ta Alpha .It \e(*B Ta \(*B Ta Beta @@ -512,7 +512,7 @@ These are not recommended for use, as they differ across implementations: . .Pp -.Bl -column -compact -offset indent 10m 10m 10m +.Bl -column -compact -offset indent "Input" "Rendered" "Description" .It Em Input Ta Em Rendered Ta Em Description .It \e*(Ba Ta \*(Ba Ta vertical bar .It \e*(Ne Ta \*(Ne Ta not equal @@ -594,5 +594,5 @@ having no known representation: .Sh AUTHORS The .Nm -utility was written by +manual page was written by .An Kristaps Dzonsons Aq kristaps@kth.se . diff --git a/external/bsd/mdocml/dist/manuals.7 b/external/bsd/mdocml/dist/manuals.7 index 7c0e7afd45a..f0a474ecb4e 100644 --- a/external/bsd/mdocml/dist/manuals.7 +++ b/external/bsd/mdocml/dist/manuals.7 @@ -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$ +.Dd $Mdocdate: July 27 2009 $ .Dt MANUALS 7 .Os .\" SECTION @@ -134,7 +134,7 @@ or to version-control your work. If you wish the last check-in to effect your document's date, use the following RCS tag for the date macro: .Pp -.Dl \&.Dd $Mdocdate$ +.Dl \&.Dd $Mdocdate: July 27 2009 $ .\" SUBSECTION .Ss Viewing mdoc documents may be paged to your terminal with diff --git a/external/bsd/mdocml/dist/mdoc.3 b/external/bsd/mdocml/dist/mdoc.3 index b997024eab8..91830d8ed9a 100644 --- a/external/bsd/mdocml/dist/mdoc.3 +++ b/external/bsd/mdocml/dist/mdoc.3 @@ -1,6 +1,6 @@ -.\" $Vendor-Id: mdoc.3,v 1.35 2009/10/03 16:36:06 kristaps Exp $ +.\" $Vendor-Id: mdoc.3,v 1.37 2010/02/17 19:22:01 kristaps Exp $ .\" -.\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> +.\" Copyright (c) 2009-2010 Kristaps Dzonsons <kristaps@bsd.lv> .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -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$ +.Dd $Mdocdate: February 17 2010 $ .Dt MDOC 3 .Os .\" SECTION @@ -92,7 +92,7 @@ Both functions (see and variables (see .Sx Variables ) may use the following types: -.Bl -ohang -offset "XXXX" +.Bl -ohang .\" LIST-ITEM .It Vt struct mdoc An opaque type defined in @@ -113,7 +113,7 @@ for details. .\" SUBSECTION .Ss Functions Function descriptions follow: -.Bl -ohang -offset "XXXX" +.Bl -ohang .\" LIST-ITEM .It Fn mdoc_alloc Allocates a parsing structure. The @@ -168,7 +168,7 @@ return 0, the data will be incomplete. .\" SUBSECTION .Ss Variables The following variables are also defined: -.Bl -ohang -offset "XXXX" +.Bl -ohang .\" LIST-ITEM .It Va mdoc_macronames An array of string-ified token names. @@ -225,7 +225,7 @@ fields) and some type-specific data. The tree itself is arranged according to the following normal form, where capitalised non-terminals represent nodes. .Pp -.Bl -tag -width "ELEMENTXX" -compact -offset "XXXX" +.Bl -tag -width "ELEMENTXX" -compact .\" LIST-ITEM .It ROOT \(<- mnode+ @@ -259,11 +259,8 @@ an empty line will produce a zero-length string. The following example reads lines from stdin and parses them, operating on the finished parse tree with .Fn parsed . -Note that, if the last line of the file isn't newline-terminated, this -will truncate the file's last character (see -.Xr fgetln 3 ) . -Further, this example does not error-check nor free memory upon failure. -.Bd -literal -offset "XXXX" +This example does not error-check nor free memory upon failure. +.Bd -literal -offset indent struct mdoc *mdoc; const struct mdoc_node *node; char *buf; @@ -272,18 +269,21 @@ int line; line = 1; mdoc = mdoc_alloc(NULL, 0, NULL); +buf = NULL; +alloc_len = 0; -while ((buf = fgetln(fp, &len))) { - buf[len - 1] = '\\0'; - if ( ! mdoc_parseln(mdoc, line, buf)) - errx(1, "mdoc_parseln"); - line++; +while ((len = getline(&buf, &alloc_len, stdin)) >= 0) { + if (len && buflen[len - 1] = '\en') + buf[len - 1] = '\e0'; + if ( ! mdoc_parseln(mdoc, line, buf)) + errx(1, "mdoc_parseln"); + line++; } if ( ! mdoc_endparse(mdoc)) - errx(1, "mdoc_endparse"); + errx(1, "mdoc_endparse"); if (NULL == (node = mdoc_node(mdoc))) - errx(1, "mdoc_node"); + errx(1, "mdoc_node"); parsed(mdoc, node); mdoc_free(mdoc); @@ -297,7 +297,7 @@ mdoc_free(mdoc); The .Nm utility was written by -.An Kristaps Dzonsons Aq kristaps@kth.se . +.An Kristaps Dzonsons Aq kristaps@bsd.lv . .\" SECTION .Sh CAVEATS .Bl -dash -compact diff --git a/external/bsd/mdocml/dist/mdoc.7 b/external/bsd/mdocml/dist/mdoc.7 index 9833787a2f2..5865e1b3dfa 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.78 2009/11/16 09:52:47 kristaps Exp $ +.\" $Vendor-Id: mdoc.7,v 1.84 2010/02/17 19:22:50 kristaps Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> .\" @@ -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$ +.Dd $Mdocdate: February 17 2010 $ .Dt MDOC 7 .Os . @@ -132,7 +132,7 @@ and Terms may be text-decorated using the .Sq \ef escape followed by an indicator: B (bold), I, (italic), R (Roman), or P -(revert to previous mode): +(revert to previous mode): .Pp .D1 \efBbold\efR \efIitalic\efP .Pp @@ -170,19 +170,19 @@ for arbitrary-digit numerals: .D1 \es+(10much bigger\es-(10 .D1 \es+'100'much much bigger\es-'100' .Pp -Note these forms are +Note these forms are .Em not -recommended for +recommended for .Nm , which encourages semantic annotation. . . .Ss Predefined Strings -Historically, +Historically, .Xr groff 1 -also defined a set of package-specific +also defined a set of package-specific .Dq predefined strings , -which, like +which, like .Sx Special Characters , demark special output characters and strings by way of input codes. Predefined strings are escaped with the slash-asterisk, @@ -343,7 +343,7 @@ and .Sx \&Os macros, is required for every document. .Pp -The first section (sections are denoted by +The first section (sections are denoted by .Sx \&Sh ) must be the NAME section, consisting of at least one .Sx \&Nm @@ -419,6 +419,11 @@ The macro(s) must precede the .Sx \&Nd macro. +.Pp +See +.Sx \&Nm +and +.Sx \&Nd . . .It Em LIBRARY The name of the library containing the documented material, which is @@ -429,12 +434,11 @@ this is as follows: .Ed .Pp See -.Sx \&Lb -for details. +.Sx \&Lb . . .It Em SYNOPSIS Documents the utility invocation syntax, function call syntax, or device -configuration. +configuration. .Pp For the first, utilities (sections 1, 6, and 8), this is generally structured as follows: @@ -465,11 +469,19 @@ And for the third, configurations (section 4): \&.Cd \*qit* at isa? port 0x4e\*q .Ed .Pp -Manuals not in these sections generally don't need a +Manuals not in these sections generally don't need a .Em SYNOPSIS . +.Pp +See +.Sx \&Op , +.Sx \&Cd , +.Sx \&Fn , +.Sx \&Ft , +and +.Sx \&Vt . . .It Em DESCRIPTION -This expands upon the brief, one-line description in +This expands upon the brief, one-line description in .Em NAME . It usually contains a break-down of the options (if documenting a command), such as: @@ -480,6 +492,7 @@ The arguments are as follows: Print verbose information. \&.El .Ed +.Pp Manuals not documenting a command won't include the above fragment. . .It Em IMPLEMENTATION NOTES @@ -535,7 +548,8 @@ for manuals in sections 1, 6, and 8; however, this practise is discouraged. .Pp See -.Sx \&Bl No \-diag . +.Sx \&Bl +.Fl diag . . .It Em ERRORS Documents error handling in sections 2, 3, and 9. @@ -669,7 +683,7 @@ All macros have bodies; some don't have heads; only one .Po .Sx \&It Fl column -.Pc +.Pc has multiple heads. .Bd -literal -offset indent \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead... \(lBTa head...\(rB\(rB @@ -756,7 +770,16 @@ or end of line. .It Sx \&Ql Ta Yes Ta Yes .It Sx \&Qq Ta Yes Ta Yes .It Sx \&Sq Ta Yes Ta Yes +.It Sx \&Vt Ta Yes Ta Yes .El +.Pp +Note that the +.Sx \&Vt +macro is a +.Sx Block partial-implicit +only when invoked as the first macro +in a SYNOPSIS section line, else it is +.Sx In-line . . . .Ss In-line @@ -849,10 +872,10 @@ then the macro accepts an arbitrary number of arguments. .It Sx \&Ux Ta Yes Ta Yes Ta n .It Sx \&Va Ta Yes Ta Yes Ta n .It Sx \&Vt Ta Yes Ta Yes Ta >0 -.It Sx \&Xr Ta Yes Ta Yes Ta >0, <3 +.It Sx \&Xr Ta Yes Ta Yes Ta >0 .It Sx \&br Ta \&No Ta \&No Ta 0 .It Sx \&sp Ta \&No Ta \&No Ta 1 -.El +.El . . .Sh REFERENCE @@ -1012,7 +1035,7 @@ a function: .Ed . .Ss \&Aq -Encloses its arguments in angled brackets. +Encloses its arguments in angled brackets. .Pp Examples: .Bd -literal -offset indent @@ -1059,7 +1082,7 @@ Note that these parameters do not begin with a hyphen. .Pp Examples: .Bd -literal -offset indent -\&.At +\&.At \&.At V.1 .Ed .Pp @@ -1160,7 +1183,60 @@ and .Ss \&Bf .Ss \&Bk .Ss \&Bl -. +.\" Begins a list composed of one or more list entries. A list entry is +.\" specified by the +.\" .Sx \&It +.\" macro, which consists of a head and optional body. By default, a list +.\" is preceded by a blank line. A list must specify one of the following +.\" list types: +.\" .Bl -tag -width 12n +.\" .It Fl bullet +.\" A list offset by a bullet. The head of list entries must be empty. +.\" List entry bodies are justified after the bullet. +.\" .It Fl column +.\" A columnated list. The number of columns is specified as arguments to +.\" the +.\" .Sx \&Bl +.\" macro (the deprecated form of following the invocation of +.\" .Fl column +.\" is also accepted). Arguments dictate the width of columns specified in +.\" list entries. List entry bodies must be left empty. Columns specified +.\" in the list entry head are justified to their position in the sequence +.\" of columns. +.\" .It Fl dash +.\" A list offset by a dash (hyphen). The head of list entries must be +.\" empty. List entry bodies are justified past the dash. +.\" .It Fl diag +.\" Like +.\" .Fl inset +.\" lists, but with additional formatting to the head. +.\" .It Fl enum +.\" A list offset by a number indicating list entry position. The head of +.\" list entries must be empty. List entry bodies are justified past the +.\" enumeration. +.\" .It Fl hang +.\" Like +.\" .Fl tag , +.\" but instead of list bodies justifying to the head on the first line, +.\" they trail the head text. +.\" .It Fl hyphen +.\" Synonym for +.\" .Fl dash . +.\" .It Fl inset +.\" Like +.\" .Fl tag , +.\" but list entry bodies aren't justified. +.\" .It Fl item +.\" An un-justified list. This produces blocks of text. +.\" .It Fl ohang +.\" List bodies are placed on the line following the head. +.\" .It Fl tag +.\" A list offset by list entry heads. List entry bodies are justified +.\" after the head. +.\" .El +.\" .Pp +.\" More... +.\" . .Ss \&Bo Begins a block enclosed by square brackets. Does not have any head arguments. @@ -1175,7 +1251,7 @@ See also .Sx \&Bq . . .Ss \&Bq -Encloses its arguments in square brackets. +Encloses its arguments in square brackets. .Pp Examples: .Bd -literal -offset indent @@ -1322,7 +1398,7 @@ manual. Its calling syntax is as follows: .Pp .D1 \. Ns Sx \&Dd Cm date .Pp -The +The .Cm date field may be either .Ar $\&Mdocdate$ , @@ -1371,7 +1447,7 @@ See also .Sx \&Dq . . .Ss \&Dq -Encloses its arguments in double quotes. +Encloses its arguments in double quotes. .Pp Examples: .Bd -literal -offset indent @@ -1596,6 +1672,22 @@ is provided. .Ss \&Fc .Ss \&Fd .Ss \&Fl +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. +.Pp +Examples: +.Bd -literal -offset indent +\&.Fl a b c +\&.Fl +\&.Op Fl o Ns Ar file +.Ed +.Pp +See also +.Sx \&Cm . +. .Ss \&Fn .Ss \&Fo .Ss \&Fr @@ -1809,9 +1901,58 @@ and . .Ss \&Va .Ss \&Vt +A variable type. This is also used for indicating global variables in the +SYNOPSIS section, in which case a variable name is also specified. Note that +it accepts +.Sx Block partial-implicit +syntax when invoked as the first macro in the SYNOPSIS section, else it +accepts ordinary +.Sx In-line +syntax. +.Pp +Note that this should not be confused with +.Sx \&Ft , +which is used for function return types. +.Pp +Examples: +.Bd -literal -offset indent +\&.Vt unsigned char +\&.Vt extern const char * const sys_signame[] ; +.Ed +.Pp +See also +.Sx \&Ft +and +.Sx \&Va . +. .Ss \&Xc .Ss \&Xo .Ss \&Xr +Link to another manual +.Pq Qq cross-reference . +Its calling syntax is +.Pp +.D1 \. Ns Sx \&Xr Cm name section +.Pp +The +.Cm name +and +.Cm section +are the name and section of the linked manual. If +.Cm section +is followed by non-punctuation, an +.Sx \&Ns +is inserted into the token stream. This behaviour is for compatibility +with +.Xr groff 1 . +.Pp +Examples: +.Bd -literal -offset indent +\&.Xr mandoc 1 +\&.Xr mandoc 1 ; +\&.Xr mandoc 1 s behaviour +.Ed +. .Ss \&br .Ss \&sp . @@ -1830,6 +1971,23 @@ file re-write .Pp .Bl -dash -compact .It +The comment syntax +.Sq \e." +is no longer accepted. +.It +In +.Xr groff 1 , +the +.Sx \&Pa +macro does not format its arguments when used in the FILES section under +certain list types. This irregular behaviour has been discontinued. +.It +Historic +.Xr groff 1 +does not print a dash for empty +.Sx \&Fl +arguments. This behaviour has been discontinued. +.It .Xr groff 1 behaves strangely (even between versions) when specifying .Sq \ef @@ -1839,7 +1997,7 @@ normalised. Negative scaling units are now truncated to zero instead of creating interesting conditions, such as with .Sx \&sp -.Cm \-1i . +.Fl 1i . Furthermore, the .Sq f scaling unit, while accepted, is rendered as the default unit. diff --git a/external/bsd/mdocml/dist/mdoc.c b/external/bsd/mdocml/dist/mdoc.c index 342ee46cb9e..7159e8fda7b 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.113 2009/10/30 05:58:38 kristaps Exp $ */ +/* $Vendor-Id: mdoc.c,v 1.116 2010/01/07 10:24:43 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> @@ -93,11 +97,11 @@ const char *const __mdoc_macronames[MDOC_MAX] = { "Nm", "Op", "Ot", "Pa", "Rv", "St", "Va", "Vt", /* LINTED */ - "Xr", "\%A", "\%B", "\%D", + "Xr", "%A", "%B", "%D", /* LINTED */ - "\%I", "\%J", "\%N", "\%O", + "%I", "%J", "%N", "%O", /* LINTED */ - "\%P", "\%R", "\%T", "\%V", + "%P", "%R", "%T", "%V", "Ac", "Ao", "Aq", "At", "Bc", "Bf", "Bo", "Bq", "Bsx", "Bx", "Db", "Dc", @@ -114,11 +118,11 @@ const char *const __mdoc_macronames[MDOC_MAX] = { "Fr", "Ud", "Lb", "Lp", "Lk", "Mt", "Brq", "Bro", /* LINTED */ - "Brc", "\%C", "Es", "En", + "Brc", "%C", "Es", "En", /* LINTED */ - "Dx", "\%Q", "br", "sp", + "Dx", "%Q", "br", "sp", /* LINTED */ - "\%U" + "%U" }; const char *const __mdoc_argnames[MDOC_ARG_MAX] = { @@ -148,11 +152,6 @@ static int macrowarn(struct mdoc *, int, const char *); static int pstring(struct mdoc *, int, int, const char *, size_t); -#ifdef __linux__ -extern size_t strlcpy(char *, const char *, size_t); -#endif - - const struct mdoc_node * mdoc_node(const struct mdoc *m) { @@ -582,6 +581,7 @@ static int parsetext(struct mdoc *m, int line, char *buf) { int i, j; + char sv; if (SEC_NONE == m->lastnamed) return(mdoc_perr(m, line, 0, ETEXTPROL)); @@ -598,7 +598,8 @@ parsetext(struct mdoc *m, int line, char *buf) for (i = 0; ' ' == buf[i]; i++) /* Skip leading whitespace. */ ; - if (0 == buf[i]) + + if ('\0' == buf[i]) return(mdoc_perr(m, line, 0, ENOBLANK)); /* @@ -614,15 +615,30 @@ parsetext(struct mdoc *m, int line, char *buf) if (i && ' ' == buf[i] && '\\' == buf[i - 1]) continue; - buf[i++] = 0; + sv = buf[i]; + buf[i++] = '\0'; + if ( ! pstring(m, line, j, &buf[j], (size_t)(i - j))) return(0); + /* Trailing whitespace? Check at overwritten byte. */ + + if (' ' == sv && '\0' == buf[i]) + if ( ! mdoc_pwarn(m, line, i - 1, ETAILWS)) + return(0); + for ( ; ' ' == buf[i]; i++) /* Skip trailing whitespace. */ ; j = i; - if (0 == buf[i]) + + /* Trailing whitespace? */ + + if (' ' == buf[i - 1] && '\0' == buf[i]) + if ( ! mdoc_pwarn(m, line, i - 1, ETAILWS)) + return(0); + + if ('\0' == buf[i]) break; } @@ -659,7 +675,7 @@ parsemacro(struct mdoc *m, int ln, char *buf) /* Empty lines are ignored. */ - if (0 == buf[1]) + if ('\0' == buf[1]) return(1); i = 1; @@ -670,14 +686,14 @@ parsemacro(struct mdoc *m, int ln, char *buf) i++; while (buf[i] && ' ' == buf[i]) i++; - if (0 == buf[i]) + if ('\0' == buf[i]) return(1); } /* Copy the first word into a nil-terminated buffer. */ for (j = 0; j < 4; j++, i++) { - if (0 == (mac[j] = buf[i])) + if ('\0' == (mac[j] = buf[i])) break; else if (' ' == buf[i]) break; @@ -708,6 +724,12 @@ parsemacro(struct mdoc *m, int ln, char *buf) while (buf[i] && ' ' == buf[i]) i++; + /* Trailing whitespace? */ + + if ('\0' == buf[i] && ' ' == buf[i - 1]) + if ( ! mdoc_pwarn(m, ln, i - 1, ETAILWS)) + goto err; + /* * Begin recursive parse sequence. Since we're at the start of * the line, we don't need to do callable/parseable checks. diff --git a/external/bsd/mdocml/dist/mdoc_argv.c b/external/bsd/mdocml/dist/mdoc_argv.c index 15701b70879..58f553f0907 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.32 2009/10/30 05:58:38 kristaps Exp $ */ +/* $Vendor-Id: mdoc_argv.c,v 1.33 2010/01/01 17:14:29 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> diff --git a/external/bsd/mdocml/dist/mdoc_hash.c b/external/bsd/mdocml/dist/mdoc_hash.c index 1b9810ac189..66805286e45 100644 --- a/external/bsd/mdocml/dist/mdoc_hash.c +++ b/external/bsd/mdocml/dist/mdoc_hash.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: mdoc_hash.c,v 1.11 2009/09/17 07:41:28 kristaps Exp $ */ +/* $Vendor-Id: mdoc_hash.c,v 1.12 2010/01/01 17:14:29 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> diff --git a/external/bsd/mdocml/dist/mdoc_html.c b/external/bsd/mdocml/dist/mdoc_html.c index 2607ee5dc96..1c8dfdcf230 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.48 2009/11/16 08:46:59 kristaps Exp $ */ +/* $Vendor-Id: mdoc_html.c,v 1.54 2010/01/30 08:42:20 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,8 +14,11 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> -#include <sys/param.h> #include <assert.h> #include <ctype.h> @@ -36,6 +39,10 @@ const struct mdoc_node *n, \ struct html *h +#ifndef MIN +#define MIN(a,b) ((/*CONSTCOND*/(a)<(b))?(a):(b)) +#endif + struct htmlmdoc { int (*pre)(MDOC_ARGS); void (*post)(MDOC_ARGS); @@ -126,11 +133,6 @@ static int mdoc_vt_pre(MDOC_ARGS); static int mdoc_xr_pre(MDOC_ARGS); static int mdoc_xx_pre(MDOC_ARGS); -#ifdef __linux__ -extern size_t strlcpy(char *, const char *, size_t); -extern size_t strlcat(char *, const char *, size_t); -#endif - static const struct htmlmdoc mdocs[MDOC_MAX] = { {mdoc_ap_pre, NULL}, /* Ap */ {NULL, NULL}, /* Dd */ @@ -264,7 +266,7 @@ html_mdoc(void *arg, const struct mdoc *m) h = (struct html *)arg; - print_gen_doctype(h); + print_gen_decls(h); t = print_otag(h, TAG_HTML, 0, NULL); print_mdoc(mdoc_meta(m), mdoc_node(m), h); print_tagq(h, t); @@ -661,10 +663,19 @@ mdoc_fl_pre(MDOC_ARGS) PAIR_CLASS_INIT(&tag, "flag"); print_otag(h, TAG_SPAN, 1, &tag); - if (MDOC_Fl == n->tok) { - print_text(h, "\\-"); + + /* `Cm' has no leading hyphen. */ + + if (MDOC_Cm == n->tok) + return(1); + + print_text(h, "\\-"); + + /* A blank `Fl' should incur a subsequent space. */ + + if (n->child) h->flags |= HTML_NOSPACE; - } + return(1); } @@ -1572,15 +1583,18 @@ mdoc_vt_pre(MDOC_ARGS) struct htmlpair tag; struct roffsu su; - if (SEC_SYNOPSIS == n->sec) { - if (n->next && MDOC_Vt != n->next->tok) { + if (MDOC_BLOCK == n->type) { + if (n->prev && MDOC_Vt != n->prev->tok) { SCALE_VS_INIT(&su, 1); - bufcat_su(h, "margin-bottom", &su); + 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); - } + + return(1); + } else if (MDOC_HEAD == n->type) + return(0); PAIR_CLASS_INIT(&tag, "type"); print_otag(h, TAG_SPAN, 1, &tag); diff --git a/external/bsd/mdocml/dist/mdoc_macro.c b/external/bsd/mdocml/dist/mdoc_macro.c index 29548e586d5..ba58433b6ce 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.38 2009/10/26 17:05:44 kristaps Exp $ */ +/* $Vendor-Id: mdoc_macro.c,v 1.41 2010/01/30 08:42:20 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <assert.h> #include <ctype.h> #include <stdlib.h> @@ -27,6 +31,7 @@ #define REWIND_NOHALT (1 << 1) #define REWIND_HALT (1 << 2) +static int ctx_synopsis(MACRO_PROT_ARGS); static int obsolete(MACRO_PROT_ARGS); static int blk_part_exp(MACRO_PROT_ARGS); static int in_line_eoln(MACRO_PROT_ARGS); @@ -94,7 +99,7 @@ const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { { in_line_eoln, 0 }, /* Rv */ { in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* St */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Va */ - { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Vt */ + { ctx_synopsis, MDOC_CALLABLE | MDOC_PARSED }, /* Vt */ { in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Xr */ { in_line_eoln, 0 }, /* %A */ { in_line_eoln, 0 }, /* %B */ @@ -394,6 +399,8 @@ rew_dohalt(int tok, enum mdoc_type type, const struct mdoc_node *p) case (MDOC_Qq): /* FALLTHROUGH */ case (MDOC_Sq): + /* FALLTHROUGH */ + case (MDOC_Vt): assert(MDOC_TAIL != type); if (type == p->type && tok == p->tok) return(REWIND_REWIND); @@ -808,6 +815,17 @@ in_line(MACRO_PROT_ARGS) cnt++; if ( ! mdoc_word_alloc(m, line, la, p)) return(0); + + /* + * `Fl' macros have their scope re-opened with each new + * word so that the `-' can be added to each one without + * having to parse out spaces. + */ + if (0 == lastpunct && MDOC_Fl == tok) { + if ( ! rew_elem(m, tok)) + return(0); + lastpunct = 1; + } } if (0 == lastpunct && ! rew_elem(m, tok)) @@ -1307,6 +1325,29 @@ in_line_eoln(MACRO_PROT_ARGS) /* ARGSUSED */ static int +ctx_synopsis(MACRO_PROT_ARGS) +{ + + /* If we're not in the SYNOPSIS, go straight to in-line. */ + if (SEC_SYNOPSIS != m->lastsec) + return(in_line(m, tok, line, ppos, pos, buf)); + + /* If we're a nested call, same place. */ + if (ppos > 1) + return(in_line(m, tok, line, ppos, pos, buf)); + + /* + * XXX: this will open a block scope; however, if later we end + * up formatting the block scope, then child nodes will inherit + * the formatting. Be careful. + */ + + return(blk_part_imp(m, tok, line, ppos, pos, buf)); +} + + +/* ARGSUSED */ +static int obsolete(MACRO_PROT_ARGS) { diff --git a/external/bsd/mdocml/dist/mdoc_strings.c b/external/bsd/mdocml/dist/mdoc_strings.c index f1ef5f6508a..919c252208c 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.13 2009/11/02 06:22:46 kristaps Exp $ */ +/* $Vendor-Id: mdoc_strings.c,v 1.14 2010/01/01 17:14:30 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> diff --git a/external/bsd/mdocml/dist/mdoc_term.c b/external/bsd/mdocml/dist/mdoc_term.c index 842e1ae9de4..dcb6a8c0032 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.102 2009/11/12 05:50:12 kristaps Exp $ */ +/* $Vendor-Id: mdoc_term.c,v 1.110 2010/01/30 08:42:21 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> @@ -33,7 +37,6 @@ struct termpair { struct termpair *ppair; - int flag; int count; }; @@ -64,11 +67,6 @@ static void print_mdoc_head(DECL_ARGS); static void print_mdoc_nodelist(DECL_ARGS); static void print_foot(DECL_ARGS); -#ifdef __linux__ -extern size_t strlcpy(char *, const char *, size_t); -extern size_t strlcat(char *, const char *, size_t); -#endif - static void termp____post(DECL_ARGS); static void termp_an_post(DECL_ARGS); static void termp_aq_post(DECL_ARGS); @@ -134,6 +132,7 @@ static int termp_sq_pre(DECL_ARGS); static int termp_ss_pre(DECL_ARGS); static int termp_under_pre(DECL_ARGS); static int termp_ud_pre(DECL_ARGS); +static int termp_vt_pre(DECL_ARGS); static int termp_xr_pre(DECL_ARGS); static int termp_xx_pre(DECL_ARGS); @@ -177,7 +176,7 @@ static const struct termact termacts[MDOC_MAX] = { { termp_rv_pre, NULL }, /* Rv */ { NULL, NULL }, /* St */ { termp_under_pre, NULL }, /* Va */ - { termp_under_pre, termp_vt_post }, /* Vt */ + { termp_vt_pre, termp_vt_post }, /* Vt */ { termp_xr_pre, NULL }, /* Xr */ { NULL, termp____post }, /* %A */ { termp_under_pre, termp____post }, /* %B */ @@ -471,8 +470,7 @@ a2width(const struct mdoc_argv *arg, int pos) if ( ! a2roffsu(arg->value[pos], &su, SCALE_MAX)) SCALE_HS_INIT(&su, strlen(arg->value[pos])); - /* XXX: pachemu? */ - return(term_hspan(&su) + 2); + return(term_hspan(&su)); } @@ -537,6 +535,10 @@ a2offs(const struct mdoc_argv *arg) } +/* + * Return 1 if an argument has a particular argument value or 0 if it + * does not. See arg_getattr(). + */ static int arg_hasattr(int arg, const struct mdoc_node *n) { @@ -545,6 +547,10 @@ arg_hasattr(int arg, const struct mdoc_node *n) } +/* + * Get the index of an argument in a node's argument list or -1 if it + * does not exist. See arg_getattrs(). + */ static int arg_getattr(int v, const struct mdoc_node *n) { @@ -554,6 +560,12 @@ arg_getattr(int v, const struct mdoc_node *n) } +/* + * Walk through the argument list for a node and fill an array "vals" + * with the positions of the argument structures listed in "keys". + * Return the number of elements that were written into "vals", which + * can be zero. + */ static int arg_getattrs(const int *keys, int *vals, size_t sz, const struct mdoc_node *n) @@ -573,6 +585,11 @@ arg_getattrs(const int *keys, int *vals, } +/* + * Determine how much space to print out before block elements of `It' + * (and thus `Bl') and `Bd'. And then go ahead and print that space, + * too. + */ static void print_bvspace(struct termp *p, const struct mdoc_node *bl, @@ -651,7 +668,7 @@ termp_it_pre(DECL_ARGS) const struct mdoc_node *bl, *nn; char buf[7]; int i, type, keys[3], vals[3]; - size_t width, offset; + size_t width, offset, ncols, dcol; if (MDOC_BLOCK == n->type) { print_bvspace(p, n->parent->parent, n); @@ -660,11 +677,7 @@ termp_it_pre(DECL_ARGS) bl = n->parent->parent->parent; - /* Save parent attributes. */ - - pair->flag = p->flags; - - /* Get list width and offset. */ + /* Get list width, offset, and list type from argument list. */ keys[0] = MDOC_Width; keys[1] = MDOC_Offset; @@ -672,48 +685,71 @@ termp_it_pre(DECL_ARGS) vals[0] = vals[1] = vals[2] = -1; - width = offset = 0; - - (void)arg_getattrs(keys, vals, 3, bl); + arg_getattrs(keys, vals, 3, bl); type = arg_listtype(bl); assert(-1 != type); - /* Calculate real width and offset. */ + /* + * First calculate width and offset. This is pretty easy unless + * we're a -column list, in which case all prior columns must + * be accounted for. + */ + + width = offset = 0; + + if (vals[1] >= 0) + offset = a2offs(&bl->args->argv[vals[1]]); switch (type) { case (MDOC_Column): if (MDOC_BODY == n->type) break; - /* - * Work around groff's column handling. The offset is - * equal to the sum of all widths leading to the current - * column (plus the -offset value). If this column - * exceeds the stated number of columns, the width is - * set as 0, else it's the stated column width (later - * the 0 will be adjusted to default 10 or, if in the - * last column case, set to stretch to the margin). + /* + * Imitate groff's column handling: + * - For each earlier column, add its width. + * - For less than 5 columns, add four more blanks per + * column. + * - For exactly 5 columns, add three more blank per + * column. + * - For more than 5 columns, add only one column. */ - for (i = 0, nn = n->prev; nn && - i < (int)bl->args->argv[vals[2]].sz; + ncols = bl->args->argv[vals[2]].sz; + /* LINTED */ + dcol = ncols < 5 ? 4 : ncols == 5 ? 3 : 1; + + for (i = 0, nn = n->prev; + nn && i < (int)ncols; nn = nn->prev, i++) - offset += a2width + offset += dcol + a2width (&bl->args->argv[vals[2]], i); - /* Whether exceeds maximum column. */ - if (i < (int)bl->args->argv[vals[2]].sz) - width = a2width(&bl->args->argv[vals[2]], i); - else - width = 0; - if (vals[1] >= 0) - offset += a2offs(&bl->args->argv[vals[1]]); + /* + * When exceeding the declared number of columns, leave + * the remaining widths at 0. This will later be + * adjusted to the default width of 10, or, for the last + * column, stretched to the right margin. + */ + if (i >= (int)ncols) + break; + + /* + * Use the declared column widths, extended as explained + * in the preceding paragraph. + */ + width = a2width(&bl->args->argv[vals[2]], i) + dcol; break; default: - if (vals[0] >= 0) - width = a2width(&bl->args->argv[vals[0]], 0); - if (vals[1] >= 0) - offset += a2offs(&bl->args->argv[vals[1]]); + if (vals[0] < 0) + break; + + /* + * Note: buffer the width by 2, which is groff's magic + * number for buffering single arguments. See the above + * handling for column for how this changes. + */ + width = a2width(&bl->args->argv[vals[0]], 0) + 2; break; } @@ -782,11 +818,10 @@ termp_it_pre(DECL_ARGS) } /* - * Pad and break control. This is the tricker part. Lists with - * set right-margins for the head get TERMP_NOBREAK because, if - * they overrun the margin, they wrap to the new margin. - * Correspondingly, the body for these types don't left-pad, as - * the head will pad out to to the right. + * Pad and break control. This is the tricky part. These flags + * are documented in term_flushln() in term.c. Note that we're + * going to unset all of these flags in termp_it_post() when we + * exit. */ switch (type) { @@ -898,7 +933,8 @@ termp_it_pre(DECL_ARGS) * right-most column is filled to the right margin. */ if (MDOC_HEAD == n->type && - MDOC_BODY == n->next->type) + MDOC_BODY == n->next->type && + p->rmargin < p->maxrmargin) p->rmargin = p->maxrmargin; break; default: @@ -926,7 +962,7 @@ termp_it_pre(DECL_ARGS) break; case (MDOC_Enum): (pair->ppair->ppair->count)++; - (void)snprintf(buf, sizeof(buf), "%d.", + snprintf(buf, sizeof(buf), "%d.", pair->ppair->ppair->count); term_word(p, buf); break; @@ -969,7 +1005,7 @@ termp_it_post(DECL_ARGS) { int type; - if (MDOC_BODY != n->type && MDOC_HEAD != n->type) + if (MDOC_BLOCK == n->type) return; type = arg_listtype(n->parent->parent->parent); @@ -993,7 +1029,17 @@ termp_it_post(DECL_ARGS) break; } - p->flags = pair->flag; + /* + * Now that our output is flushed, we can reset our tags. Since + * only `It' sets these flags, we're free to assume that nobody + * has munged them in the meanwhile. + */ + + p->flags &= ~TERMP_DANGLE; + p->flags &= ~TERMP_NOBREAK; + p->flags &= ~TERMP_TWOSPACE; + p->flags &= ~TERMP_NOLPAD; + p->flags &= ~TERMP_HANG; } @@ -1020,7 +1066,12 @@ termp_fl_pre(DECL_ARGS) term_fontpush(p, TERMFONT_BOLD); term_word(p, "\\-"); - p->flags |= TERMP_NOSPACE; + + /* A blank `Fl' should incur a subsequent space. */ + + if (n->child) + p->flags |= TERMP_NOSPACE; + return(1); } @@ -1240,12 +1291,27 @@ termp_xr_pre(DECL_ARGS) } +static int +termp_vt_pre(DECL_ARGS) +{ + + if (MDOC_ELEM == n->type) + return(termp_under_pre(p, pair, m, n)); + else if (MDOC_HEAD == n->type) + return(0); + else if (MDOC_BLOCK == n->type) + return(1); + + return(termp_under_pre(p, pair, m, n)); +} + + /* ARGSUSED */ static void termp_vt_post(DECL_ARGS) { - if (n->sec != SEC_SYNOPSIS) + if (MDOC_BLOCK != n->type) return; if (n->next && MDOC_Vt == n->next->tok) term_newln(p); @@ -1969,10 +2035,9 @@ termp_sm_pre(DECL_ARGS) { assert(n->child && MDOC_TEXT == n->child->type); - if (0 == strcmp("on", n->child->string)) { + if (0 == strcmp("on", n->child->string)) p->flags &= ~TERMP_NONOSPACE; - p->flags &= ~TERMP_NOSPACE; - } else + else p->flags |= TERMP_NONOSPACE; return(0); diff --git a/external/bsd/mdocml/dist/mdoc_validate.c b/external/bsd/mdocml/dist/mdoc_validate.c index 38e17eb131a..b67dfcb3871 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.54 2009/11/02 06:22:46 kristaps Exp $ */ +/* $Vendor-Id: mdoc_validate.c,v 1.57 2010/01/30 08:42:21 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> @@ -62,10 +66,6 @@ static int warn_count(struct mdoc *, const char *, static int err_count(struct mdoc *, const char *, int, const char *, int); -#ifdef __linux__ -extern size_t strlcat(char *, const char *, size_t); -#endif - static int berr_ge1(POST_ARGS); static int bwarn_ge1(POST_ARGS); static int ebool(POST_ARGS); @@ -94,6 +94,7 @@ static int post_sh(POST_ARGS); static int post_sh_body(POST_ARGS); static int post_sh_head(POST_ARGS); static int post_st(POST_ARGS); +static int post_vt(POST_ARGS); static int pre_an(PRE_ARGS); static int pre_bd(PRE_ARGS); static int pre_bl(PRE_ARGS); @@ -130,6 +131,7 @@ static v_post posts_ss[] = { herr_ge1, NULL }; static v_post posts_st[] = { eerr_eq1, post_st, NULL }; static v_post posts_text[] = { eerr_ge1, NULL }; 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, eerr_le2, NULL }; @@ -190,7 +192,7 @@ const struct valids mdoc_valids[MDOC_MAX] = { { pres_rv, NULL }, /* Rv */ { NULL, posts_st }, /* St */ { NULL, NULL }, /* Va */ - { NULL, posts_text }, /* Vt */ + { NULL, posts_vt }, /* Vt */ { NULL, posts_xr }, /* Xr */ { NULL, posts_text }, /* %A */ { NULL, posts_text }, /* %B */ /* FIXME: can be used outside Rs/Re. */ @@ -891,6 +893,32 @@ post_lb(POST_ARGS) static int +post_vt(POST_ARGS) +{ + const struct mdoc_node *n; + + /* + * The Vt macro comes in both ELEM and BLOCK form, both of which + * have different syntaxes (yet more context-sensitive + * behaviour). ELEM types must have a child; BLOCK types, + * specifically the BODY, should only have TEXT children. + */ + + if (MDOC_ELEM == mdoc->last->type) + return(eerr_ge1(mdoc)); + if (MDOC_BODY != mdoc->last->type) + return(1); + + for (n = mdoc->last->child; n; n = n->next) + if (MDOC_TEXT != n->type) + if ( ! mdoc_nwarn(mdoc, n, EBADCHILD)) + return(0); + + return(1); +} + + +static int post_nm(POST_ARGS) { @@ -1086,11 +1114,18 @@ post_bl(POST_ARGS) if (NULL == mdoc->last->child) return(1); + /* + * We only allow certain children of `Bl'. This is usually on + * `It', but apparently `Sm' occurs here and there, so we let + * that one through, too. + */ + /* LINTED */ for (n = mdoc->last->child; n; n = n->next) { - if (MDOC_BLOCK == n->type) - if (MDOC_It == n->tok) - continue; + if (MDOC_BLOCK == n->type && MDOC_It == n->tok) + continue; + if (MDOC_Sm == n->tok) + continue; return(mdoc_nerr(mdoc, n, EBADCHILD)); } diff --git a/external/bsd/mdocml/dist/msec.c b/external/bsd/mdocml/dist/msec.c index 140101be0f2..77b1c7514eb 100644 --- a/external/bsd/mdocml/dist/msec.c +++ b/external/bsd/mdocml/dist/msec.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: msec.c,v 1.5 2009/10/26 17:05:44 kristaps Exp $ */ +/* $Vendor-Id: msec.c,v 1.6 2010/01/01 17:14:30 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdlib.h> #include <string.h> #include <time.h> diff --git a/external/bsd/mdocml/dist/out.c b/external/bsd/mdocml/dist/out.c index 669bebb721e..de895de77b6 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.11 2009/11/12 08:21:05 kristaps Exp $ */ +/* $Vendor-Id: out.c,v 1.12 2010/01/01 17:14:30 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> @@ -45,10 +49,6 @@ (t) = 3; } \ while (/* CONSTCOND */ 0) -#ifdef __linux__ -extern size_t strlcat(char *, const char *, size_t); -#endif - /* * Convert a `scaling unit' to a consistent form, or fail. Scaling * units are documented in groff.7, mdoc.7, man.7. diff --git a/external/bsd/mdocml/dist/st.c b/external/bsd/mdocml/dist/st.c index 343face0ce1..faa826e76ab 100644 --- a/external/bsd/mdocml/dist/st.c +++ b/external/bsd/mdocml/dist/st.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: st.c,v 1.5 2009/10/26 17:05:44 kristaps Exp $ */ +/* $Vendor-Id: st.c,v 1.6 2010/01/01 17:14:30 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdlib.h> #include <string.h> #include <time.h> diff --git a/external/bsd/mdocml/dist/term.c b/external/bsd/mdocml/dist/term.c index fa3301443b7..bcd038adb49 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.127 2009/11/12 08:21:06 kristaps Exp $ */ +/* $Vendor-Id: term.c,v 1.128 2010/01/01 17:14:30 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <sys/types.h> #include <assert.h> diff --git a/external/bsd/mdocml/dist/test-strlcat.c b/external/bsd/mdocml/dist/test-strlcat.c new file mode 100644 index 00000000000..5d450dd04d4 --- /dev/null +++ b/external/bsd/mdocml/dist/test-strlcat.c @@ -0,0 +1,8 @@ +#include <string.h> + +int +main(int argc, char **argv) +{ + strlcat(argv[0], argv[1], 10); + return 0; +} diff --git a/external/bsd/mdocml/dist/test-strlcpy.c b/external/bsd/mdocml/dist/test-strlcpy.c new file mode 100644 index 00000000000..c7d182aaf27 --- /dev/null +++ b/external/bsd/mdocml/dist/test-strlcpy.c @@ -0,0 +1,8 @@ +#include <string.h> + +int +main(int argc, char **argv) +{ + strlcpy(argv[0], argv[1], 10); + return 0; +} diff --git a/external/bsd/mdocml/dist/tree.c b/external/bsd/mdocml/dist/tree.c index e1175136302..fa7bf3049a9 100644 --- a/external/bsd/mdocml/dist/tree.c +++ b/external/bsd/mdocml/dist/tree.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: tree.c,v 1.18 2009/10/30 18:53:09 kristaps Exp $ */ +/* $Vendor-Id: tree.c,v 1.19 2010/01/01 17:14:31 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <assert.h> #include <stdio.h> #include <stdlib.h> diff --git a/external/bsd/mdocml/dist/vol.c b/external/bsd/mdocml/dist/vol.c index 7ba78bebdc3..601e328dd57 100644 --- a/external/bsd/mdocml/dist/vol.c +++ b/external/bsd/mdocml/dist/vol.c @@ -1,4 +1,4 @@ -/* $Vendor-Id: vol.c,v 1.5 2009/10/26 17:05:45 kristaps Exp $ */ +/* $Vendor-Id: vol.c,v 1.6 2010/01/01 17:14:31 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -14,6 +14,10 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdlib.h> #include <string.h> #include <time.h> |
