=================================================================== RCS file: /cvs/mandoc/Attic/man_action.c,v retrieving revision 1.16 retrieving revision 1.21 diff -u -p -r1.16 -r1.21 --- mandoc/Attic/man_action.c 2009/08/19 09:14:50 1.16 +++ mandoc/Attic/man_action.c 2009/10/27 08:26:12 1.21 @@ -1,4 +1,4 @@ -/* $Id: man_action.c,v 1.16 2009/08/19 09:14:50 kristaps Exp $ */ +/* $Id: man_action.c,v 1.21 2009/10/27 08:26:12 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -23,17 +23,13 @@ #include "libman.h" -#ifdef __linux__ -extern char *strptime(const char *, const char *, struct tm *); -#endif - struct actions { int (*post)(struct man *); }; - static int post_TH(struct man *); -static time_t man_atotime(const char *); +static int post_fi(struct man *); +static int post_nf(struct man *); const struct actions man_actions[MAN_MAX] = { { NULL }, /* br */ @@ -60,14 +56,22 @@ const struct actions man_actions[MAN_MAX] = { { NULL }, /* na */ { NULL }, /* i */ { NULL }, /* sp */ - { NULL }, /* nf */ - { NULL }, /* fi */ + { post_nf }, /* nf */ + { post_fi }, /* fi */ { NULL }, /* r */ { NULL }, /* RE */ { NULL }, /* RS */ + { NULL }, /* DT */ + { NULL }, /* UC */ + { NULL }, /* PD */ }; +static time_t man_atotime(const char *); +#ifdef __linux__ +extern char *strptime(const char *, const char *, struct tm *); +#endif + int man_action_post(struct man *m) { @@ -78,19 +82,44 @@ man_action_post(struct man *m) switch (m->last->type) { case (MAN_TEXT): - break; + /* FALLTHROUGH */ case (MAN_ROOT): - break; + return(1); default: - if (NULL == man_actions[m->last->tok].post) - break; - return((*man_actions[m->last->tok].post)(m)); + break; } + + if (NULL == man_actions[m->last->tok].post) + return(1); + return((*man_actions[m->last->tok].post)(m)); +} + + +static int +post_fi(struct man *m) +{ + + if ( ! (MAN_LITERAL & m->flags)) + if ( ! man_nwarn(m, m->last, WNLITERAL)) + return(0); + m->flags &= ~MAN_LITERAL; return(1); } static int +post_nf(struct man *m) +{ + + if (MAN_LITERAL & m->flags) + if ( ! man_nwarn(m, m->last, WOLITERAL)) + return(0); + m->flags |= MAN_LITERAL; + return(1); +} + + +static int post_TH(struct man *m) { struct man_node *n; @@ -179,7 +208,7 @@ man_atotime(const char *p) struct tm tm; char *pp; - bzero(&tm, sizeof(struct tm)); + memset(&tm, 0, sizeof(struct tm)); if ((pp = strptime(p, "%b %d %Y", &tm)) && 0 == *pp) return(mktime(&tm));