Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 144544 Details for
Bug 183029
watch(1) doesn't know and ignores unicode characters
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Unicode support for watch
procps-3.2.6-watch-unicode.patch (text/plain), 3.09 KB, created by
Jan Cholasta
on 2006-12-29 14:30:47 UTC
(
hide
)
Description:
Unicode support for watch
Filename:
MIME Type:
Creator:
Jan Cholasta
Created:
2006-12-29 14:30:47 UTC
Size:
3.09 KB
patch
obsolete
>diff -dur procps-3.2.6.old/Makefile procps-3.2.6/Makefile >--- procps-3.2.6.old/Makefile 2006-12-29 13:01:34.000000000 +0100 >+++ procps-3.2.6/Makefile 2006-12-29 12:51:59.000000000 +0100 >@@ -67,7 +67,7 @@ > # plus the top-level Makefile to make it work stand-alone. > _TARFILES := Makefile > >-CURSES := -lncurses >+CURSES := -lncursesw > > # This seems about right for the dynamic library stuff. > # Something like this is probably needed to make the SE Linux >diff -dur procps-3.2.6.old/watch.c procps-3.2.6/watch.c >--- procps-3.2.6.old/watch.c 2006-12-29 13:01:34.000000000 +0100 >+++ procps-3.2.6/watch.c 2006-12-29 15:17:46.000000000 +0100 >@@ -28,6 +28,7 @@ > #include <sys/types.h> > #include <sys/stat.h> > #include <fcntl.h> >+#include <wchar.h> > > #include <sys/select.h> > #include <sys/time.h> >@@ -140,6 +141,48 @@ > } > } > >+static wchar_t >+readwc(FILE *stream) >+{ >+ int chr, mask, i, len; >+ wchar_t ret; >+ >+ chr = getc(stream); >+ if (chr == EOF) >+ return WEOF; >+ if ((chr & 0x80) == 0) >+ return chr; >+ >+ mask = 0x80; >+ len = 0; >+ >+ while (mask && chr & mask) >+ { >+ chr &= ~mask; >+ mask >>= 1; >+ len++; >+ } >+ >+ if (len < 2 || len > 6) >+ return WEOF; >+ >+ ret = chr << 6 * (len - 1); >+ >+ for (i = len-2; i >= 0; i--) >+ { >+ chr = getc(stream); >+ >+ if (chr == EOF) >+ return WEOF; >+ if ((chr & 0xc0) != 0x80) >+ return WEOF; >+ >+ ret |= (chr & 0x3f) << 6 * i; >+ } >+ >+ return ret; >+} >+ > int > main(int argc, char *argv[]) > { >@@ -281,44 +324,51 @@ > for (y = show_title; y < height; y++) { > int eolseen = 0, tabpending = 0; > for (x = 0; x < width; x++) { >- int c = ' '; >+ cchar_t c; > int attr = 0; >+ wchar_t wc[2] = { L' ', 0 }; > > if (!eolseen) { > /* if there is a tab pending, just spit spaces until the > next stop instead of reading characters */ > if (!tabpending) > do >- c = getc(p); >- while (c != EOF && !isprint(c) >- && c != '\n' >- && c != '\t'); >- if (c == '\n') >+ wc[0] = readwc(p); // Why doesn't getwc work? >+ while (wc[0] != WEOF && !iswprint(wc[0]) >+ && wc[0] != L'\n' >+ && wc[0] != L'\t'); >+ if (wc[0] == L'\n') > if (!oldeolseen && x == 0) { > x = -1; > continue; > } else > eolseen = 1; >- else if (c == '\t') >+ else if (wc[0] == L'\t') > tabpending = 1; >- if (c == EOF || c == '\n' || c == '\t') >- c = ' '; >+ if (wc[0] == WEOF || wc[0] == L'\n' || wc[0] == L'\t') >+ wc[0] = L' '; > if (tabpending && (((x + 1) % 8) == 0)) > tabpending = 0; >+ setcchar (&c, wc, 0, 0, NULL); > } > move(y, x); > if (option_differences) { >- int oldch = inch(); >- char oldc = oldch & A_CHARTEXT; >+ cchar_t oldc; >+ wchar_t oldwc[2]; >+ attr_t attrs; >+ short colors; >+ >+ in_wch(&oldc); >+ getcchar(&oldc, oldwc, &attrs, &colors, NULL); > attr = !first_screen >- && (c != oldc >+ && (wc[0] != oldwc[0] > || > (option_differences_cumulative >- && (oldch & A_ATTRIBUTES))); >+ && attrs)); > } > if (attr) > standout(); >- addch(c); >+ add_wch(&c); > if (attr) > standend(); > }
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 183029
:
144544
|
145709