diff options
author | Joerg Sonnenberger <joerg@netbsd.org> | 2010-05-17 10:50:32 +0000 |
---|---|---|
committer | Joerg Sonnenberger <joerg@netbsd.org> | 2010-05-17 10:50:32 +0000 |
commit | cd208154160c314b92ccdae3cea9a52982cd7c65 (patch) | |
tree | ee80635d271cdff276deb89dbf4eb8f40e9b7b30 | |
parent | 2d627d830fbf25aceab34e2105f73213f8294fd2 (diff) | |
download | mandoc-cd208154160c314b92ccdae3cea9a52982cd7c65.tar.gz |
Add support for .AT. Properly implement .UC. Add regress tests.
-rw-r--r-- | man.c | 2 | ||||
-rw-r--r-- | man.h | 1 | ||||
-rw-r--r-- | man_action.c | 84 | ||||
-rw-r--r-- | man_html.c | 1 | ||||
-rw-r--r-- | man_macro.c | 1 | ||||
-rw-r--r-- | man_term.c | 1 | ||||
-rw-r--r-- | man_validate.c | 1 | ||||
-rw-r--r-- | regress/man/AT/AT-3.in | 5 | ||||
-rw-r--r-- | regress/man/AT/AT-4.in | 5 | ||||
-rw-r--r-- | regress/man/AT/AT-5-2.in | 7 | ||||
-rw-r--r-- | regress/man/AT/AT-5.in | 5 | ||||
-rw-r--r-- | regress/man/AT/AT-crap.in | 5 | ||||
-rw-r--r-- | regress/man/AT/AT.in | 5 | ||||
-rw-r--r-- | regress/man/UC/UC-3.in | 5 | ||||
-rw-r--r-- | regress/man/UC/UC-4.in | 5 | ||||
-rw-r--r-- | regress/man/UC/UC-5.in | 5 | ||||
-rw-r--r-- | regress/man/UC/UC-6.in | 5 | ||||
-rw-r--r-- | regress/man/UC/UC-7.in | 5 | ||||
-rw-r--r-- | regress/man/UC/UC-crap.in | 5 | ||||
-rw-r--r-- | regress/man/UC/UC.in | 5 |
20 files changed, 156 insertions, 2 deletions
@@ -62,7 +62,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; @@ -55,6 +55,7 @@ enum mant { MAN_Sp, MAN_Vb, MAN_Ve, + MAN_AT, MAN_MAX }; diff --git a/man_action.c b/man_action.c index cf3e0e1b..ffa2b943 100644 --- a/man_action.c +++ b/man_action.c @@ -32,6 +32,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 */ @@ -64,11 +66,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 */ }; @@ -180,3 +183,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); +} @@ -106,6 +106,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/man_macro.c b/man_macro.c index 4a65a66b..a3394a11 100644 --- a/man_macro.c +++ b/man_macro.c @@ -81,6 +81,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; @@ -142,6 +142,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/man_validate.c b/man_validate.c index 4e250973..1bc128a0 100644 --- a/man_validate.c +++ b/man_validate.c @@ -95,6 +95,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 */ }; diff --git a/regress/man/AT/AT-3.in b/regress/man/AT/AT-3.in new file mode 100644 index 00000000..1c3d6cdd --- /dev/null +++ b/regress/man/AT/AT-3.in @@ -0,0 +1,5 @@ +.TH AT-3 1 "2010-05-17" "MANDOC" +.AT 3 +.SH DESCRIPTION +.SS Test case for AT +foo diff --git a/regress/man/AT/AT-4.in b/regress/man/AT/AT-4.in new file mode 100644 index 00000000..812128c7 --- /dev/null +++ b/regress/man/AT/AT-4.in @@ -0,0 +1,5 @@ +.TH AT-4 1 "2010-05-17" "MANDOC" +.AT 4 +.SH DESCRIPTION +.SS Test case for AT +foo diff --git a/regress/man/AT/AT-5-2.in b/regress/man/AT/AT-5-2.in new file mode 100644 index 00000000..6cd5a5b2 --- /dev/null +++ b/regress/man/AT/AT-5-2.in @@ -0,0 +1,7 @@ +.TH AT-5-2 1 "2010-05-17" "MANDOC" +.SH TEST FOR VSPACE +.AT 5 2 +.SH DESCRIPTION +.SS foo +.SS Test case for AT +foo diff --git a/regress/man/AT/AT-5.in b/regress/man/AT/AT-5.in new file mode 100644 index 00000000..aaf9843e --- /dev/null +++ b/regress/man/AT/AT-5.in @@ -0,0 +1,5 @@ +.TH AT-5 1 "2010-05-17" "MANDOC" +.AT 5 +.SH DESCRIPTION +.SS Test case for AT +foo diff --git a/regress/man/AT/AT-crap.in b/regress/man/AT/AT-crap.in new file mode 100644 index 00000000..d0adb923 --- /dev/null +++ b/regress/man/AT/AT-crap.in @@ -0,0 +1,5 @@ +.TH AT-CRAP 1 "2010-05-17" "MANDOC" +.AT crap +.SH DESCRIPTION +.SS Test case for AT +foo diff --git a/regress/man/AT/AT.in b/regress/man/AT/AT.in new file mode 100644 index 00000000..733c3e73 --- /dev/null +++ b/regress/man/AT/AT.in @@ -0,0 +1,5 @@ +.TH AT 1 "2010-05-17" "MANDOC" +.AT +.SH DESCRIPTION +.SS Test case for AT +foo diff --git a/regress/man/UC/UC-3.in b/regress/man/UC/UC-3.in new file mode 100644 index 00000000..7723a419 --- /dev/null +++ b/regress/man/UC/UC-3.in @@ -0,0 +1,5 @@ +.TH UC-3 1 "2010-05-17" "MANDOC" +.UC 3 +.SH DESCRIPTION +.SS Test case for UC +foo diff --git a/regress/man/UC/UC-4.in b/regress/man/UC/UC-4.in new file mode 100644 index 00000000..515258ce --- /dev/null +++ b/regress/man/UC/UC-4.in @@ -0,0 +1,5 @@ +.TH UC-4 1 "2010-05-17" "MANDOC" +.UC 4 +.SH DESCRIPTION +.SS Test case for UC +foo diff --git a/regress/man/UC/UC-5.in b/regress/man/UC/UC-5.in new file mode 100644 index 00000000..71f977dd --- /dev/null +++ b/regress/man/UC/UC-5.in @@ -0,0 +1,5 @@ +.TH UC-5 1 "2010-05-17" "MANDOC" +.UC 5 +.SH DESCRIPTION +.SS Test case for UC +foo diff --git a/regress/man/UC/UC-6.in b/regress/man/UC/UC-6.in new file mode 100644 index 00000000..9ea4b8cb --- /dev/null +++ b/regress/man/UC/UC-6.in @@ -0,0 +1,5 @@ +.TH UC-6 1 "2010-05-17" "MANDOC" +.UC 6 +.SH DESCRIPTION +.SS Test case for UC +foo diff --git a/regress/man/UC/UC-7.in b/regress/man/UC/UC-7.in new file mode 100644 index 00000000..e13f070e --- /dev/null +++ b/regress/man/UC/UC-7.in @@ -0,0 +1,5 @@ +.TH UC-7 1 "2010-05-17" "MANDOC" +.UC 7 +.SH DESCRIPTION +.SS Test case for UC +foo diff --git a/regress/man/UC/UC-crap.in b/regress/man/UC/UC-crap.in new file mode 100644 index 00000000..9d944e79 --- /dev/null +++ b/regress/man/UC/UC-crap.in @@ -0,0 +1,5 @@ +.TH UC-CRAP 1 "2010-05-17" "MANDOC" +.UC crap +.SH DESCRIPTION +.SS Test case for UC +foo diff --git a/regress/man/UC/UC.in b/regress/man/UC/UC.in new file mode 100644 index 00000000..5ea65e82 --- /dev/null +++ b/regress/man/UC/UC.in @@ -0,0 +1,5 @@ +.TH UC 1 "2010-05-17" "MANDOC" +.UC +.SH DESCRIPTION +.SS Test case for UC +foo |