Submitted By: Jim Gifford Date: 2009-01-11 Initial Package Version: 3.2.7 Upstream Status: Unkown Origin: Fedora Description: i18n Updates diff -Naur procps-3.2.7.orig/Makefile procps-3.2.7/Makefile --- procps-3.2.7.orig/Makefile 2006-06-24 02:02:25.000000000 -0700 +++ procps-3.2.7/Makefile 2009-01-11 00:24:56.000000000 -0800 @@ -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 -Naur procps-3.2.7.orig/sysctl.c procps-3.2.7/sysctl.c --- procps-3.2.7.orig/sysctl.c 2006-06-24 17:51:51.000000000 -0700 +++ procps-3.2.7/sysctl.c 2009-01-11 00:34:07.000000000 -0800 @@ -135,7 +135,7 @@ } /* used to open the file */ - tmpname = malloc(strlen(name)+strlen(PROC_PATH)+1); + tmpname = malloc(strlen(name)+strlen(PROC_PATH)+2); strcpy(tmpname, PROC_PATH); strcat(tmpname, name); slashdot(tmpname+strlen(PROC_PATH),'.','/'); /* change . to / */ diff -Naur procps-3.2.7.orig/top.c procps-3.2.7/top.c --- procps-3.2.7.orig/top.c 2006-06-24 23:41:48.000000000 -0700 +++ procps-3.2.7/top.c 2009-01-11 00:34:54.000000000 -0800 @@ -2462,7 +2462,10 @@ int i; for (i = 0; i < GROUPSMAX; i++) { - win_names(&Winstk[i], Winstk[i].rc.winname); + /* Please, never use something like sprintf(x, "%s", x); ... see win_names() */ + char buf[WINNAMSIZ]; + strncpy(buf, Winstk[i].rc.winname, WINNAMSIZ); + win_names(&Winstk[i], buf); capsmk(&Winstk[i]); } // rely on this next guy to force a call (eventually) to reframewins diff -Naur procps-3.2.7.orig/watch.c procps-3.2.7/watch.c --- procps-3.2.7.orig/watch.c 2006-06-17 02:18:38.000000000 -0700 +++ procps-3.2.7/watch.c 2009-01-11 00:27:15.000000000 -0800 @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include #include #include @@ -134,6 +136,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[]) { @@ -239,6 +262,7 @@ FILE *p; int x, y; int oldeolseen = 1; + mbstate_t mbs; if (screen_size_changed) { get_terminal_size(); @@ -266,49 +290,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; }