version 1.7, 2009/03/25 16:07:36 |
version 1.13, 2009/04/05 16:34:22 |
|
|
*/ |
*/ |
#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 <string.h> |
#include <string.h> |
|
|
#include "libman.h" |
#include "libman.h" |
|
|
|
#define FL_NLINE (1 << 0) |
|
#define FL_TLINE (1 << 1) |
|
|
static int man_args(struct man *, int, |
static int man_args(struct man *, int, |
int *, char *, char **); |
int *, char *, char **); |
|
|
|
static int man_flags[MAN_MAX] = { |
|
0, /* __ */ |
|
0, /* TH */ |
|
0, /* SH */ |
|
0, /* SS */ |
|
FL_TLINE, /* TP */ |
|
0, /* LP */ |
|
0, /* PP */ |
|
0, /* P */ |
|
0, /* IP */ |
|
0, /* HP */ |
|
FL_NLINE, /* SM */ |
|
FL_NLINE, /* SB */ |
|
FL_NLINE, /* BI */ |
|
FL_NLINE, /* IB */ |
|
FL_NLINE, /* BR */ |
|
FL_NLINE, /* RB */ |
|
FL_NLINE, /* R */ |
|
FL_NLINE, /* B */ |
|
FL_NLINE, /* I */ |
|
FL_NLINE, /* IR */ |
|
FL_NLINE, /* RI */ |
|
0, /* br */ |
|
0, /* na */ |
|
FL_NLINE, /* i */ |
|
}; |
|
|
int |
int |
man_macro(struct man *man, int tok, int line, |
man_macro(struct man *man, int tok, int line, |
Line 56 man_macro(struct man *man, int tok, int line, |
|
Line 83 man_macro(struct man *man, int tok, int line, |
|
man->next = MAN_NEXT_SIBLING; |
man->next = MAN_NEXT_SIBLING; |
} |
} |
|
|
|
if (n == man->last && (FL_NLINE & man_flags[tok])) { |
|
if (MAN_NLINE & man->flags) |
|
return(man_verr(man, line, ppos, |
|
"next-line scope already open")); |
|
man->flags |= MAN_NLINE; |
|
return(1); |
|
} |
|
|
|
if (FL_TLINE & man_flags[tok]) { |
|
if (MAN_NLINE & man->flags) |
|
return(man_verr(man, line, ppos, |
|
"next-line scope already open")); |
|
man->flags |= MAN_NLINE; |
|
return(1); |
|
} |
|
|
/* |
/* |
* Note that when TH is pruned, we'll be back at the root, so |
* Note that when TH is pruned, we'll be back at the root, so |
* make sure that we don't clobber as its sibling. |
* make sure that we don't clobber as its sibling. |
Line 113 man_macroend(struct man *m) |
|
Line 156 man_macroend(struct man *m) |
|
|
|
/* 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 146 man_args(struct man *man, int line, |
|
Line 189 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 162 man_args(struct man *man, int line, |
|
Line 207 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 176 man_args(struct man *man, int line, |
|
Line 222 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); |
} |
} |