version 1.4, 2009/03/23 15:41:09 |
version 1.8, 2009/03/26 11:16:21 |
|
|
*/ |
*/ |
#include <assert.h> |
#include <assert.h> |
#include <ctype.h> |
#include <ctype.h> |
#include <err.h> /* XXX */ |
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <string.h> |
#include <string.h> |
Line 56 man_macro(struct man *man, int tok, int line, |
|
Line 55 man_macro(struct man *man, int tok, int line, |
|
man->next = MAN_NEXT_SIBLING; |
man->next = MAN_NEXT_SIBLING; |
} |
} |
|
|
/* TODO: validate & actions. */ |
/* |
|
* Note that when TH is pruned, we'll be back at the root, so |
|
* make sure that we don't clobber as its sibling. |
|
*/ |
|
|
man->last = n; |
for ( ; man->last; man->last = man->last->parent) { |
man->next = MAN_NEXT_SIBLING; |
if (man->last == n) |
|
break; |
|
if (man->last->type == MAN_ROOT) |
|
break; |
|
if ( ! man_valid_post(man)) |
|
return(0); |
|
if ( ! man_action_post(man)) |
|
return(0); |
|
} |
|
|
|
assert(man->last); |
|
|
|
/* |
|
* Same here regarding whether we're back at the root. |
|
*/ |
|
|
|
if (man->last->type != MAN_ROOT && ! man_valid_post(man)) |
|
return(0); |
|
if (man->last->type != MAN_ROOT && ! man_action_post(man)) |
|
return(0); |
|
if (man->last->type != MAN_ROOT) |
|
man->next = MAN_NEXT_SIBLING; |
|
|
return(1); |
return(1); |
} |
} |
|
|
|
|
man_macroend(struct man *m) |
man_macroend(struct man *m) |
{ |
{ |
|
|
/* TODO: validate & actions. */ |
for ( ; m->last && m->last != m->first; |
|
m->last = m->last->parent) { |
|
if ( ! man_valid_post(m)) |
|
return(0); |
|
if ( ! man_action_post(m)) |
|
return(0); |
|
} |
|
assert(m->last == m->first); |
|
|
|
if ( ! man_valid_post(m)) |
|
return(0); |
|
if ( ! man_action_post(m)) |
|
return(0); |
|
|
return(1); |
return(1); |
} |
} |
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
static int |
static int |
man_args(struct man *man, int line, |
man_args(struct man *m, int line, |
int *pos, char *buf, char **v) |
int *pos, char *buf, char **v) |
{ |
{ |
|
|
Line 109 man_args(struct man *man, int line, |
|
Line 145 man_args(struct man *man, int line, |
|
if (buf[*pos]) |
if (buf[*pos]) |
return(1); |
return(1); |
|
|
warnx("tail whitespace"); |
if ( ! man_vwarn(m, line, *pos, "trailing spaces")) |
return(-1); |
return(-1); |
|
|
|
return(1); |
} |
} |
|
|
/* |
/* |
Line 125 man_args(struct man *man, int line, |
|
Line 163 man_args(struct man *man, int line, |
|
(*pos)++; |
(*pos)++; |
|
|
if (0 == buf[*pos]) { |
if (0 == buf[*pos]) { |
warnx("unterminated quotation"); |
if ( ! man_vwarn(m, line, *pos, "unterminated quote")) |
return(-1); |
return(-1); |
|
return(1); |
} |
} |
|
|
buf[(*pos)++] = 0; |
buf[(*pos)++] = 0; |
Line 139 man_args(struct man *man, int line, |
|
Line 178 man_args(struct man *man, int line, |
|
if (buf[*pos]) |
if (buf[*pos]) |
return(1); |
return(1); |
|
|
warnx("tail whitespace"); |
if ( ! man_vwarn(m, line, *pos, "trailing spaces")) |
return(-1); |
return(-1); |
|
return(1); |
} |
} |