summaryrefslogtreecommitdiffstats
path: root/man_action.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-08-21 12:32:38 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-08-21 12:32:38 +0000
commit270a33558b8c086b899f49f34e1d47da4792b7b8 (patch)
tree2a1c0cbef9edfff1a3fd8f1135fc17fed30bfd7d /man_action.c
parentd8d8e19a17345326342a05e737487b04fa994353 (diff)
downloadmandoc-270a33558b8c086b899f49f34e1d47da4792b7b8.tar.gz
Fixed `nf' behaviour (had broken with de-chunking).
Added warnings if literal context already open/closed.
Diffstat (limited to 'man_action.c')
-rw-r--r--man_action.c52
1 files changed, 39 insertions, 13 deletions
diff --git a/man_action.c b/man_action.c
index 747708c6..a86e4bfa 100644
--- a/man_action.c
+++ b/man_action.c
@@ -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,19 @@ 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 */
};
+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)
@@ -79,14 +80,39 @@ 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);
}