summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.sgml8
-rw-r--r--libmdoc.h3
-rw-r--r--man.c9
-rw-r--r--man_hash.c2
-rw-r--r--mdoc.c20
-rw-r--r--mdoc_action.c8
-rw-r--r--mdoc_argv.c25
-rw-r--r--mdoc_hash.c2
-rw-r--r--mdoc_macro.c6
-rw-r--r--mdoc_strings.c2
-rw-r--r--mdoc_validate.c2
11 files changed, 46 insertions, 41 deletions
diff --git a/index.sgml b/index.sgml
index d8415170..20515633 100644
--- a/index.sgml
+++ b/index.sgml
@@ -219,11 +219,11 @@
<COL CLASS="date">
<TBODY>
<TR>
- <TD VALIGN="top"><SPAN CLASS="date">xx-05-2010</SPAN></TD>
+ <TD VALIGN="top"><SPAN CLASS="date">XX-XX-2010</SPAN></TD>
<TD VALIGN="top">
- Clean-up in internal <SPAN CLASS="flag">-mdoc</SPAN> library. Rolled back
- break-at-hyphen (broken). <SPAN CLASS="flag">-DUGLY</SPAN> is now the default
- (why not).
+ Rolled back break-at-hyphen (broken). <SPAN CLASS="flag">-DUGLY</SPAN> is now
+ the default (I don't like feature splits). Free-form text is not de-chunked any
+ more: lines are passed whole-sale into the front-end, including whitespace.
Version: <SPAN CLASS="rev">1.9.24</SPAN>.
</TD>
</TR>
diff --git a/libmdoc.h b/libmdoc.h
index 4b5ced27..18054313 100644
--- a/libmdoc.h
+++ b/libmdoc.h
@@ -163,8 +163,7 @@ int mdoc_isdelim(const char *);
size_t mdoc_isescape(const char *);
enum mdoc_sec mdoc_atosec(const char *);
time_t mdoc_atotime(const char *);
-
-size_t mdoc_macro2len(int);
+size_t mdoc_macro2len(enum mdoct);
const char *mdoc_a2att(const char *);
const char *mdoc_a2lib(const char *);
const char *mdoc_a2st(const char *);
diff --git a/man.c b/man.c
index b83684f3..828698d7 100644
--- a/man.c
+++ b/man.c
@@ -435,8 +435,7 @@ static int
macrowarn(struct man *m, int ln, const char *buf)
{
if ( ! (MAN_IGN_MACRO & m->pflags))
- return(man_verr(m, ln, 0,
- "unknown macro: %s%s",
+ return(man_verr(m, ln, 0, "unknown macro: %s%s",
buf, strlen(buf) > 3 ? "..." : ""));
return(man_vwarn(m, ln, 0, "unknown macro: %s%s",
buf, strlen(buf) > 3 ? "..." : ""));
@@ -462,6 +461,7 @@ man_pmacro(struct man *m, int ln, char *buf)
* Skip whitespace between the control character and initial
* text. "Whitespace" is both spaces and tabs.
*/
+
if (' ' == buf[i] || '\t' == buf[i]) {
i++;
while (buf[i] && (' ' == buf[i] || '\t' == buf[i]))
@@ -510,7 +510,10 @@ man_pmacro(struct man *m, int ln, char *buf)
while (buf[i] && ' ' == buf[i])
i++;
- /* Trailing whitespace? */
+ /*
+ * Trailing whitespace. Note that tabs are allowed to be passed
+ * into the parser as "text", so we only warn about spaces here.
+ */
if ('\0' == buf[i] && ' ' == buf[i - 1])
if ( ! man_pwarn(m, ln, i - 1, WTSPACE))
diff --git a/man_hash.c b/man_hash.c
index b3d33156..dc81b161 100644
--- a/man_hash.c
+++ b/man_hash.c
@@ -63,7 +63,7 @@ man_hash_init(void)
assert(/* LINTED */
MAN_MAX < UCHAR_MAX);
- for (i = 0; i < MAN_MAX; i++) {
+ for (i = 0; i < (int)MAN_MAX; i++) {
x = man_macronames[i][0];
assert(isalpha((u_char)x) || '.' == x);
diff --git a/mdoc.c b/mdoc.c
index f5e9ab7d..9bb391a2 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -542,7 +542,7 @@ mdoc_word_alloc(struct mdoc *m, int line, int pos, const char *p)
len = strlen(p);
- n = node_alloc(m, line, pos, -1, MDOC_TEXT);
+ n = node_alloc(m, line, pos, MDOC_MAX, MDOC_TEXT);
n->string = mandoc_malloc(len + 1);
sv = strlcpy(n->string, p, len + 1);
@@ -681,13 +681,11 @@ mdoc_ptext(struct mdoc *m, int line, char *buf)
}
-
static int
macrowarn(struct mdoc *m, int ln, const char *buf)
{
if ( ! (MDOC_IGN_MACRO & m->pflags))
- return(mdoc_verr(m, ln, 0,
- "unknown macro: %s%s",
+ return(mdoc_verr(m, ln, 0, "unknown macro: %s%s",
buf, strlen(buf) > 3 ? "..." : ""));
return(mdoc_vwarn(m, ln, 0, "unknown macro: %s%s",
buf, strlen(buf) > 3 ? "..." : ""));
@@ -701,8 +699,9 @@ macrowarn(struct mdoc *m, int ln, const char *buf)
int
mdoc_pmacro(struct mdoc *m, int ln, char *buf)
{
- int i, j, c;
- char mac[5];
+ enum mdoct tok;
+ int i, j;
+ char mac[5];
/* Empty lines are ignored. */
@@ -744,7 +743,7 @@ mdoc_pmacro(struct mdoc *m, int ln, char *buf)
return(1);
}
- if (MDOC_MAX == (c = mdoc_hash_find(mac))) {
+ if (MDOC_MAX == (tok = mdoc_hash_find(mac))) {
if ( ! macrowarn(m, ln, mac))
goto err;
return(1);
@@ -755,7 +754,10 @@ mdoc_pmacro(struct mdoc *m, int ln, char *buf)
while (buf[i] && ' ' == buf[i])
i++;
- /* Trailing whitespace? */
+ /*
+ * Trailing whitespace. Note that tabs are allowed to be passed
+ * into the parser as "text", so we only warn about spaces here.
+ */
if ('\0' == buf[i] && ' ' == buf[i - 1])
if ( ! mdoc_pwarn(m, ln, i - 1, ETAILWS))
@@ -765,7 +767,7 @@ mdoc_pmacro(struct mdoc *m, int ln, char *buf)
* Begin recursive parse sequence. Since we're at the start of
* the line, we don't need to do callable/parseable checks.
*/
- if ( ! mdoc_macro(m, c, ln, 1, &i, buf))
+ if ( ! mdoc_macro(m, tok, ln, 1, &i, buf))
goto err;
return(1);
diff --git a/mdoc_action.c b/mdoc_action.c
index c2985f85..63e25cd8 100644
--- a/mdoc_action.c
+++ b/mdoc_action.c
@@ -44,7 +44,7 @@ struct actions {
static int concat(struct mdoc *, char *,
const struct mdoc_node *, size_t);
-static inline int order_rs(int);
+static inline int order_rs(enum mdoct);
static int post_ar(POST_ARGS);
static int post_at(POST_ARGS);
@@ -196,7 +196,7 @@ static const struct actions mdoc_actions[MDOC_MAX] = {
#define RSORD_MAX 14
-static const int rsord[RSORD_MAX] = {
+static const enum mdoct rsord[RSORD_MAX] = {
MDOC__A,
MDOC__T,
MDOC__B,
@@ -945,11 +945,11 @@ post_display(POST_ARGS)
static inline int
-order_rs(int t)
+order_rs(enum mdoct t)
{
int i;
- for (i = 0; i < RSORD_MAX; i++)
+ for (i = 0; i < (int)RSORD_MAX; i++)
if (rsord[i] == t)
return(i);
diff --git a/mdoc_argv.c b/mdoc_argv.c
index 5519d07f..40237f20 100644
--- a/mdoc_argv.c
+++ b/mdoc_argv.c
@@ -666,16 +666,16 @@ static int
argv_multi(struct mdoc *m, int line,
struct mdoc_argv *v, int *pos, char *buf)
{
- int c;
+ enum margserr ac;
char *p;
for (v->sz = 0; ; v->sz++) {
if ('-' == buf[*pos])
break;
- c = args(m, line, pos, buf, 0, &p);
- if (ARGS_ERROR == c)
+ ac = args(m, line, pos, buf, 0, &p);
+ if (ARGS_ERROR == ac)
return(0);
- else if (ARGS_EOLN == c)
+ else if (ARGS_EOLN == ac)
break;
if (0 == v->sz % MULTI_STEP)
@@ -693,16 +693,16 @@ static int
argv_opt_single(struct mdoc *m, int line,
struct mdoc_argv *v, int *pos, char *buf)
{
- int c;
+ enum margserr ac;
char *p;
if ('-' == buf[*pos])
return(1);
- c = args(m, line, pos, buf, 0, &p);
- if (ARGS_ERROR == c)
+ ac = args(m, line, pos, buf, 0, &p);
+ if (ARGS_ERROR == ac)
return(0);
- if (ARGS_EOLN == c)
+ if (ARGS_EOLN == ac)
return(1);
v->sz = 1;
@@ -720,15 +720,16 @@ static int
argv_single(struct mdoc *m, int line,
struct mdoc_argv *v, int *pos, char *buf)
{
- int c, ppos;
+ int ppos;
+ enum margserr ac;
char *p;
ppos = *pos;
- c = args(m, line, pos, buf, 0, &p);
- if (ARGS_ERROR == c)
+ ac = args(m, line, pos, buf, 0, &p);
+ if (ARGS_ERROR == ac)
return(0);
- if (ARGS_EOLN == c)
+ if (ARGS_EOLN == ac)
return(mdoc_perr(m, line, ppos, EARGVAL));
v->sz = 1;
diff --git a/mdoc_hash.c b/mdoc_hash.c
index ce9e3ce3..216f721c 100644
--- a/mdoc_hash.c
+++ b/mdoc_hash.c
@@ -43,7 +43,7 @@ mdoc_hash_init(void)
memset(table, UCHAR_MAX, sizeof(table));
- for (i = 0; i < MDOC_MAX; i++) {
+ for (i = 0; i < (int)MDOC_MAX; i++) {
p = mdoc_macronames[i];
if (isalpha((u_char)p[1]))
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 8bde22e5..414f284e 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -45,7 +45,7 @@ static int obsolete(MACRO_PROT_ARGS);
static int append_delims(struct mdoc *,
int, int *, char *);
-static enum mdoct lookup(int, const char *);
+static enum mdoct lookup(enum mdoct, const char *);
static enum mdoct lookup_raw(const char *);
static int phrase(struct mdoc *, int, int, char *);
static enum mdoct rew_alt(enum mdoct);
@@ -267,7 +267,7 @@ mdoc_macroend(struct mdoc *m)
* Look up a macro from within a subsequent context.
*/
static enum mdoct
-lookup(int from, const char *p)
+lookup(enum mdoct from, const char *p)
{
/* FIXME: make -diag lists be un-PARSED. */
@@ -283,7 +283,7 @@ lookup(int from, const char *p)
static enum mdoct
lookup_raw(const char *p)
{
- int res;
+ enum mdoct res;
if (MDOC_MAX == (res = mdoc_hash_find(p)))
return(MDOC_MAX);
diff --git a/mdoc_strings.c b/mdoc_strings.c
index 601960e2..0b1847fd 100644
--- a/mdoc_strings.c
+++ b/mdoc_strings.c
@@ -127,7 +127,7 @@ mdoc_atosec(const char *p)
/* FIXME: move this into an editable .in file. */
size_t
-mdoc_macro2len(int macro)
+mdoc_macro2len(enum mdoct macro)
{
switch (macro) {
diff --git a/mdoc_validate.c b/mdoc_validate.c
index c2ef5d50..22db47a8 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -747,7 +747,7 @@ pre_sh(PRE_ARGS)
if (MDOC_BLOCK != n->type)
return(1);
- return(check_parent(mdoc, n, -1, MDOC_ROOT));
+ return(check_parent(mdoc, n, MDOC_MAX, MDOC_ROOT));
}