Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/vis handle EILSEQ.



details:   https://anonhg.NetBSD.org/src/rev/076ce2e61278
branches:  trunk
changeset: 784893:076ce2e61278
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Feb 13 13:58:44 2013 +0000

description:
handle EILSEQ.

diffstat:

 usr.bin/vis/vis.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 2d77a553c54e -r 076ce2e61278 usr.bin/vis/vis.c
--- a/usr.bin/vis/vis.c Wed Feb 13 12:28:23 2013 +0000
+++ b/usr.bin/vis/vis.c Wed Feb 13 13:58:44 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vis.c,v 1.16 2013/02/13 04:52:31 christos Exp $        */
+/*     $NetBSD: vis.c,v 1.17 2013/02/13 13:58:44 christos Exp $        */
 
 /*-
  * Copyright (c) 1989, 1993
@@ -39,12 +39,13 @@
 #if 0
 static char sccsid[] = "@(#)vis.c      8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: vis.c,v 1.16 2013/02/13 04:52:31 christos Exp $");
+__RCSID("$NetBSD: vis.c,v 1.17 2013/02/13 13:58:44 christos Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <errno.h>
 #include <wchar.h>
 #include <unistd.h>
 #include <err.h>
@@ -162,8 +163,12 @@
        char buff[5];
        
        c = getwc(fp);
-       while (c != EOF) {
+       if (c == WEOF && errno == EILSEQ)
+               c = (wint_t)getc(fp);
+       while (c != WEOF) {
                rachar = getwc(fp);
+               if (rachar == WEOF && errno == EILSEQ)
+                       rachar = (wint_t)getc(fp);
                if (none) {
                        cp = buff;
                        *cp++ = c;



Home | Main Index | Thread Index | Old Index