summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/mandoc/Makefile4
-rw-r--r--usr.bin/mandoc/html.c47
-rw-r--r--usr.bin/mandoc/lib.in11
-rw-r--r--usr.bin/mandoc/libmandoc.h7
-rw-r--r--usr.bin/mandoc/main.c18
-rw-r--r--usr.bin/mandoc/man.7505
-rw-r--r--usr.bin/mandoc/man.c8
-rw-r--r--usr.bin/mandoc/man_action.c42
-rw-r--r--usr.bin/mandoc/mandoc.c60
-rw-r--r--usr.bin/mandoc/mdoc.7244
-rw-r--r--usr.bin/mandoc/mdoc_action.c9
-rw-r--r--usr.bin/mandoc/mdoc_html.c11
-rw-r--r--usr.bin/mandoc/mdoc_strings.c24
-rw-r--r--usr.bin/mandoc/mdoc_term.c4
-rw-r--r--usr.bin/mandoc/mdoc_validate.c8
15 files changed, 753 insertions, 249 deletions
diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile
index 12eb3d5284c..25a8d6c61ad 100644
--- a/usr.bin/mandoc/Makefile
+++ b/usr.bin/mandoc/Makefile
@@ -1,8 +1,8 @@
-# $OpenBSD: Makefile,v 1.22 2009/12/22 23:58:00 schwarze Exp $
+# $OpenBSD: Makefile,v 1.23 2009/12/23 22:30:17 schwarze Exp $
.include <bsd.own.mk>
-VERSION=1.9.12
+VERSION=1.9.13
CFLAGS+=-DVERSION=\"${VERSION}\"
CFLAGS+=-W -Wall -Wstrict-prototypes
.if ${USE_GCC3:L} != "no"
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c
index 7af37b797b5..de01dceca5e 100644
--- a/usr.bin/mandoc/html.c
+++ b/usr.bin/mandoc/html.c
@@ -1,4 +1,4 @@
-/* $Id: html.c,v 1.3 2009/12/22 23:58:00 schwarze Exp $ */
+/* $Id: html.c,v 1.4 2009/12/23 22:30:17 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -18,8 +18,8 @@
#include <assert.h>
#include <ctype.h>
-#include <stdio.h>
#include <stdarg.h>
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -185,15 +185,13 @@ static void
print_spec(struct html *h, const char *p, int len)
{
const char *rhs;
- int i;
size_t sz;
rhs = chars_a2ascii(h->symtab, p, (size_t)len, &sz);
if (NULL == rhs)
return;
- for (i = 0; i < (int)sz; i++)
- putchar(rhs[i]);
+ fwrite(rhs, 1, sz, stdout);
}
@@ -201,15 +199,13 @@ static void
print_res(struct html *h, const char *p, int len)
{
const char *rhs;
- int i;
size_t sz;
rhs = chars_a2res(h->symtab, p, (size_t)len, &sz);
if (NULL == rhs)
return;
- for (i = 0; i < (int)sz; i++)
- putchar(rhs[i]);
+ fwrite(rhs, 1, sz, stdout);
}
@@ -316,26 +312,27 @@ print_escape(struct html *h, const char **p)
static void
print_encode(struct html *h, const char *p)
{
+ size_t sz;
for (; *p; p++) {
+ sz = strcspn(p, "\\<>&");
+
+ fwrite(p, 1, sz, stdout);
+ p += /* LINTED */
+ sz;
+
if ('\\' == *p) {
print_escape(h, &p);
continue;
- }
- switch (*p) {
- case ('<'):
- printf("&lt;");
+ } else if ('\0' == *p)
break;
- case ('>'):
+
+ if ('<' == *p)
+ printf("&lt;");
+ else if ('>' == *p)
printf("&gt;");
- break;
- case ('&'):
+ else if ('&' == *p)
printf("&amp;");
- break;
- default:
- putchar(*p);
- break;
- }
}
}
@@ -361,16 +358,16 @@ print_otag(struct html *h, enum htmltag tag,
if ( ! (HTML_NOSPACE & h->flags))
if ( ! (HTML_CLRLINE & htmltags[tag].flags))
- printf(" ");
+ putchar(' ');
printf("<%s", htmltags[tag].name);
for (i = 0; i < sz; i++) {
printf(" %s=\"", htmlattrs[p[i].key]);
assert(p->val);
print_encode(h, p[i].val);
- printf("\"");
+ putchar('\"');
}
- printf(">");
+ putchar('>');
h->flags |= HTML_NOSPACE;
if (HTML_CLRLINE & htmltags[tag].flags)
@@ -391,7 +388,7 @@ print_ctag(struct html *h, enum htmltag tag)
if (HTML_CLRLINE & htmltags[tag].flags) {
h->flags |= HTML_NOSPACE;
h->flags |= HTML_NEWLINE;
- printf("\n");
+ putchar('\n');
} else
h->flags &= ~HTML_NEWLINE;
}
@@ -437,7 +434,7 @@ print_text(struct html *h, const char *p)
}
if ( ! (h->flags & HTML_NOSPACE))
- printf(" ");
+ putchar(' ');
h->flags &= ~HTML_NOSPACE;
h->flags &= ~HTML_NEWLINE;
diff --git a/usr.bin/mandoc/lib.in b/usr.bin/mandoc/lib.in
index 68a8c8b5a98..17994a9a961 100644
--- a/usr.bin/mandoc/lib.in
+++ b/usr.bin/mandoc/lib.in
@@ -1,4 +1,4 @@
-/* $Id: lib.in,v 1.2 2009/06/14 23:00:57 schwarze Exp $ */
+/* $Id: lib.in,v 1.3 2009/12/23 22:30:17 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -23,8 +23,10 @@
* Be sure to escape strings.
*/
+LINE("libarchive", "Reading and Writing Streaming Archives Library (libarchive, \\-larchive)")
LINE("libarm", "ARM Architecture Library (libarm, \\-larm)")
LINE("libarm32", "ARM32 Architecture Library (libarm32, \\-larm32)")
+LINE("libbluetooth", "Bluetooth Library (libbluetooth, \\-lbluetooth)")
LINE("libc", "Standard C Library (libc, \\-lc)")
LINE("libcdk", "Curses Development Kit Library (libcdk, \\-lcdk)")
LINE("libcompat", "Compatibility Library (libcompat, \\-lcompat)")
@@ -32,24 +34,31 @@ LINE("libcrypt", "Crypt Library (libcrypt, \\-lcrypt)")
LINE("libcurses", "Curses Library (libcurses, \\-lcurses)")
LINE("libedit", "Command Line Editor Library (libedit, \\-ledit)")
LINE("libevent", "Event Notification Library (libevent, \\-levent)")
+LINE("libfetch", "File Transfer Library for URLs (libfetch, \\-lfetch)")
LINE("libform", "Curses Form Library (libform, \\-lform)")
LINE("libi386", "i386 Architecture Library (libi386, \\-li386)")
LINE("libintl", "Internationalized Message Handling Library (libintl, \\-lintl)")
LINE("libipsec", "IPsec Policy Control Library (libipsec, \\-lipsec)")
+LINE("libiscsi", "iSCSI protocol library (libiscsi, \\-liscsi)")
LINE("libkvm", "Kernel Data Access Library (libkvm, \\-lkvm)")
LINE("libm", "Math Library (libm, \\-lm)")
LINE("libm68k", "m68k Architecture Library (libm68k, \\-lm68k)")
LINE("libmagic", "Magic Number Recognition Library (libmagic, \\-lmagic)")
LINE("libmenu", "Curses Menu Library (libmenu, \\-lmenu)")
+LINE("libnetpgp", "Netpgp signing, verification, encryption and decryption (libnetpgp, \\-lnetpgp)")
LINE("libossaudio", "OSS Audio Emulation Library (libossaudio, \\-lossaudio)")
LINE("libpam", "Pluggable Authentication Module Library (libpam, \\-lpam)")
LINE("libpcap", "Capture Library (libpcap, \\-lpcap)")
LINE("libpci", "PCI Bus Access Library (libpci, \\-lpci)")
LINE("libpmc", "Performance Counters Library (libpmc, \\-lpmc)")
LINE("libposix", "POSIX Compatibility Library (libposix, \\-lposix)")
+LINE("libprop", "Property Container Object Library (libprop, \\-lprop)")
LINE("libpthread", "POSIX Threads Library (libpthread, \\-lpthread)")
+LINE("libpuffs", "puffs Convenience Library (libpuffs, \\-lpuffs)")
+LINE("librefuse", "File System in Userspace Convenience Library (librefuse, \\-lrefuse)")
LINE("libresolv", "DNS Resolver Library (libresolv, \\-lresolv)")
LINE("librt", "POSIX Real\\-time Library (librt, -lrt)")
+LINE("libssp", "Buffer Overflow Protection Library (libssp, \\-lssp)")
LINE("libtermcap", "Termcap Access Library (libtermcap, \\-ltermcap)")
LINE("libusbhid", "USB Human Interface Devices Library (libusbhid, \\-lusbhid)")
LINE("libutil", "System Utilities Library (libutil, \\-lutil)")
diff --git a/usr.bin/mandoc/libmandoc.h b/usr.bin/mandoc/libmandoc.h
index ddc29a88b8f..23588a422c0 100644
--- a/usr.bin/mandoc/libmandoc.h
+++ b/usr.bin/mandoc/libmandoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmandoc.h,v 1.2 2009/12/22 23:58:00 schwarze Exp $ */
+/* $Id: libmandoc.h,v 1.3 2009/12/23 22:30:17 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -24,6 +24,11 @@ void *mandoc_calloc(size_t, size_t);
char *mandoc_strdup(const char *);
void *mandoc_malloc(size_t);
void *mandoc_realloc(void *, size_t);
+time_t mandoc_a2time(int, const char *);
+#define MTIME_CANONICAL (1 << 0)
+#define MTIME_REDUCED (1 << 1)
+#define MTIME_MDOCDATE (1 << 2)
+#define MTIME_ISO_8601 (1 << 3)
__END_DECLS
diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c
index 31b5455380a..f0f591d8e9d 100644
--- a/usr.bin/mandoc/main.c
+++ b/usr.bin/mandoc/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.19 2009/12/22 23:58:00 schwarze Exp $ */
+/* $Id: main.c,v 1.20 2009/12/23 22:30:17 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -91,8 +91,8 @@ static int pset(const char *, int, struct curparse *,
struct man **, struct mdoc **);
static struct man *man_init(struct curparse *);
static struct mdoc *mdoc_init(struct curparse *);
-__dead static void version(void);
-__dead static void usage(void);
+static void version(void) __attribute__((noreturn));
+static void usage(void) __attribute__((noreturn));
static const char *progname;
@@ -198,7 +198,7 @@ main(int argc, char *argv[])
}
-__dead static void
+static void
version(void)
{
@@ -207,7 +207,7 @@ version(void)
}
-__dead static void
+static void
usage(void)
{
@@ -518,7 +518,7 @@ moptions(enum intt *tflags, char *arg)
else if (0 == strcmp(arg, "an"))
*tflags = INTT_MAN;
else {
- fprintf(stderr, "%s: Bad argument", arg);
+ fprintf(stderr, "%s: Bad argument\n", arg);
return(0);
}
@@ -539,7 +539,7 @@ toptions(enum outt *tflags, char *arg)
else if (0 == strcmp(arg, "html"))
*tflags = OUTT_HTML;
else {
- fprintf(stderr, "%s: Bad argument", arg);
+ fprintf(stderr, "%s: Bad argument\n", arg);
return(0);
}
@@ -588,7 +588,7 @@ foptions(int *fflags, char *arg)
*fflags &= ~NO_IGN_ESCAPE;
break;
default:
- fprintf(stderr, "%s: Bad argument", o);
+ fprintf(stderr, "%s: Bad argument\n", o);
return(0);
}
}
@@ -617,7 +617,7 @@ woptions(int *wflags, char *arg)
*wflags |= WARN_WERR;
break;
default:
- fprintf(stderr, "%s: Bad argument", o);
+ fprintf(stderr, "%s: Bad argument\n", o);
return(0);
}
}
diff --git a/usr.bin/mandoc/man.7 b/usr.bin/mandoc/man.7
index a293cea6388..f650da21c5f 100644
--- a/usr.bin/mandoc/man.7
+++ b/usr.bin/mandoc/man.7
@@ -1,4 +1,4 @@
-.\" $Id: man.7,v 1.13 2009/10/27 21:40:07 schwarze Exp $
+.\" $Id: man.7,v 1.14 2009/12/23 22:30:17 schwarze 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: October 27 2009 $
+.Dd $Mdocdate: December 23 2009 $
.Dt MAN 7
.Os
.
@@ -82,7 +82,7 @@ Text following a
whether in a macro or free-form text line, is ignored to the end of
line. A macro line with only a control character and comment escape,
.Sq \&.\e" ,
-is also ignored. Macro lines with only a control charater and
+is also ignored. Macro lines with only a control character and
optionally whitespace are stripped from input.
.
.
@@ -119,6 +119,17 @@ from input. These are later re-added, if applicable, by a front-end
utility such as
.Xr mandoc 1 .
.
+.
+.Ss Dates
+The
+.Sx \&TH
+macro is the only
+.Nm
+macro that requires a date. The form for this date is the ISO-8601
+standard
+.Cm YYYY-MM-DD .
+.
+.
.Ss Scaling Widths
Many macros support scaled widths for their arguments, such as
stipulating a two-inch paragraph indentation with the following:
@@ -170,8 +181,7 @@ Using anything other than
.Sq u ,
or
.Sq v
-is necessarily non-portable across output media. See
-.Sx COMPATIBILITY .
+is necessarily non-portable across output media.
.
.Pp
If a scaling unit is not provided, the numerical value is interpreted
@@ -202,7 +212,7 @@ Beyond
at least one macro or text node must appear in the document. Documents
are generally structured as follows:
.Bd -literal -offset indent
-\&.TH FOO 1 "13 Aug 2009"
+\&.TH FOO 1 2009-10-10
\&.
\&.SH NAME
\efBfoo\efR \e(en a description goes here
@@ -229,7 +239,7 @@ The \efBfoo\efR utility processes files...
\&.\e\*q The next is for sections 2, 3, & 9 only.
\&.\e\*q .SH ERRORS
\&.\e\*q .SH SEE ALSO
-\&.\e\*q \efBbar\efR(1)
+\&.\e\*q .BR foo ( 1 )
\&.\e\*q .SH STANDARDS
\&.\e\*q .SH HISTORY
\&.\e\*q .SH AUTHORS
@@ -242,19 +252,19 @@ The sections in a
.Nm
document are conventionally ordered as they appear above. Sections
should be composed as follows:
-.Bl -tag -width Ds -offset Ds
-.It NAME
+.Bl -ohang -offset indent
+.It Em NAME
The name(s) and a short description of the documented material. The
syntax for this is generally as follows:
.Pp
.D1 \efBname\efR \e(en description
-.It LIBRARY
+.It Em LIBRARY
The name of the library containing the documented material, which is
assumed to be a function in a section 2 or 3 manual. For functions in
the C library, this may be as follows:
.Pp
.D1 Standard C Library (libc, -lc)
-.It SYNOPSIS
+.It Em SYNOPSIS
Documents the utility invocation syntax, function call syntax, or device
configuration.
.Pp
@@ -265,34 +275,98 @@ generally structured as follows:
.Pp
For the second, function calls (sections 2, 3, 9):
.Pp
-.D1 \. Ns Sx \&B No char *name(char *\efIarg\efR);
+.D1 \&.B char *name(char *\efIarg\efR);
.Pp
And for the third, configurations (section 4):
.Pp
-.D1 \. Ns Sx \&B No name* at cardbus ? function ?
+.D1 \&.B name* at cardbus ? function ?
.Pp
-Manuals not in these sections generally don't need a SYNOPSIS.
-.It DESCRIPTION
-This expands upon the brief, one-line description in NAME. It usually
-contains a break-down of the options (if documenting a command).
-.It IMPLEMENTATION NOTES
+Manuals not in these sections generally don't need a
+.Em SYNOPSIS .
+.It Em DESCRIPTION
+This expands upon the brief, one-line description in
+.Em NAME .
+It usually contains a break-down of the options (if documenting a
+command).
+.It Em IMPLEMENTATION NOTES
Implementation-specific notes should be kept here. This is useful when
implementing standard functions that may have side effects or notable
algorithmic implications.
-.It EXIT STATUS
-.It RETURN VALUES
-.It ENVIRONMENT
-.It FILES
-.It EXAMPLES
-.It DIAGNOSTICS
-.It ERRORS
-.It SEE ALSO
-.It STANDARDS
-.It HISTORY
-.It AUTHORS
-.It CAVEATS
-.It BUGS
-.It SECURITY CONSIDERATIONS
+.It Em EXIT STATUS
+Command exit status for section 1, 6, and 8 manuals. This section is
+the dual of
+.Em RETURN VALUES ,
+which is used for functions. Historically, this information was
+described in
+.Em DIAGNOSTICS ,
+a practise that is now discouraged.
+.
+.It Em RETURN VALUES
+This section is the dual of
+.Em EXIT STATUS ,
+which is used for commands. It documents the return values of functions
+in sections 2, 3, and 9.
+.
+.It Em ENVIRONMENT
+Documents any usages of environment variables, e.g.,
+.Xr environ 7 .
+.
+.It Em FILES
+Documents files used. It's helpful to document both the file and a
+short description of how the file is used (created, modified, etc.).
+.
+.It Em EXAMPLES
+Example usages. This often contains snippets of well-formed,
+well-tested invocations. Make doubly sure that your examples work
+properly!
+.
+.It Em DIAGNOSTICS
+Documents error conditions. This is most useful in section 4 manuals.
+Historically, this section was used in place of
+.Em EXIT STATUS
+for manuals in sections 1, 6, and 8; however, this practise is
+discouraged.
+.
+.It Em ERRORS
+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.
+.Pp
+.D1 \&.BR bar \&( 1 \&),
+.Pp
+Cross-references should conventionally be ordered
+first by section, then alphabetically.
+.
+.It Em STANDARDS
+References any standards implemented or used, such as
+.Pp
+.D1 IEEE Std 1003.2 (\e(lqPOSIX.2\e(rq)
+.Pp
+If not adhering to any standards, the
+.Em HISTORY
+section should be used.
+.
+.It Em HISTORY
+The history of any manual without a
+.Em STANDARDS
+section should be described in this section.
+.
+.It Em AUTHORS
+Credits to authors, if applicable, should appear in this section.
+Authors should generally be noted by both name and an e-mail address.
+.
+.It Em CAVEATS
+Explanations of common misuses and misunderstandings should be explained
+in this section.
+.
+.It Em BUGS
+Extant bugs should be described in this section.
+.
+.It Em SECURITY CONSIDERATIONS
+Documents any security precautions that operators should consider.
+.
.El
.
.
@@ -330,8 +404,9 @@ foo
.Pp
is equivalent to
.Sq \&.I foo .
-If next-line macros are invoked consecutively, only the last is used.
-If a next-line macro is proceded by a block macro, it is ignored.
+If next-line macros are invoked consecutively, only the last is used; in
+other words, if a next-line macro is preceded by a block macro, it is
+ignored.
.Bd -literal -offset indent
\&.YO \(lBbody...\(rB
\(lBbody...\(rB
@@ -445,8 +520,19 @@ This section is a canonical reference to all macros, arranged
alphabetically. For the scoping of individual macros, see
.Sx MACRO SYNTAX .
.
+.
.Ss \&B
Text is rendered in bold face.
+.Pp
+See also
+.Sx \&I ,
+.Sx \&R ,
+.Sx \&b ,
+.Sx \&i ,
+and
+.Sx \&r .
+.
+.
.Ss \&BI
Text is rendered alternately in bold face and italic. Thus,
.Sq .BI this word and that
@@ -459,157 +545,402 @@ to render in bold face, while
and
.Sq that
render in italics. Whitespace between arguments is omitted in output.
+.Pp
+Examples:
+.Pp
+.D1 \&.BI bold italic bold italic
+.Pp
+The output of this example will be emboldened
+.Dq bold
+and italicised
+.Dq italic ,
+with spaces stripped between arguments.
+.Pp
+See also
+.Sx \&IB ,
+.Sx \&BR ,
+.Sx \&RB ,
+.Sx \&RI ,
+and
+.Sx \&IR .
+.
+.
.Ss \&BR
Text is rendered alternately in bold face and roman (the default font).
Whitespace between arguments is omitted in output.
+.Pp
+See
+.Sx \&BI
+for an equivalent example.
+.Pp
+See also
+.Sx \&BI ,
+.Sx \&IB ,
+.Sx \&RB ,
+.Sx \&RI ,
+and
+.Sx \&IR .
+.
+.
.Ss \&DT
Has no effect. Included for compatibility.
+.
+.
.Ss \&HP
Begin a paragraph whose initial output line is left-justified, but
subsequent output lines are indented, with the following syntax:
-.Bd -literal -offset indent
-\&.HP [width]
+.Bd -filled -offset indent
+.Pf \. Sx \&HP
+.Op Cm width
.Ed
-.
.Pp
-If scaling width
-.Va width
-is specified, it's saved for later paragraph left-margins; if
-unspecified, the saved or default width is used.
+The
+.Cm width
+argument must conform to
+.Sx Scaling Widths .
+If specified, it's saved for later paragraph left-margins; if unspecified, the
+saved or default width is used.
+.Pp
+See also
+.Sx \&IP ,
+.Sx \&LP ,
+.Sx \&P ,
+.Sx \&PP ,
+and
+.Sx \&TP .
+.
+.
.Ss \&I
Text is rendered in italics.
+.Pp
+See also
+.Sx \&B ,
+.Sx \&R ,
+.Sx \&b ,
+.Sx \&i ,
+and
+.Sx \&r .
+.
+.
.Ss \&IB
Text is rendered alternately in italics and bold face. Whitespace
between arguments is omitted in output.
+.Pp
+See
+.Sx \&BI
+for an equivalent example.
+.Pp
+See also
+.Sx \&BI ,
+.Sx \&BR ,
+.Sx \&RB ,
+.Sx \&RI ,
+and
+.Sx \&IR .
+.
+.
.Ss \&IP
-Begin a paragraph with the following syntax:
-.Bd -literal -offset indent
-\&.IP [head [width]]
+Begin an indented paragraph with the following syntax:
+.Bd -filled -offset indent
+.Pf \. Sx \&IP
+.Op Cm head Op Cm width
.Ed
-.
.Pp
-This follows the behaviour of the
-.Sx \&TP
-except for the macro syntax (all arguments on the line, instead of
-having next-line scope). If
-.Va width
-is specified, it's saved for later paragraph left-margins; if
-unspecified, the saved or default width is used.
+The
+.Cm width
+argument defines the width of the left margin and is defined by
+.Sx Scaling Widths ,
+It's saved for later paragraph left-margins; if unspecified, the saved or
+default width is used.
+.Pp
+The
+.Cm head
+argument is used as a leading term, flushed to the left margin. This is
+useful for bulleted paragraphs and so on.
+.Pp
+See also
+.Sx \&HP ,
+.Sx \&LP ,
+.Sx \&P ,
+.Sx \&PP ,
+and
+.Sx \&TP .
+.
+.
.Ss \&IR
Text is rendered alternately in italics and roman (the default font).
Whitespace between arguments is omitted in output.
+.Pp
+See
+.Sx \&BI
+for an equivalent example.
+.Pp
+See also
+.Sx \&BI ,
+.Sx \&IB ,
+.Sx \&BR ,
+.Sx \&RB ,
+and
+.Sx \&RI .
+.
+.
.Ss \&LP
Begin an undecorated paragraph. The scope of a paragraph is closed by a
subsequent paragraph, sub-section, section, or end of file. The saved
paragraph left-margin width is re-set to the default.
+.Pp
+See also
+.Sx \&HP ,
+.Sx \&IP ,
+.Sx \&P ,
+.Sx \&PP ,
+and
+.Sx \&TP .
+.
+.
.Ss \&P
Synonym for
.Sx \&LP .
+.Pp
+See also
+.Sx \&HP ,
+.Sx \&IP ,
+.Sx \&LP ,
+.Sx \&PP ,
+and
+.Sx \&TP .
+.
+.
.Ss \&PP
Synonym for
.Sx \&LP .
+.Pp
+See also
+.Sx \&HP ,
+.Sx \&IP ,
+.Sx \&LP ,
+.Sx \&P ,
+and
+.Sx \&TP .
+.
+.
.Ss \&R
Text is rendered in roman (the default font).
+.Pp
+See also
+.Sx \&I ,
+.Sx \&B ,
+.Sx \&b ,
+.Sx \&i ,
+and
+.Sx \&r .
+.
+.
.Ss \&RB
Text is rendered alternately in roman (the default font) and bold face.
Whitespace between arguments is omitted in output.
+.Pp
+See
+.Sx \&BI
+for an equivalent example.
+.Pp
+See also
+.Sx \&BI ,
+.Sx \&IB ,
+.Sx \&BR ,
+.Sx \&RI ,
+and
+.Sx \&IR .
+.
+.
.Ss \&RE
Explicitly close out the scope of a prior
.Sx \&RS .
+.
+.
.Ss \&RI
Text is rendered alternately in roman (the default font) and italics.
Whitespace between arguments is omitted in output.
+.Pp
+See
+.Sx \&BI
+for an equivalent example.
+.Pp
+See also
+.Sx \&BI ,
+.Sx \&IB ,
+.Sx \&BR ,
+.Sx \&RB ,
+and
+.Sx \&IR .
+.
+.
.Ss \&RS
Begin a part setting the left margin. The left margin controls the
offset, following an initial indentation, to un-indented text such as
that of
.Sx \&PP .
-A scaling width may be specified as following:
-.Bd -literal -offset indent
-\&.RS [width]
+This has the following syntax:
+.Bd -filled -offset indent
+.Pf \. Sx \&Rs
+.Op Cm width
.Ed
-.
.Pp
-If
-.Va width
-is not specified, the saved or default width is used.
+The
+.Cm width
+argument must conform to
+.Sx Scaling Widths .
+If not specified, the saved or default width is used.
+.
+.
.Ss \&SB
Text is rendered in small size (one point smaller than the default font)
bold face.
+.
+.
.Ss \&SH
Begin a section. The scope of a section is only closed by another
section or the end of file. The paragraph left-margin width is re-set
to the default.
+.
+.
.Ss \&SM
Text is rendered in small size (one point smaller than the default
font).
+.
+.
.Ss \&SS
Begin a sub-section. The scope of a sub-section is closed by a
subsequent sub-section, section, or end of file. The paragraph
left-margin width is re-set to the default.
+.
+.
.Ss \&TH
Sets the title of the manual page with the following syntax:
-.Bd -literal -offset indent
-\&.TH title section [date [source [volume]]]
+.Bd -filled -offset indent
+.Pf \. Sx \&TH
+.Cm title section
+.Op Cm date Op Cm source Op Cm volume
.Ed
-.
.Pp
-At least the
-.Va title
-and
-.Va section
+At least the upper-case document title
+.Cm title
+and numeric manual section
+.Cm section
arguments must be provided. The
-.Va date
-argument should be formatted as
-.Qq %b [%d] %Y
-format, described in
-.Xr strptime 3 .
-The
-.Va source
+.Cm date
+argument should be formatted as described in
+.Sx Dates :
+if it does not conform, the current date is used instead. The
+.Cm source
string specifies the organisation providing the utility. The
-.Va volume
-replaces the default rendered volume as dictated by the manual section.
+.Cm volume
+string replaces the default rendered volume, which is dictated by the
+manual section.
+.Pp
+Examples:
+.Pp
+.D1 \&.TH CVS 5 "1992-02-12" GNU
+.
+.
.Ss \&TP
Begin a paragraph where the head, if exceeding the indentation width, is
followed by a newline; if not, the body follows on the same line after a
buffer to the indentation width. Subsequent output lines are indented.
-.
-.Pp
-The indentation scaling width may be set as follows:
-.Bd -literal -offset indent
-\&.TP [width]
+The syntax is as follows:
+.Bd -filled -offset indent
+.Pf \. Sx \&TP
+.Op Cm width
.Ed
-.
.Pp
-If
-.Va width
-is specified, it's saved for later paragraph left-margins; if
+The
+.Cm width
+argument must conform to
+.Sx Scaling Widths .
+If specified, it's saved for later paragraph left-margins; if
unspecified, the saved or default width is used.
+.Pp
+See also
+.Sx \&HP ,
+.Sx \&IP ,
+.Sx \&LP ,
+.Sx \&P ,
+and
+.Sx \&PP .
+.
+.
.Ss \&PD
Has no effect. Included for compatibility.
+.
+.
.Ss \&UC
Has no effect. Included for compatibility.
+.
+.
.Ss \&br
Breaks the current line. Consecutive invocations have no further effect.
+.Pp
+See also
+.Sx \&sp .
+.
+.
.Ss \&fi
End literal mode begun by
.Sx \&nf .
+.
+.
.Ss \&i
Italicise arguments. If no arguments are specified, all subsequent text
is italicised.
+.Pp
+See also
+.Sx \&B ,
+.Sx \&I ,
+.Sx \&R .
+.Sx \&b ,
+and
+.Sx \&r .
+.
+.
.Ss \&na
Don't align to the right margin.
+.
+.
.Ss \&nf
Begin literal mode: all subsequent free-form lines have their end of
line boundaries preserved. May be ended by
.Sx \&fi .
+.
+.
.Ss \&r
Fonts and styles (bold face, italics) reset to roman (default font).
+.Pp
+See also
+.Sx \&B ,
+.Sx \&I ,
+.Sx \&R ,
+.Sx \&b ,
+and
+.Sx \&i .
+.
+.
.Ss \&sp
-Insert n spaces, where n is the macro's positive numeric argument. If
-0, this is equivalent to the
+Insert vertical spaces into output with the following syntax:
+.Bd -filled -offset indent
+.Pf \. Sx \&sp
+.Op Cm height
+.Ed
+.Pp
+Insert
+.Cm height
+spaces, which must conform to
+.Sx Scaling Widths .
+If 0, this is equivalent to the
.Sx \&br
-macro.
+macro. Defaults to 1, if unspecified.
+.Pp
+See also
+.Sx \&br .
.
.
.Sh COMPATIBILITY
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c
index eff62501e24..ebbf4ccdb35 100644
--- a/usr.bin/mandoc/man.c
+++ b/usr.bin/mandoc/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.16 2009/12/22 23:58:00 schwarze Exp $ */
+/* $Id: man.c,v 1.17 2009/12/23 22:30:17 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -450,8 +450,8 @@ man_pmacro(struct man *m, int ln, char *buf)
fl = m->flags;
- if (0 == buf[1])
- goto out;
+ if ('\0' == buf[1])
+ return(1);
i = 1;
@@ -480,7 +480,7 @@ man_pmacro(struct man *m, int ln, char *buf)
return(man_perr(m, ln, i, WNPRINT));
}
- mac[j] = 0;
+ mac[j] = '\0';
if (j == 4 || j < 1) {
if ( ! (MAN_IGN_MACRO & m->pflags)) {
diff --git a/usr.bin/mandoc/man_action.c b/usr.bin/mandoc/man_action.c
index e45de11fcb2..4732d148d81 100644
--- a/usr.bin/mandoc/man_action.c
+++ b/usr.bin/mandoc/man_action.c
@@ -1,4 +1,4 @@
-/* $Id: man_action.c,v 1.10 2009/12/22 23:58:00 schwarze Exp $ */
+/* $Id: man_action.c,v 1.11 2009/12/23 22:30:17 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -66,8 +66,6 @@ const struct actions man_actions[MAN_MAX] = {
{ NULL }, /* PD */
};
-static time_t man_atotime(const char *);
-
int
man_action_post(struct man *m)
@@ -153,13 +151,18 @@ post_TH(struct man *m)
/* TITLE MSEC ->DATE<- SOURCE VOL */
- if (NULL == (n = n->next))
- m->meta.date = time(NULL);
- else if (0 == (m->meta.date = man_atotime(n->string))) {
- if ( ! man_nwarn(m, n, WDATE))
- return(0);
+ n = n->next;
+ if (n) {
+ m->meta.date = mandoc_a2time
+ (MTIME_ISO_8601, n->string);
+
+ if (0 == m->meta.date) {
+ if ( ! man_nwarn(m, n, WDATE))
+ return(0);
+ m->meta.date = time(NULL);
+ }
+ } else
m->meta.date = time(NULL);
- }
/* TITLE MSEC DATE ->SOURCE<- VOL */
@@ -192,24 +195,3 @@ post_TH(struct man *m)
man_node_freelist(n);
return(1);
}
-
-
-static time_t
-man_atotime(const char *p)
-{
- struct tm tm;
- char *pp;
-
- memset(&tm, 0, sizeof(struct tm));
-
- if ((pp = strptime(p, "%b %d %Y", &tm)) && 0 == *pp)
- return(mktime(&tm));
- if ((pp = strptime(p, "%d %b %Y", &tm)) && 0 == *pp)
- return(mktime(&tm));
- if ((pp = strptime(p, "%b %d, %Y", &tm)) && 0 == *pp)
- return(mktime(&tm));
- if ((pp = strptime(p, "%b %Y", &tm)) && 0 == *pp)
- return(mktime(&tm));
-
- return(0);
-}
diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c
index 5d2b2a2c890..3e0b0f549fd 100644
--- a/usr.bin/mandoc/mandoc.c
+++ b/usr.bin/mandoc/mandoc.c
@@ -1,4 +1,4 @@
-/* $Id: mandoc.c,v 1.4 2009/12/22 23:58:00 schwarze Exp $ */
+/* $Id: mandoc.c,v 1.5 2009/12/23 22:30:17 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -21,9 +21,13 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <time.h>
#include "libmandoc.h"
+static int a2time(time_t *, const char *, const char *);
+
+
int
mandoc_special(const char *p)
{
@@ -163,3 +167,57 @@ mandoc_strdup(const char *ptr)
return(p);
}
+
+
+static int
+a2time(time_t *t, const char *fmt, const char *p)
+{
+ struct tm tm;
+ char *pp;
+
+ memset(&tm, 0, sizeof(struct tm));
+
+ pp = strptime(p, fmt, &tm);
+ if (NULL != pp && '\0' == *pp) {
+ *t = mktime(&tm);
+ return(1);
+ }
+
+ return(0);
+}
+
+
+/*
+ * Convert from a manual date string (see mdoc(7) and man(7)) into a
+ * date according to the stipulated date type.
+ */
+time_t
+mandoc_a2time(int flags, const char *p)
+{
+ time_t t;
+
+ if (MTIME_MDOCDATE & flags) {
+ if (0 == strcmp(p, "$" "Mdocdate$"))
+ return(time(NULL));
+ if (a2time(&t, "$" "Mdocdate: %b %d %Y $", p))
+ return(t);
+ }
+
+ if (MTIME_CANONICAL & flags || MTIME_REDUCED & flags)
+ if (a2time(&t, "%b %d, %Y", p))
+ return(t);
+
+ if (MTIME_ISO_8601 & flags)
+ if (a2time(&t, "%Y-%m-%d", p))
+ return(t);
+
+ if (MTIME_REDUCED & flags) {
+ if (a2time(&t, "%d, %Y", p))
+ return(t);
+ if (a2time(&t, "%Y", p))
+ return(t);
+ }
+
+ return(0);
+}
+
diff --git a/usr.bin/mandoc/mdoc.7 b/usr.bin/mandoc/mdoc.7
index 197e3dbe611..2705e8f4c19 100644
--- a/usr.bin/mandoc/mdoc.7
+++ b/usr.bin/mandoc/mdoc.7
@@ -1,4 +1,4 @@
-.\" $Id: mdoc.7,v 1.18 2009/10/27 21:40:07 schwarze Exp $
+.\" $Id: mdoc.7,v 1.19 2009/12/23 22:30:17 schwarze 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: October 27 2009 $
+.Dd $Mdocdate: December 23 2009 $
.Dt MDOC 7
.Os
.
@@ -212,9 +212,8 @@ In free-form mode, quotes are regarded as opaque text.
.Ss Dates
There are several macros in
.Nm
-that require a date argument. The
-.Em canonical form
-for dates is the American format:
+that require a date argument. The canonical form for dates is the
+American format:
.Pp
.D1 Cm Month Day , Year
.Pp
@@ -226,26 +225,16 @@ value is the full month name. The
.Cm Year
value is the full four-digit year.
.Pp
-The
-.Em non-canonical form
-is the same as the canonical form, but without the comma between the
-.Cm Day
-and
-.Cm Year
-field.
+Reduced form dates are broken-down canonical form dates:
.Pp
-Lastly,
-.Em reduced form
-dates range from only a
-.Cm Year
-to the full canonical or non-canonical form.
+.D1 Cm Month , Year
+.D1 Cm Year
.Pp
Some examples of valid dates follow:
.Pp
.D1 "May, 2009" Pq reduced form
.D1 "2009" Pq reduced form
.D1 "May 20, 2009" Pq canonical form
-.D1 "May 20 2009" Pq non-canonical form
.
.Ss Scaling Widths
Many macros support scaled widths for their arguments, such as
@@ -374,38 +363,185 @@ The sections in a
.Nm
document are conventionally ordered as they appear above. Sections
should be composed as follows:
-.Bl -tag -width Ds -offset Ds
-.It NAME
-Must contain at least one
+.Bl -ohang -offset Ds
+.It Em NAME
+The name(s) and a short description of the documented material. The
+syntax for this as follows:
+.Bd -literal -offset indent
+\&.Nm name0
+\&.Nm name1
+\&.Nm name2
+\&.Nd a short description
+.Ed
+.Pp
+The
.Sx \&Nm
-followed by
-.Sx \&Nd .
-The name needs re-stating since one
-.Nm
-documents can be used for more than one utility or function, such as
-.Xr grep 1
-also being referenced as
-.Xr egrep 1
-and
-.Xr fgrep 1 .
-.It LIBRARY
-.It SYNOPSIS
-.It DESCRIPTION
-.It IMPLEMENTATION NOTES
-.It EXIT STATUS
-.It RETURN VALUES
-.It ENVIRONMENT
-.It FILES
-.It EXAMPLES
-.It DIAGNOSTICS
-.It ERRORS
-.It SEE ALSO
-.It STANDARDS
-.It HISTORY
-.It AUTHORS
-.It CAVEATS
-.It BUGS
-.It SECURITY CONSIDERATIONS
+macro(s) must precede the
+.Sx \&Nd
+macro.
+.
+.It Em LIBRARY
+The name of the library containing the documented material, which is
+assumed to be a function in a section 2 or 3 manual. The syntax for
+this is as follows:
+.Bd -literal -offset indent
+\&.Lb libarm
+.Ed
+.Pp
+See
+.Sx \&Lb
+for details.
+.
+.It Em SYNOPSIS
+Documents the utility invocation syntax, function call syntax, or device
+configuration.
+.Pp
+For the first, utilities (sections 1, 6, and 8), this is
+generally structured as follows:
+.Bd -literal -offset indent
+\&.Nm foo
+\&.Op Fl v
+\&.Op Fl o Ar file
+\&.Op Ar
+\&.Nm bar
+\&.Op Fl v
+\&.Op Fl o Ar file
+\&.Op Ar
+.Ed
+.Pp
+For the second, function calls (sections 2, 3, 9):
+.Bd -literal -offset indent
+\&.Vt extern const char *global;
+\&.In header.h
+\&.Ft "char *"
+\&.Fn foo "const char *src"
+\&.Ft "char *"
+\&.Fn bar "const char *src"
+.Ed
+.Pp
+And for the third, configurations (section 4):
+.Bd -literal -offset indent
+\&.Cd \*qit* at isa? port 0x2e\*q
+\&.Cd \*qit* at isa? port 0x4e\*q
+.Ed
+.Pp
+Manuals not in these sections generally don't need a
+.Em SYNOPSIS .
+.
+.It Em DESCRIPTION
+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:
+.Bd -literal -offset indent
+The arguments are as follows:
+\&.Bl \-tag \-width Ds
+\&.It Fl v
+Print verbose information.
+\&.El
+.Ed
+Manuals not documenting a command won't include the above fragment.
+.
+.It Em IMPLEMENTATION NOTES
+Implementation-specific notes should be kept here. This is useful when
+implementing standard functions that may have side effects or notable
+algorithmic implications.
+.
+.It Em EXIT STATUS
+Command exit status for section 1, 6, and 8 manuals. This section is
+the dual of
+.Em RETURN VALUES ,
+which is used for functions. Historically, this information was
+described in
+.Em DIAGNOSTICS ,
+a practise that is now discouraged.
+.Pp
+See
+.Sx \&Ex .
+.
+.It Em RETURN VALUES
+This section is the dual of
+.Em EXIT STATUS ,
+which is used for commands. It documents the return values of functions
+in sections 2, 3, and 9.
+.Pp
+See
+.Sx \&Rv .
+.
+.It Em ENVIRONMENT
+Documents any usages of environment variables, e.g.,
+.Xr environ 7 .
+.Pp
+See
+.Sx \&Ev .
+.
+.It Em FILES
+Documents files used. It's helpful to document both the file and a
+short description of how the file is used (created, modified, etc.).
+.Pp
+See
+.Sx \&Pa .
+.
+.It Em EXAMPLES
+Example usages. This often contains snippets of well-formed,
+well-tested invocations. Make doubly sure that your examples work
+properly!
+.
+.It Em DIAGNOSTICS
+Documents error conditions. This is most useful in section 4 manuals.
+Historically, this section was used in place of
+.Em EXIT STATUS
+for manuals in sections 1, 6, and 8; however, this practise is
+discouraged.
+.Pp
+See
+.Sx \&Bl No \-diag .
+.
+.It Em ERRORS
+Documents error handling in sections 2, 3, and 9.
+.Pp
+See
+.Sx \&Er .
+.
+.It Em SEE ALSO
+References other manuals with related topics. This section should exist
+for most manuals. Cross-references should conventionally be ordered
+first by section, then alphabetically.
+.Pp
+See
+.Sx \&Xr .
+.
+.It Em STANDARDS
+References any standards implemented or used. If not adhering to any
+standards, the
+.Em HISTORY
+section should be used instead.
+.Pp
+See
+.Sx \&St .
+.
+.It Em HISTORY
+The history of any manual without a
+.Em STANDARDS
+section should be described in this section.
+.
+.It Em AUTHORS
+Credits to authors, if applicable, should appear in this section.
+Authors should generally be noted by both name and an e-mail address.
+.Pp
+See
+.Sx \&An .
+.
+.It Em CAVEATS
+Explanations of common misuses and misunderstandings should be explained
+in this section.
+.
+.It Em BUGS
+Extant bugs should be described in this section.
+.
+.It Em SECURITY CONSIDERATIONS
+Documents any security precautions that operators should consider.
+.
.El
.
.
@@ -710,10 +846,9 @@ this macro is not implemented in
.Ss \&%D
Publication date of an
.Sx \&Rs
-block. This should follow the reduced syntax for
+block. This should follow the reduced or canonical form syntax
+described in
.Sx Dates .
-Canonical or non-canonical form is not necessary since publications are
-often referenced only by year, or month and year.
.
.Ss \&%I
Publisher or issuer name of an
@@ -1152,9 +1287,10 @@ The
field may be either
.Ar $\&Mdocdate$ ,
which signifies the current manual revision date dictated by
-.Xr cvs 1
+.Xr cvs 1 ,
or instead a valid canonical date as specified by
.Sx Dates .
+If a date does not conform, the current date is used instead.
.Pp
Examples:
.Bd -literal -offset indent
@@ -1344,7 +1480,7 @@ See also
.Sx \&Er .
.
.Ss \&Dx
-Format the DragonFlyBSD version provided as an argument, or a default
+Format the DragonFly BSD version provided as an argument, or a default
value if no argument is provided.
.Pp
Examples:
diff --git a/usr.bin/mandoc/mdoc_action.c b/usr.bin/mandoc/mdoc_action.c
index 488faca4e26..5c9e1f30bd8 100644
--- a/usr.bin/mandoc/mdoc_action.c
+++ b/usr.bin/mandoc/mdoc_action.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_action.c,v 1.25 2009/12/22 23:58:00 schwarze Exp $ */
+/* $Id: mdoc_action.c,v 1.26 2009/12/23 22:30:17 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -814,8 +814,7 @@ post_ar(POST_ARGS)
/*
- * Parse the date field in `Dd', primarily through mdoc_atotime().
- * FIXME: push mdoc_atotime() into here.
+ * Parse the date field in `Dd'.
*/
static int
post_dd(POST_ARGS)
@@ -825,7 +824,9 @@ post_dd(POST_ARGS)
if ( ! concat(m, buf, n->child, DATESIZ))
return(0);
- m->meta.date = mdoc_atotime(buf);
+ m->meta.date = mandoc_a2time
+ (MTIME_MDOCDATE | MTIME_CANONICAL, buf);
+
if (0 == m->meta.date) {
if ( ! mdoc_nwarn(m, n, EBADDATE))
return(0);
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index d88ac8abb92..00081e370d1 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.3 2009/12/22 23:58:00 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.4 2009/12/23 22:30:17 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -805,7 +805,7 @@ mdoc_xx_pre(MDOC_ARGS)
pp = "BSDI BSD/OS";
break;
case (MDOC_Dx):
- pp = "DragonFlyBSD";
+ pp = "DragonFly";
break;
case (MDOC_Fx):
pp = "FreeBSD";
@@ -946,9 +946,10 @@ mdoc_it_head_pre(MDOC_ARGS, int type, struct roffsu *width)
switch (type) {
case (MDOC_Item):
- /* FALLTHROUGH */
- case (MDOC_Ohang):
return(0);
+ case (MDOC_Ohang):
+ print_otag(h, TAG_DIV, 0, &tag);
+ return(1);
case (MDOC_Column):
bufcat_su(h, "min-width", width);
bufcat_style(h, "clear", "none");
@@ -1062,6 +1063,8 @@ mdoc_it_pre(MDOC_ARGS)
/* Override width in some cases. */
switch (type) {
+ case (MDOC_Ohang):
+ /* FALLTHROUGH */
case (MDOC_Item):
/* FALLTHROUGH */
case (MDOC_Inset):
diff --git a/usr.bin/mandoc/mdoc_strings.c b/usr.bin/mandoc/mdoc_strings.c
index ca71d9e54da..d3ac448a797 100644
--- a/usr.bin/mandoc/mdoc_strings.c
+++ b/usr.bin/mandoc/mdoc_strings.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_strings.c,v 1.11 2009/12/22 23:58:00 schwarze Exp $ */
+/* $Id: mdoc_strings.c,v 1.12 2009/12/23 22:30:17 schwarze Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -121,28 +121,6 @@ mdoc_atosec(const char *p)
}
-time_t
-mdoc_atotime(const char *p)
-{
- struct tm tm;
- char *pp;
-
- memset(&tm, 0, sizeof(struct tm));
-
- if (0 == strcmp(p, "$" "Mdocdate$"))
- return(time(NULL));
- if ((pp = strptime(p, "$" "Mdocdate: %b %d %Y $", &tm)) && 0 == *pp)
- return(mktime(&tm));
- /* XXX - this matches "June 1999", which is wrong. */
- if ((pp = strptime(p, "%b %d %Y", &tm)) && 0 == *pp)
- return(mktime(&tm));
- if ((pp = strptime(p, "%b %d, %Y", &tm)) && 0 == *pp)
- return(mktime(&tm));
-
- return(0);
-}
-
-
/* FIXME: move this into an editable .in file. */
size_t
mdoc_macro2len(int macro)
diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c
index 2f33f448de5..9fa057c3b80 100644
--- a/usr.bin/mandoc/mdoc_term.c
+++ b/usr.bin/mandoc/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.63 2009/12/22 23:58:00 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.64 2009/12/23 22:30:17 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -1629,7 +1629,7 @@ termp_xx_pre(DECL_ARGS)
pp = "BSDI BSD/OS";
break;
case (MDOC_Dx):
- pp = "DragonFlyBSD";
+ pp = "DragonFly";
break;
case (MDOC_Fx):
pp = "FreeBSD";
diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c
index b2930f52e9f..d6919edc2d1 100644
--- a/usr.bin/mandoc/mdoc_validate.c
+++ b/usr.bin/mandoc/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.39 2009/12/22 23:58:00 schwarze Exp $ */
+/* $Id: mdoc_validate.c,v 1.40 2009/12/23 22:30:17 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -190,7 +190,7 @@ const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, posts_xr }, /* Xr */
{ NULL, posts_text }, /* %A */
{ NULL, posts_text }, /* %B */ /* FIXME: can be used outside Rs/Re. */
- { NULL, posts_text }, /* %D */
+ { NULL, posts_text }, /* %D */ /* FIXME: check date with mandoc_a2time(). */
{ NULL, posts_text }, /* %I */
{ NULL, posts_text }, /* %J */
{ NULL, posts_text }, /* %N */
@@ -661,6 +661,8 @@ pre_bl(PRE_ARGS)
/* FALLTHROUGH */
case (MDOC_Diag):
/* FALLTHROUGH */
+ case (MDOC_Ohang):
+ /* FALLTHROUGH */
case (MDOC_Inset):
/* FALLTHROUGH */
case (MDOC_Item):
@@ -802,6 +804,8 @@ static int
pre_dt(PRE_ARGS)
{
+ /* FIXME: make sure is capitalised. */
+
if (0 == mdoc->meta.date || mdoc->meta.os)
if ( ! mdoc_nwarn(mdoc, n, EPROLOOO))
return(0);