aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@netbsd.org>2010-05-17 10:50:32 +0000
committerJoerg Sonnenberger <joerg@netbsd.org>2010-05-17 10:50:32 +0000
commit17d79257b7f65d06055aadc7b86aa5157223bfa7 (patch)
treed19d926b1a7a609ae9f37a7e374c0ba4ccb27096
parent4032917dfb185b67f10a72c9c194bc2ce319a03c (diff)
downloadmandoc-17d79257b7f65d06055aadc7b86aa5157223bfa7.tar.gz
mandoc-17d79257b7f65d06055aadc7b86aa5157223bfa7.tar.zst
mandoc-17d79257b7f65d06055aadc7b86aa5157223bfa7.zip
Add support for .AT. Properly implement .UC. Add regress tests.
-rw-r--r--man.c4
-rw-r--r--man.h3
-rw-r--r--man_action.c86
-rw-r--r--man_html.c3
-rw-r--r--man_macro.c3
-rw-r--r--man_term.c3
-rw-r--r--man_validate.c3
-rw-r--r--regress/man/AT/AT-3.in5
-rw-r--r--regress/man/AT/AT-4.in5
-rw-r--r--regress/man/AT/AT-5-2.in7
-rw-r--r--regress/man/AT/AT-5.in5
-rw-r--r--regress/man/AT/AT-crap.in5
-rw-r--r--regress/man/AT/AT.in5
-rw-r--r--regress/man/UC/UC-3.in5
-rw-r--r--regress/man/UC/UC-4.in5
-rw-r--r--regress/man/UC/UC-5.in5
-rw-r--r--regress/man/UC/UC-6.in5
-rw-r--r--regress/man/UC/UC-7.in5
-rw-r--r--regress/man/UC/UC-crap.in5
-rw-r--r--regress/man/UC/UC.in5
20 files changed, 163 insertions, 9 deletions
diff --git a/man.c b/man.c
index 975a82f8..8c126056 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.72 2010/05/16 10:59:36 kristaps Exp $ */
+/* $Id: man.c,v 1.73 2010/05/17 10:50:32 joerg Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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;
diff --git a/man.h b/man.h
index 739cf8ba..a7822585 100644
--- a/man.h
+++ b/man.h
@@ -1,4 +1,4 @@
-/* $Id: man.h,v 1.33 2010/05/16 10:59:36 kristaps Exp $ */
+/* $Id: man.h,v 1.34 2010/05/17 10:50:32 joerg Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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 b0387189..140f360f 100644
--- a/man_action.c
+++ b/man_action.c
@@ -1,4 +1,4 @@
-/* $Id: man_action.c,v 1.34 2010/05/15 22:44:04 kristaps Exp $ */
+/* $Id: man_action.c,v 1.35 2010/05/17 10:50:32 joerg Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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);
+}
diff --git a/man_html.c b/man_html.c
index 3a6be4a9..5e06efa9 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.33 2010/05/15 22:44:04 kristaps Exp $ */
+/* $Id: man_html.c,v 1.34 2010/05/17 10:50:32 joerg Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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 c2e4bec0..27213c36 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -1,4 +1,4 @@
-/* $Id: man_macro.c,v 1.44 2010/05/15 22:44:04 kristaps Exp $ */
+/* $Id: man_macro.c,v 1.45 2010/05/17 10:50:32 joerg Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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;
diff --git a/man_term.c b/man_term.c
index 09229cbe..3bee92a5 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.69 2010/05/17 10:26:49 joerg Exp $ */
+/* $Id: man_term.c,v 1.70 2010/05/17 10:50:32 joerg Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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 ec9706f6..4a916314 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -1,4 +1,4 @@
-/* $Id: man_validate.c,v 1.39 2010/05/15 22:44:04 kristaps Exp $ */
+/* $Id: man_validate.c,v 1.40 2010/05/17 10:50:32 joerg Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -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