diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-04-25 16:32:20 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-04-25 16:32:20 +0000 |
commit | 5e7b141c4078dd8c459a211917f8a3e69aeaa18a (patch) | |
tree | b859e18c87182d4c4303d5b692186229b169426b /usr.bin/mandoc/man.c | |
parent | 29b368d88c35b353b92244355941b92cf8a46c4e (diff) |
Implement roff conditional instructions .if .ie .el, in man(7) only for now;
fixing OpenBSD::PackageName(3p) and friends for espie@.
Diffstat (limited to 'usr.bin/mandoc/man.c')
-rw-r--r-- | usr.bin/mandoc/man.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/usr.bin/mandoc/man.c b/usr.bin/mandoc/man.c index 30426f19cbf..24a4c27cfe8 100644 --- a/usr.bin/mandoc/man.c +++ b/usr.bin/mandoc/man.c @@ -1,4 +1,4 @@ -/* $Id: man.c,v 1.24 2010/04/02 11:37:07 schwarze Exp $ */ +/* $Id: man.c,v 1.25 2010/04/25 16:32:19 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -62,7 +62,7 @@ const char *const __man_macronames[MAN_MAX] = { "RS", "DT", "UC", "PD", "Sp", "Vb", "Ve", "de", "dei", "am", "ami", "ig", - ".", + ".", "if", "ie", "el", }; const char * const *man_macronames = __man_macronames; @@ -152,10 +152,27 @@ man_endparse(struct man *m) int man_parseln(struct man *m, int ln, char *buf) { + char *p; + size_t len; + int brace_close = 0; + + if ((len = strlen(buf)) > 1) { + p = buf + (len - 2); + if (p[0] == '\\' && p[1] == '}') { + brace_close = 1; + *p = '\0'; + } + } + + if ('.' == *buf || '\'' == *buf) { + if ( ! man_pmacro(m, ln, buf)) + return(0); + } else { + if ( ! man_ptext(m, ln, buf)) + return(0); + } - return('.' == *buf || '\'' == *buf ? - man_pmacro(m, ln, buf) : - man_ptext(m, ln, buf)); + return(brace_close ? man_brace_close(m, ln, len-2) : 1); } |