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 145709 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]
A more general version
procps-3.2.6-watch-unicode.patch (text/plain), 3.34 KB, created by
Miloslav Trmač
on 2007-01-16 17:15:49 UTC
(
hide
)
Description:
A more general version
Filename:
MIME Type:
Creator:
Miloslav Trmač
Created:
2007-01-16 17:15:49 UTC
Size:
3.34 KB
patch
obsolete
>diff -u procps-3.2.7/Makefile procps/Makefile >--- procps-3.2.7/Makefile 2007-01-16 17:24:49.000000000 +0100 >+++ procps/Makefile 2007-01-16 17:29:27.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 -u procps-3.2.7/watch.c procps/watch.c >--- procps-3.2.7/watch.c 2007-01-16 17:24:49.000000000 +0100 >+++ procps/watch.c 2007-01-16 18:06:57.000000000 +0100 >@@ -15,7 +15,7 @@ > #include <ctype.h> > #include <getopt.h> > #include <signal.h> >-#include <ncurses.h> >+#include <ncursesw/ncurses.h> > #include <stdio.h> > #include <stdlib.h> > #include <string.h> >@@ -28,6 +28,8 @@ > #include <sys/types.h> > #include <sys/stat.h> > #include <fcntl.h> >+#include <wchar.h> >+#include <wctype.h> > > #ifdef FORCE_8BIT > #undef isprint >@@ -137,6 +139,27 @@ > } > } > >+static wint_t >+readwc(FILE *stream, mbstate_t *mbs) >+{ >+ for (;;) { >+ int chr; >+ char c; >+ wchar_t wc; >+ size_t len; >+ >+ chr = getc(stream); >+ if (chr == EOF) >+ return WEOF; >+ c = chr; >+ len = mbrtowc(&wc, &c, 1, mbs); >+ if (len == (size_t)-1) >+ memset(mbs, 0, sizeof(*mbs)); >+ else if (len != (size_t)-2) >+ return wc; >+ } >+} >+ > int > main(int argc, char *argv[]) > { >@@ -243,6 +266,7 @@ > FILE *p; > int x, y; > int oldeolseen = 1; >+ mbstate_t mbs; > > if (screen_size_changed) { > get_terminal_size(); >@@ -276,49 +300,63 @@ > do_exit(2); > } > >+ memset(&mbs, 0, sizeof(mbs)); > for (y = show_title; y < height; y++) { > int eolseen = 0, tabpending = 0; > for (x = 0; x < width; x++) { >- int c = ' '; >- int attr = 0; >+ wint_t c = L' '; >+ int attr = 0, c_width; >+ cchar_t cc; >+ wchar_t wstr[2]; > > 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') >+ c = readwc(p, &mbs); >+ while (c != WEOF && !iswprint(c) >+ && c != L'\n' >+ && c != L'\t'); >+ if (c == L'\n') > if (!oldeolseen && x == 0) { > x = -1; > continue; > } else > eolseen = 1; >- else if (c == '\t') >+ else if (c == L'\t') > tabpending = 1; >- if (c == EOF || c == '\n' || c == '\t') >- c = ' '; >+ if (c == WEOF || c == L'\n' || c == L'\t') >+ c = L' '; > if (tabpending && (((x + 1) % 8) == 0)) > tabpending = 0; > } >+ wstr[0] = c; >+ wstr[1] = 0; >+ setcchar (&cc, wstr, 0, 0, NULL); > move(y, x); > if (option_differences) { >- int oldch = inch(); >- char oldc = oldch & A_CHARTEXT; >+ cchar_t oldc; >+ wchar_t oldwstr[2]; >+ attr_t attrs; >+ short colors; >+ >+ in_wch(&oldc); >+ getcchar(&oldc, oldwstr, &attrs, &colors, NULL); > attr = !first_screen >- && (c != oldc >+ && (wstr[0] != oldwstr[0] > || > (option_differences_cumulative >- && (oldch & A_ATTRIBUTES))); >+ && attrs)); > } > if (attr) > standout(); >- addch(c); >+ add_wch(&cc); > if (attr) > standend(); >+ c_width = wcwidth(c); >+ if (c_width > 1) >+ x += c_width - 1; > } > oldeolseen = eolseen; > }
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