version 1.26, 2010/03/22 14:03:03 |
version 1.31, 2010/05/15 15:54:39 |
|
|
#include "config.h" |
#include "config.h" |
#endif |
#endif |
|
|
#include <sys/utsname.h> |
|
|
|
#include <assert.h> |
#include <assert.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
|
|
}; |
}; |
|
|
static int post_TH(struct man *); |
static int post_TH(struct man *); |
|
static int post_de(struct man *); |
static int post_fi(struct man *); |
static int post_fi(struct man *); |
static int post_nf(struct man *); |
static int post_nf(struct man *); |
|
|
Line 68 const struct actions man_actions[MAN_MAX] = { |
|
Line 67 const struct actions man_actions[MAN_MAX] = { |
|
{ NULL }, /* DT */ |
{ NULL }, /* DT */ |
{ NULL }, /* UC */ |
{ NULL }, /* UC */ |
{ NULL }, /* PD */ |
{ NULL }, /* PD */ |
|
{ NULL }, /* Sp */ |
|
{ post_nf }, /* Vb */ |
|
{ post_fi }, /* Ve */ |
|
{ post_de }, /* de */ |
|
{ post_de }, /* dei */ |
|
{ post_de }, /* am */ |
|
{ post_de }, /* ami */ |
|
{ post_de }, /* ig */ |
|
{ NULL }, /* . */ |
}; |
}; |
|
|
|
|
Line 107 post_fi(struct man *m) |
|
Line 115 post_fi(struct man *m) |
|
|
|
|
|
static int |
static int |
|
post_de(struct man *m) |
|
{ |
|
|
|
/* |
|
* XXX: for the time being, we indiscriminately remove roff |
|
* instructions from the parse stream. |
|
*/ |
|
if (MAN_BLOCK == m->last->type) |
|
man_node_delete(m, m->last); |
|
return(1); |
|
} |
|
|
|
|
|
static int |
post_nf(struct man *m) |
post_nf(struct man *m) |
{ |
{ |
|
|
|
|
post_TH(struct man *m) |
post_TH(struct man *m) |
{ |
{ |
struct man_node *n; |
struct man_node *n; |
char *ep; |
|
long lval; |
|
|
|
if (m->meta.title) |
if (m->meta.title) |
free(m->meta.title); |
free(m->meta.title); |
Line 132 post_TH(struct man *m) |
|
Line 152 post_TH(struct man *m) |
|
if (m->meta.source) |
if (m->meta.source) |
free(m->meta.source); |
free(m->meta.source); |
|
|
m->meta.title = m->meta.vol = m->meta.source = NULL; |
m->meta.title = m->meta.vol = |
m->meta.msec = 0; |
m->meta.msec = m->meta.source = NULL; |
m->meta.date = 0; |
m->meta.date = 0; |
|
|
/* ->TITLE<- MSEC DATE SOURCE VOL */ |
/* ->TITLE<- MSEC DATE SOURCE VOL */ |
Line 146 post_TH(struct man *m) |
|
Line 166 post_TH(struct man *m) |
|
|
|
n = n->next; |
n = n->next; |
assert(n); |
assert(n); |
|
m->meta.msec = mandoc_strdup(n->string); |
|
|
lval = strtol(n->string, &ep, 10); |
|
if (n->string[0] != '\0' && *ep == '\0') |
|
m->meta.msec = (int)lval; |
|
else if ( ! man_nwarn(m, n, WMSEC)) |
|
return(0); |
|
|
|
/* TITLE MSEC ->DATE<- SOURCE VOL */ |
/* TITLE MSEC ->DATE<- SOURCE VOL */ |
|
|
n = n->next; |
n = n->next; |
if (n) { |
if (n) { |
m->meta.date = mandoc_a2time |
m->meta.date = mandoc_a2time |
(MTIME_ISO_8601, n->string); |
(MTIME_ISO_8601, n->string); |
|
|
if (0 == m->meta.date) { |
if (0 == m->meta.date) { |
if ( ! man_nwarn(m, n, WDATE)) |
if ( ! man_nwarn(m, n, WDATE)) |
return(0); |
return(0); |
Line 178 post_TH(struct man *m) |
|
Line 192 post_TH(struct man *m) |
|
if (n && (n = n->next)) |
if (n && (n = n->next)) |
m->meta.vol = mandoc_strdup(n->string); |
m->meta.vol = mandoc_strdup(n->string); |
|
|
n = m->last; |
/* |
man_node_unlink(m, n); |
* Remove the `TH' node after we've processed it for our |
man_node_freelist(n); |
* meta-data. |
|
*/ |
|
man_node_delete(m, m->last); |
return(1); |
return(1); |
} |
} |