summaryrefslogtreecommitdiffstats
path: root/term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-09-15 08:16:20 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-09-15 08:16:20 +0000
commitea228aff6a872a947bb23cd1b1405ab1d72c37e6 (patch)
treefe44491217e8d64d10121d185763d198703ceae0 /term.c
parent74d68c4f407023d0d2a78e88ae492f13442ba597 (diff)
downloadmandoc-ea228aff6a872a947bb23cd1b1405ab1d72c37e6.tar.gz
Removed TERMP_BOLD, TERMP_UNDER, TERMP_STYLE in favour of recursive-friendly increments.
Cleaned up confusing behaviour of p->flags.
Diffstat (limited to 'term.c')
-rw-r--r--term.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/term.c b/term.c
index 04776e4f..6ea5aff0 100644
--- a/term.c
+++ b/term.c
@@ -104,7 +104,7 @@ term_alloc(enum termenc enc)
struct termp *p;
if (NULL == (p = malloc(sizeof(struct termp))))
- err(1, "malloc");
+ return(NULL);
bzero(p, sizeof(struct termp));
p->maxrmargin = 78;
p->enc = enc;
@@ -492,15 +492,15 @@ do_escaped(struct termp *p, const char **word)
switch (*wp) {
case ('B'):
- p->flags |= TERMP_BOLD;
+ p->bold++;
break;
case ('I'):
- p->flags |= TERMP_UNDER;
+ p->under++;
break;
case ('P'):
/* FALLTHROUGH */
case ('R'):
- p->flags &= ~TERMP_STYLE;
+ p->bold = p->under = 0;
break;
default:
break;
@@ -579,7 +579,7 @@ buffer(struct termp *p, char c)
s = p->maxcols * 2;
p->buf = realloc(p->buf, s);
if (NULL == p->buf)
- err(1, "realloc");
+ err(1, "realloc"); /* FIXME: shouldn't be here! */
p->maxcols = s;
}
p->buf[(int)(p->col)++] = c;
@@ -590,12 +590,12 @@ static void
encode(struct termp *p, char c)
{
- if (' ' != c && TERMP_STYLE & p->flags) {
- if (TERMP_BOLD & p->flags) {
+ if (' ' != c) {
+ if (p->bold) {
buffer(p, c);
buffer(p, 8);
}
- if (TERMP_UNDER & p->flags) {
+ if (p->under) {
buffer(p, '_');
buffer(p, 8);
}