diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-05-23 20:57:17 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-05-23 20:57:17 +0000 |
commit | 686e61ea8828d99d0eb41bb989c07ae8ec7fe732 (patch) | |
tree | a3b988a0c8af687f912e33b3fe470d25a00b0d84 /usr.bin/mandoc | |
parent | 44cf86e784c10ab0504c7392c4d899ed1103c95f (diff) |
implement .AT and .UC; from Joerg Sonnenberger
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r-- | usr.bin/mandoc/man.7 | 17 | ||||
-rw-r--r-- | usr.bin/mandoc/man.c | 4 | ||||
-rw-r--r-- | usr.bin/mandoc/man.h | 5 | ||||
-rw-r--r-- | usr.bin/mandoc/man_action.c | 86 | ||||
-rw-r--r-- | usr.bin/mandoc/man_html.c | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/man_macro.c | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/man_term.c | 3 | ||||
-rw-r--r-- | usr.bin/mandoc/man_validate.c | 3 |
8 files changed, 109 insertions, 15 deletions
diff --git a/usr.bin/mandoc/man.7 b/usr.bin/mandoc/man.7 index 5ac1fb1a56e..2dfa5b9f2cc 100644 --- a/usr.bin/mandoc/man.7 +++ b/usr.bin/mandoc/man.7 @@ -1,4 +1,4 @@ -.\" $Id: man.7,v 1.24 2010/05/15 15:37:53 schwarze Exp $ +.\" $Id: man.7,v 1.25 2010/05/23 20:57:16 schwarze Exp $ .\" .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv> .\" @@ -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: May 15 2010 $ +.Dd $Mdocdate: May 23 2010 $ .Dt MAN 7 .Os .Sh NAME @@ -456,7 +456,7 @@ The syntax is as follows: .It Sx \&nf Ta 0 Ta current Ta compat .It Sx \&r Ta 0 Ta current Ta compat .It Sx \&sp Ta 1 Ta current Ta compat -.\" .It Sx \&Sp Ta 0 Ta current Ta compat +.\" .It Sx \&Sp Ta <1 Ta current Ta compat .\" .It Sx \&Vb Ta <1 Ta current Ta compat .\" .It Sx \&Ve Ta 0 Ta current Ta compat .El @@ -529,6 +529,11 @@ This section is a canonical reference to all macros, arranged alphabetically. For the scoping of individual macros, see .Sx MACRO SYNTAX . +.Ss \&AT +Sets the volume for the footer for compatibility with man pages from +.Tn AT&T UNIX +releases. +The optional arguments specify which release it is from. .Ss \&B Text is rendered in bold face. .Pp @@ -847,8 +852,10 @@ and .\" Has no effect. Included for compatibility. .\" . .\" . -.\" .Ss \&UC -.\" Has no effect. Included for compatibility. +.Ss \&UC +Sets the volume for the footer for compatibility with man pages from +BSD releases. +The optional first argument specifies which release it is from. .Ss \&br Breaks the current line. Consecutive invocations have no further effect. diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c index 377fb69e1d8..9ba57987721 100644 --- a/usr.bin/mandoc/man.c +++ b/usr.bin/mandoc/man.c @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.31 2010/05/20 00:58:02 schwarze Exp $ */ +/* $Id: man.c,v 1.32 2010/05/23 20:57:16 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -58,7 +58,7 @@ const char *const __man_macronames[MAN_MAX] = { "RI", "na", "i", "sp", "nf", "fi", "r", "RE", "RS", "DT", "UC", "PD", - "Sp", "Vb", "Ve", + "Sp", "Vb", "Ve", "AT", }; const char * const *man_macronames = __man_macronames; diff --git a/usr.bin/mandoc/man.h b/usr.bin/mandoc/man.h index 3d9d629bbed..756c3b558c9 100644 --- a/usr.bin/mandoc/man.h +++ b/usr.bin/mandoc/man.h @@ -1,4 +1,4 @@ -/* $Id: man.h,v 1.20 2010/05/20 00:58:02 schwarze Exp $ */ +/* $Id: man.h,v 1.21 2010/05/23 20:57:16 schwarze Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -55,7 +55,8 @@ enum mant { MAN_Sp, MAN_Vb, MAN_Ve, - MAN_MAX, + MAN_AT, + MAN_MAX }; enum man_type { diff --git a/usr.bin/mandoc/man_action.c b/usr.bin/mandoc/man_action.c index bf30fe6378a..da0fecc942a 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.18 2010/05/20 00:58:02 schwarze Exp $ */ +/* $Id: man_action.c,v 1.19 2010/05/23 20:57:16 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -29,6 +29,8 @@ struct actions { static int post_TH(struct man *); static int post_fi(struct man *); static int post_nf(struct man *); +static int post_AT(struct man *); +static int post_UC(struct man *); const struct actions man_actions[MAN_MAX] = { { NULL }, /* br */ @@ -61,11 +63,12 @@ const struct actions man_actions[MAN_MAX] = { { NULL }, /* RE */ { NULL }, /* RS */ { NULL }, /* DT */ - { NULL }, /* UC */ + { post_UC }, /* UC */ { NULL }, /* PD */ { NULL }, /* Sp */ { post_nf }, /* Vb */ { post_fi }, /* Ve */ + { post_AT }, /* AT */ }; @@ -177,3 +180,82 @@ post_TH(struct man *m) man_node_delete(m, m->last); return(1); } + + +static int +post_AT(struct man *m) +{ + static const char * const unix_versions[] = { + "7th Edition", + "System III", + "System V", + "System V Release 2", + }; + + const char *p, *s; + struct man_node *n, *nn; + + n = m->last->child; + + if (NULL == n || MAN_TEXT != n->type) + p = unix_versions[0]; + else { + s = n->string; + if (0 == strcmp(s, "3")) + p = unix_versions[0]; + else if (0 == strcmp(s, "4")) + p = unix_versions[1]; + else if (0 == strcmp(s, "5")) { + nn = n->next; + if (nn && MAN_TEXT == nn->type && nn->string[0]) + p = unix_versions[3]; + else + p = unix_versions[2]; + } else + p = unix_versions[0]; + } + + m->meta.source = mandoc_strdup(p); + + return(1); +} + + +static int +post_UC(struct man *m) +{ + static const char * const bsd_versions[] = { + "3rd Berkeley Distribution", + "4th Berkeley Distribution", + "4.2 Berkeley Distribution", + "4.3 Berkeley Distribution", + "4.4 Berkeley Distribution", + }; + + const char *p, *s; + struct man_node *n; + + n = m->last->child; + + if (NULL == n || MAN_TEXT != n->type) + p = bsd_versions[0]; + else { + s = n->string; + if (0 == strcmp(s, "3")) + p = bsd_versions[0]; + else if (0 == strcmp(s, "4")) + p = bsd_versions[1]; + else if (0 == strcmp(s, "5")) + p = bsd_versions[2]; + else if (0 == strcmp(s, "6")) + p = bsd_versions[3]; + else if (0 == strcmp(s, "7")) + p = bsd_versions[4]; + else + p = bsd_versions[0]; + } + + m->meta.source = mandoc_strdup(p); + + return(1); +} diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c index 2ca3471f540..83be5715f77 100644 --- a/usr.bin/mandoc/man_html.c +++ b/usr.bin/mandoc/man_html.c @@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.12 2010/05/20 00:58:02 schwarze Exp $ */ +/* $Id: man_html.c,v 1.13 2010/05/23 20:57:16 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -102,6 +102,7 @@ static const struct htmlman mans[MAN_MAX] = { { man_br_pre, NULL }, /* Sp */ { man_ign_pre, NULL }, /* Vb */ { NULL, NULL }, /* Ve */ + { man_ign_pre, NULL }, /* AT */ }; diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c index d1c8e7d8197..60063c5eb23 100644 --- a/usr.bin/mandoc/man_macro.c +++ b/usr.bin/mandoc/man_macro.c @@ -1,4 +1,4 @@ -/* $Id: man_macro.c,v 1.17 2010/05/20 00:58:02 schwarze Exp $ */ +/* $Id: man_macro.c,v 1.18 2010/05/23 20:57:16 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -77,6 +77,7 @@ const struct man_macro __man_macros[MAN_MAX] = { { in_line_eoln, MAN_NSCOPED }, /* Sp */ { in_line_eoln, 0 }, /* Vb */ { in_line_eoln, 0 }, /* Ve */ + { in_line_eoln, 0 }, /* AT */ }; const struct man_macro * const man_macros = __man_macros; diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c index 8711851ea31..ca9e0babaf2 100644 --- a/usr.bin/mandoc/man_term.c +++ b/usr.bin/mandoc/man_term.c @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.35 2010/05/20 00:58:02 schwarze Exp $ */ +/* $Id: man_term.c,v 1.36 2010/05/23 20:57:16 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -138,6 +138,7 @@ static const struct termact termacts[MAN_MAX] = { { pre_sp, NULL, MAN_NOTEXT }, /* Sp */ { pre_nf, NULL, 0 }, /* Vb */ { pre_fi, NULL, 0 }, /* Ve */ + { pre_ign, NULL, 0 }, /* AT */ }; diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c index f2bd0c9309a..20bc8c3d4a6 100644 --- a/usr.bin/mandoc/man_validate.c +++ b/usr.bin/mandoc/man_validate.c @@ -1,4 +1,4 @@ -/* $Id: man_validate.c,v 1.23 2010/05/20 00:58:02 schwarze Exp $ */ +/* $Id: man_validate.c,v 1.24 2010/05/23 20:57:16 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -91,6 +91,7 @@ static const struct man_valid man_valids[MAN_MAX] = { { NULL, posts_le1 }, /* Sp */ { pres_bline, posts_le1 }, /* Vb */ { pres_bline, posts_eq0 }, /* Ve */ + { NULL, NULL }, /* AT */ }; |