aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit6d1b91c7d52857bb2fa40ca8bd7891e461e37590 (patch)
treee522d6c35c5971d55708262bed43711bcacdf38f
parent10a6c926fd8fa67dc73934e86a2eafc9c4dffa74 (diff)
downloadmandoc-6d1b91c7d52857bb2fa40ca8bd7891e461e37590.tar.gz
mandoc-6d1b91c7d52857bb2fa40ca8bd7891e461e37590.tar.zst
mandoc-6d1b91c7d52857bb2fa40ca8bd7891e461e37590.zip
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.c4
-rw-r--r--main.h4
-rw-r--r--term_ascii.c13
3 files changed, 10 insertions, 11 deletions
diff --git a/main.c b/main.c
index 53f34f47..86909344 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.266 2016/05/18 22:36:00 schwarze Exp $ */
+/* $Id: main.c,v 1.267 2016/07/08 22:29:05 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 e9e7e866..a53df93c 100644
--- a/main.h
+++ b/main.h
@@ -1,4 +1,4 @@
-/* $Id: main.h,v 1.24 2015/11/07 14:01:16 schwarze Exp $ */
+/* $Id: main.h,v 1.25 2016/07/08 22:29:05 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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 7215a597..fecdb0a9 100644
--- a/term_ascii.c
+++ b/term_ascii.c
@@ -1,4 +1,4 @@
-/* $Id: term_ascii.c,v 1.52 2015/11/12 21:50:03 schwarze Exp $ */
+/* $Id: term_ascii.c,v 1.53 2016/07/08 22:29:05 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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