aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2008-12-07 14:38:57 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2008-12-07 14:38:57 +0000
commitf4797a3b5c98a4a87c333409e15ed2ad5478e8b8 (patch)
treefceccfb6dcf8a87f64ea75312c0515570a092f78
parent413c1bdf1af371c4a4703381a78f68045d85b2fe (diff)
downloadmandoc-f4797a3b5c98a4a87c333409e15ed2ad5478e8b8.tar.gz
mandoc-f4797a3b5c98a4a87c333409e15ed2ad5478e8b8.tar.zst
mandoc-f4797a3b5c98a4a87c333409e15ed2ad5478e8b8.zip
*** empty log message ***
-rw-r--r--Makefile5
-rw-r--r--mlg.c46
-rw-r--r--roff.c17
-rw-r--r--roff.h4
4 files changed, 48 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index e46ec8f9..b9bdef4c 100644
--- a/Makefile
+++ b/Makefile
@@ -22,12 +22,13 @@ INSTALL = Makefile $(HEADS) $(SRCS) $(MANS)
FAIL = test.0 test.1 test.2 test.3 test.4 test.5 test.6 \
test.15 test.20 test.22 test.24 test.26 test.27 test.30 \
- test.36 test.37 test.40
+ test.36 test.37 test.40 test.50
SUCCEED = test.7 test.8 test.9 test.10 test.11 test.12 test.13 \
test.14 test.16 test.17 test.18 test.19 test.21 test.23 \
test.25 test.28 test.29 test.31 test.32 test.33 test.34 \
- test.35 test.38 test.39 test.41
+ test.35 test.38 test.39 test.41 test.42 test.43 test.44 \
+ test.45 test.46 test.47 test.48 test.49 test.51 test.52
all: mdocml
diff --git a/mlg.c b/mlg.c
index 0adc40c8..db38ca00 100644
--- a/mlg.c
+++ b/mlg.c
@@ -1,4 +1,4 @@
-/* $Id: mlg.c,v 1.16 2008/12/06 21:10:31 kristaps Exp $ */
+/* $Id: mlg.c,v 1.17 2008/12/07 14:38:57 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -62,6 +62,7 @@ struct md_mlg {
static char *mlg_literal(int);
static char *mlg_At_literal(const char *);
+static char *mlg_fmt(int);
static char *mlg_St_literal(int);
static void mlg_roffmsg(void *arg, enum roffmsg,
const char *, const char *, char *);
@@ -200,6 +201,7 @@ mlg_St_literal(int argc)
static char *
mlg_At_literal(const char *p)
{
+
if (NULL == p)
return("AT&amp;T UNIX");
if (0 == strcmp(p, "v6"))
@@ -219,8 +221,32 @@ mlg_At_literal(const char *p)
static char *
+mlg_fmt(int tok)
+{
+
+ switch (tok) {
+ case (ROFF_Ex):
+ return ("The %s utility exits 0 on success, and "
+ "&gt;0 if an error occurs.");
+ case (ROFF_Rv):
+ return ("The %s() function returns the value 0 if "
+ "successful; otherwise the value -1 "
+ "is returned and the global variable "
+ "<span class=\"inline-Va\">errno</span> "
+ "is set to indicate the error.");
+ default:
+ break;
+ }
+
+ abort();
+ /* NOTREACHED */
+}
+
+
+static char *
mlg_literal(int tok)
{
+
switch (tok) {
case (ROFF_Bt):
return("is currently in beta test.");
@@ -564,6 +590,7 @@ mlg_roffspecial(void *arg, int tok, const char *start,
const int *argc, const char **argv, char **more)
{
struct md_mlg *p;
+ char buf[256];
assert(arg);
p = (struct md_mlg *)arg;
@@ -633,19 +660,14 @@ mlg_roffspecial(void *arg, int tok, const char *start,
return(0);
assert(NULL == *more);
break;
+
case (ROFF_Ex):
+ /* NOTREACHED */
+ case (ROFF_Rv):
assert(*more);
- if ( ! ml_puts(p->mbuf, "The ", &p->pos))
- return(0);
- if ( ! mlg_begintag(p, MD_NS_INLINE, ROFF_Xr, NULL, NULL))
- return(0);
- if ( ! ml_puts(p->mbuf, *more++, &p->pos))
- return(0);
- if ( ! mlg_endtag(p, MD_NS_INLINE, ROFF_Xr))
- return(0);
- if ( ! ml_puts(p->mbuf, " utility exits 0 on success, "
- "and &gt;0 if an error "
- "occurs.", &p->pos))
+ (void)snprintf(buf, sizeof(buf),
+ mlg_fmt(tok), *more++);
+ if ( ! ml_puts(p->mbuf, buf, &p->pos))
return(0);
assert(NULL == *more);
break;
diff --git a/roff.c b/roff.c
index 42075b02..b75b0dc2 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.47 2008/12/06 21:10:31 kristaps Exp $ */
+/* $Id: roff.c,v 1.48 2008/12/07 14:38:57 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -653,15 +653,16 @@ roffspecial(struct rofftree *tree, int tok, const char *start,
return(0);
break;
+ case (ROFF_Rv):
+ /* FALLTHROUGH*/
case (ROFF_Sx):
/* FALLTHROUGH*/
case (ROFF_Ex):
- if (1 != sz) {
- roff_err(tree, start, "`%s' expects one arg",
- toknames[tok]);
- return(0);
- }
- break;
+ if (1 == sz)
+ break;
+ roff_err(tree, start, "`%s' expects one arg",
+ toknames[tok]);
+ return(0);
case (ROFF_Sm):
if (1 != sz) {
@@ -841,7 +842,7 @@ roff_Dd(ROFFCALL_ARGS)
argv++;
- if (0 == strcmp(*argv, "$Mdocdate: December 6 2008 $")) {
+ if (0 == strcmp(*argv, "$Mdocdate: December 7 2008 $")) {
t = time(NULL);
if (NULL == localtime_r(&t, &tree->tm))
err(1, "localtime_r");
diff --git a/roff.h b/roff.h
index 5f3da638..e68a4f93 100644
--- a/roff.h
+++ b/roff.h
@@ -1,4 +1,4 @@
-/* $Id: roff.h,v 1.5 2008/12/06 21:10:31 kristaps Exp $ */
+/* $Id: roff.h,v 1.6 2008/12/07 14:38:57 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -132,7 +132,7 @@ static const struct rofftok tokens[ROFF_MAX] = {
{ roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE | ROFF_LSCOPE }, /* Op */
{ roff_depr, NULL, NULL, NULL, 0, ROFF_TEXT, 0 }, /* Ot */
{ roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* Pa */
- { roff_text, roffarg_Rv, NULL, NULL, 0, ROFF_TEXT, 0 }, /* Rv */
+/*Ok*/ {roff_ordered, roffarg_Rv, NULL, NULL, 0, ROFF_TEXT, 0 }, /* Rv */
/*Ok*/ {roff_ordered, roffarg_St, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* St */
/*Ok*/ { roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* Va */
/*Ok*/ { roff_text, NULL, NULL, NULL, 0, ROFF_TEXT, ROFF_PARSED | ROFF_CALLABLE }, /* Vt */ /* FIXME: section/linebreak. */