FreeBSD Bugzilla – Attachment 174708 Details for
Bug 210995
cat -v fails to tag characters in extended table with M- prefix with some locales
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
use wide chars with fallback to plain ones
cat.patch (text/plain), 1.26 KB, created by
Andrey A. Chernov
on 2016-09-13 08:20:13 UTC
(
hide
)
Description:
use wide chars with fallback to plain ones
Filename:
MIME Type:
Creator:
Andrey A. Chernov
Created:
2016-09-13 08:20:13 UTC
Size:
1.26 KB
patch
obsolete
>--- /usr/src/bin/cat/cat.c 2016-07-22 16:42:11.671288000 +0300 >+++ cat.c 2016-09-13 11:14:08.858013000 +0300 >@@ -63,6 +63,8 @@ > #include <stdlib.h> > #include <string.h> > #include <unistd.h> >+#include <wchar.h> >+#include <wctype.h> > > static int bflag, eflag, lflag, nflag, sflag, tflag, vflag; > static int rval; >@@ -205,6 +207,7 @@ > cook_cat(FILE *fp) > { > int ch, gobble, line, prev; >+ wint_t wch; > > /* Reset EOF condition on stdin. */ > if (fp == stdin && feof(stdin)) >@@ -237,18 +240,34 @@ > continue; > } > } else if (vflag) { >- if (!isascii(ch) && !isprint(ch)) { >+ ungetc(ch, fp); >+ if ((wch = getwc(fp)) == WEOF) { >+ if (ferror(fp) && errno == EILSEQ) { >+ clearerr(fp); >+ if ((ch = getc(fp)) == EOF) >+ break; >+ wch = ch; >+ goto ilseq; >+ } else >+ break; >+ } >+ if (!iswascii(wch) && !iswprint(wch)) { >+ilseq: > if (putchar('M') == EOF || putchar('-') == EOF) > break; >- ch = toascii(ch); >+ wch = toascii(wch); > } >- if (iscntrl(ch)) { >+ if (iswcntrl(wch)) { >+ ch = toascii(wch); > if (putchar('^') == EOF || > putchar(ch == '\177' ? '?' : > ch | 0100) == EOF) > break; > continue; > } >+ if (putwchar(wch) == WEOF) >+ break; >+ continue; > } > if (putchar(ch) == EOF) > break;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 210995
:
172364
|
173315
|
173316
|
173318
| 174708