=================================================================== RCS file: /cvs/mandoc/term_ascii.c,v retrieving revision 1.46 retrieving revision 1.49 diff -u -p -r1.46 -r1.49 --- mandoc/term_ascii.c 2015/06/10 19:17:15 1.46 +++ mandoc/term_ascii.c 2015/10/06 18:32:20 1.49 @@ -1,4 +1,4 @@ -/* $Id: term_ascii.c,v 1.46 2015/06/10 19:17:15 schwarze Exp $ */ +/* $Id: term_ascii.c,v 1.49 2015/10/06 18:32:20 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -70,6 +70,7 @@ ascii_init(enum termenc enc, const struct mchars *mcha p = mandoc_calloc(1, sizeof(struct termp)); p->symtab = mchars; + p->line = 1; p->tabwidth = 5; p->defrmargin = p->lastrmargin = 78; p->fontq = mandoc_reallocarray(NULL, @@ -114,28 +115,28 @@ ascii_init(enum termenc enc, const struct mchars *mcha if (outopts->synopsisonly) p->synopsisonly = 1; - return(p); + return p; } void * ascii_alloc(const struct mchars *mchars, const struct manoutput *outopts) { - return(ascii_init(TERMENC_ASCII, mchars, outopts)); + return ascii_init(TERMENC_ASCII, mchars, outopts); } void * utf8_alloc(const struct mchars *mchars, const struct manoutput *outopts) { - return(ascii_init(TERMENC_UTF8, mchars, outopts)); + return ascii_init(TERMENC_UTF8, mchars, outopts); } void * locale_alloc(const struct mchars *mchars, const struct manoutput *outopts) { - return(ascii_init(TERMENC_LOCALE, mchars, outopts)); + return ascii_init(TERMENC_LOCALE, mchars, outopts); } static void @@ -163,6 +164,7 @@ ascii_sepline(void *arg) size_t i; p = (struct termp *)arg; + p->line += 3; putchar('\n'); for (i = 0; i < p->defrmargin; i++) putchar('-'); @@ -174,7 +176,7 @@ static size_t ascii_width(const struct termp *p, int c) { - return(1); + return 1; } void @@ -209,6 +211,7 @@ static void ascii_endline(struct termp *p) { + p->line++; putchar('\n'); } @@ -257,9 +260,8 @@ ascii_hspan(const struct termp *p, const struct roffsu break; default: abort(); - /* NOTREACHED */ } - return(r > 0.0 ? r + 0.01 : r - 0.01); + return r > 0.0 ? r + 0.01 : r - 0.01; } const char * @@ -334,8 +336,8 @@ ascii_uc2str(int uc) assert(uc >= 0); if ((size_t)uc < sizeof(tab)/sizeof(tab[0])) - return(tab[uc]); - return(mchars_uc2str(uc)); + return tab[uc]; + return mchars_uc2str(uc); } #if HAVE_WCHAR @@ -349,7 +351,7 @@ locale_width(const struct termp *p, int c) rc = wcwidth(c); if (rc < 0) rc = 0; - return(rc); + return rc; } static void @@ -365,6 +367,7 @@ static void locale_endline(struct termp *p) { + p->line++; putwchar(L'\n'); }