=================================================================== RCS file: /cvs/mandoc/Attic/mdocterm.c,v retrieving revision 1.3 retrieving revision 1.6 diff -u -p -r1.3 -r1.6 --- mandoc/Attic/mdocterm.c 2009/02/23 07:09:13 1.3 +++ mandoc/Attic/mdocterm.c 2009/02/23 15:19:47 1.6 @@ -1,4 +1,4 @@ - /* $Id: mdocterm.c,v 1.3 2009/02/23 07:09:13 kristaps Exp $ */ + /* $Id: mdocterm.c,v 1.6 2009/02/23 15:19:47 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -24,6 +24,10 @@ #include #include +#ifdef __linux__ +#include +#endif + #include "mmain.h" #include "term.h" @@ -45,6 +49,7 @@ static void pword(struct termp *, const char *, siz static void pescape(struct termp *, const char *, size_t *, size_t); static void chara(struct termp *, char); +static void stringa(struct termp *, const char *); static void style(struct termp *, enum termstyle); #ifdef __linux__ @@ -60,9 +65,6 @@ main(int argc, char *argv[]) const struct mdoc *mdoc; struct termp termp; - extern int optreset; - extern int optind; - p = mmain_alloc(); if ( ! mmain_getopt(p, argc, argv, NULL, NULL, NULL, NULL)) @@ -165,10 +167,9 @@ flushln(struct termp *p) for (j = 0; j < p->offset; j++) putchar(' '); vis = 0; - } else if (vis + vsz >= maxvis) { + } else if (vis + vsz >= maxvis) /* FIXME */ errx(1, "word breaks right margin"); - } /* * Write out the word and a trailing space. Omit the @@ -231,6 +232,16 @@ vspace(struct termp *p) static void +stringa(struct termp *p, const char *s) +{ + + /* XXX - speed up if not passing to chara. */ + for ( ; *s; s++) + chara(p, *s); +} + + +static void chara(struct termp *p, char c) { @@ -284,6 +295,10 @@ pescape(struct termp *p, const char *word, size_t *i, chara(p, ']'); else if ('l' == word[*i] && 'B' == word[*i + 1]) chara(p, '['); + else if ('<' == word[*i] && '-' == word[*i + 1]) + stringa(p, "<-"); + else if ('-' == word[*i] && '>' == word[*i + 1]) + stringa(p, "->"); (*i)++; return;