summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/mandoc.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/mandoc/mandoc.c')
-rw-r--r--usr.bin/mandoc/mandoc.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c
index a8c25a8ddba..4c1d763ac8c 100644
--- a/usr.bin/mandoc/mandoc.c
+++ b/usr.bin/mandoc/mandoc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mandoc.c,v 1.61 2015/08/29 22:39:59 schwarze Exp $ */
+/* $OpenBSD: mandoc.c,v 1.62 2015/10/06 18:30:43 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -81,7 +81,7 @@ mandoc_escape(const char **end, const char **start, int *sz)
break;
case 'C':
if ('\'' != **start)
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
*start = ++*end;
gly = ESCAPE_SPECIAL;
term = '\'';
@@ -97,7 +97,7 @@ mandoc_escape(const char **end, const char **start, int *sz)
case ',':
/* FALLTHROUGH */
case '/':
- return(ESCAPE_IGNORE);
+ return ESCAPE_IGNORE;
/*
* The \z escape is supposed to output the following
@@ -106,7 +106,7 @@ mandoc_escape(const char **end, const char **start, int *sz)
* let us just skip the next character.
*/
case 'z':
- return(ESCAPE_SKIPCHAR);
+ return ESCAPE_SKIPCHAR;
/*
* Handle all triggers matching \X(xy, \Xx, and \X[xxxx], where
@@ -167,7 +167,7 @@ mandoc_escape(const char **end, const char **start, int *sz)
/* FALLTHROUGH */
case 'o':
if (**start == '\0')
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
if (gly == ESCAPE_ERROR)
gly = ESCAPE_OVERSTRIKE;
term = **start;
@@ -194,7 +194,7 @@ mandoc_escape(const char **end, const char **start, int *sz)
if (strchr(" %&()*+-./0123456789:<=>", **start)) {
if ('\0' != **start)
++*end;
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
}
gly = ESCAPE_IGNORE;
term = **start;
@@ -207,11 +207,11 @@ mandoc_escape(const char **end, const char **start, int *sz)
*/
case 'N':
if ('\0' == **start)
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
(*end)++;
if (isdigit((unsigned char)**start)) {
*sz = 1;
- return(ESCAPE_IGNORE);
+ return ESCAPE_IGNORE;
}
(*start)++;
while (isdigit((unsigned char)**end))
@@ -219,7 +219,7 @@ mandoc_escape(const char **end, const char **start, int *sz)
*sz = *end - *start;
if ('\0' != **end)
(*end)++;
- return(ESCAPE_NUMBERED);
+ return ESCAPE_NUMBERED;
/*
* Sizes get a special category of their own.
@@ -281,12 +281,12 @@ mandoc_escape(const char **end, const char **start, int *sz)
while (**end != term) {
switch (**end) {
case '\0':
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
case '\\':
(*end)++;
if (ESCAPE_ERROR ==
mandoc_escape(end, NULL, NULL))
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
break;
default:
(*end)++;
@@ -297,7 +297,7 @@ mandoc_escape(const char **end, const char **start, int *sz)
} else {
assert(*sz > 0);
if ((size_t)*sz > strlen(*start))
- return(ESCAPE_ERROR);
+ return ESCAPE_ERROR;
*end += *sz;
}
@@ -365,7 +365,7 @@ mandoc_escape(const char **end, const char **start, int *sz)
break;
}
- return(gly);
+ return gly;
}
/*
@@ -460,7 +460,7 @@ mandoc_getarg(struct mparse *parse, char **cpp, int ln, int *pos)
if ('\0' == *cp && (white || ' ' == cp[-1]))
mandoc_msg(MANDOCERR_SPACE_EOL, parse, ln, *pos, NULL);
- return(start);
+ return start;
}
static int
@@ -474,10 +474,10 @@ a2time(time_t *t, const char *fmt, const char *p)
pp = strptime(p, fmt, &tm);
if (NULL != pp && '\0' == *pp) {
*t = mktime(&tm);
- return(1);
+ return 1;
}
- return(0);
+ return 0;
}
static char *
@@ -490,7 +490,7 @@ time2a(time_t t)
tm = localtime(&t);
if (tm == NULL)
- return(NULL);
+ return NULL;
/*
* Reserve space:
@@ -510,11 +510,11 @@ time2a(time_t t)
if (0 == strftime(p, 4 + 1, "%Y", tm))
goto fail;
- return(buf);
+ return buf;
fail:
free(buf);
- return(NULL);
+ return NULL;
}
char *
@@ -536,7 +536,7 @@ mandoc_normdate(struct mparse *parse, char *in, int ln, int pos)
t = 0;
}
out = t ? time2a(t) : NULL;
- return(out ? out : mandoc_strdup(in));
+ return out ? out : mandoc_strdup(in);
}
int
@@ -546,7 +546,7 @@ mandoc_eos(const char *p, size_t sz)
int enclosed, found;
if (0 == sz)
- return(0);
+ return 0;
/*
* End-of-sentence recognition must include situations where
@@ -575,11 +575,12 @@ mandoc_eos(const char *p, size_t sz)
found = 1;
break;
default:
- return(found && (!enclosed || isalnum((unsigned char)*q)));
+ return found &&
+ (!enclosed || isalnum((unsigned char)*q));
}
}
- return(found && !enclosed);
+ return found && !enclosed;
}
/*
@@ -594,7 +595,7 @@ mandoc_strntoi(const char *p, size_t sz, int base)
long v;
if (sz > 31)
- return(-1);
+ return -1;
memcpy(buf, p, sz);
buf[(int)sz] = '\0';
@@ -603,12 +604,12 @@ mandoc_strntoi(const char *p, size_t sz, int base)
v = strtol(buf, &ep, base);
if (buf[0] == '\0' || *ep != '\0')
- return(-1);
+ return -1;
if (v > INT_MAX)
v = INT_MAX;
if (v < INT_MIN)
v = INT_MIN;
- return((int)v);
+ return (int)v;
}