source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: ISO C99 7.19.2.5 doesn't like mixing putchar(3) and putwchar(3)
@ 2016-07-08 22:29 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2016-07-08 22:29 UTC (permalink / raw)
  To: source

Log Message:
-----------
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.

Modified Files:
--------------
    mdocml:
        main.c
        main.h
        term_ascii.c

Revision Data
-------------
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/main.c,v
retrieving revision 1.266
retrieving revision 1.267
diff -Lmain.c -Lmain.c -u -p -r1.266 -r1.267
--- main.c
+++ 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;
 
Index: term_ascii.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/term_ascii.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -Lterm_ascii.c -Lterm_ascii.c -u -p -r1.52 -r1.53
--- term_ascii.c
+++ term_ascii.c
@@ -163,18 +163,17 @@ ascii_setwidth(struct termp *p, int iop,
 }
 
 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
Index: main.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/main.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -Lmain.h -Lmain.h -u -p -r1.24 -r1.25
--- main.h
+++ main.h
@@ -43,7 +43,6 @@ void		 *locale_alloc(const struct manout
 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 *);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-08 22:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-08 22:29 mdocml: ISO C99 7.19.2.5 doesn't like mixing putchar(3) and putwchar(3) schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).