summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-07-08 22:29:05 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-07-08 22:29:05 +0000
commite4bd20c87c7efde9f1a64968c257d09331d63513 (patch)
tree2851c7a074f4e1c6d51188ef1d169ed7509108d5
parente8e468f87237253e5bdaaef7631457e73b73332e (diff)
downloadmandoc-e4bd20c87c7efde9f1a64968c257d09331d63513.tar.gz
ISO C99 7.19.2.5 doesn't like mixing putchar(3) and putwchar(3) on
the same stream, and actually, it fails spectacularly on glibc. Portability issue pointed out by Svyatoslav Mishyn <juef at openmailbox dot org> after testing on Void Linux.
-rw-r--r--main.c2
-rw-r--r--main.h2
-rw-r--r--term_ascii.c11
3 files changed, 7 insertions, 8 deletions
diff --git a/main.c b/main.c
index 9fa27767..461c91e4 100644
--- a/main.c
+++ b/main.c
@@ -479,7 +479,7 @@ main(int argc, char *argv[])
conf.output.synopsisonly);
if (argc > 1 && curp.outtype <= OUTT_UTF8)
- ascii_sepline(curp.outdata);
+ terminal_sepline(curp.outdata);
} else if (rc < MANDOCLEVEL_ERROR)
rc = MANDOCLEVEL_ERROR;
diff --git a/main.h b/main.h
index 376d4b7f..9f7a5333 100644
--- a/main.h
+++ b/main.h
@@ -43,7 +43,6 @@ void *locale_alloc(const struct manoutput *);
void *utf8_alloc(const struct manoutput *);
void *ascii_alloc(const struct manoutput *);
void ascii_free(void *);
-void ascii_sepline(void *);
void *pdf_alloc(const struct manoutput *);
void *ps_alloc(const struct manoutput *);
@@ -51,3 +50,4 @@ void pspdf_free(void *);
void terminal_mdoc(void *, const struct roff_man *);
void terminal_man(void *, const struct roff_man *);
+void terminal_sepline(void *);
diff --git a/term_ascii.c b/term_ascii.c
index 2f67eb88..1ba4c6c9 100644
--- a/term_ascii.c
+++ b/term_ascii.c
@@ -163,18 +163,17 @@ ascii_setwidth(struct termp *p, int iop, int width)
}
void
-ascii_sepline(void *arg)
+terminal_sepline(void *arg)
{
struct termp *p;
size_t i;
p = (struct termp *)arg;
- p->line += 3;
- putchar('\n');
+ (*p->endline)(p);
for (i = 0; i < p->defrmargin; i++)
- putchar('-');
- putchar('\n');
- putchar('\n');
+ (*p->letter)(p, '-');
+ (*p->endline)(p);
+ (*p->endline)(p);
}
static size_t