source: patches/procps-3.2.7-i18n-1.patch@ 970c8d2

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 970c8d2 was 702b89c, checked in by Jim Gifford <clfs@…>, 16 years ago

Added: procps-3.2.7-i18n-1.patch

  • Property mode set to 100644
File size: 4.5 KB
RevLine 
[702b89c]1Submitted By: Jim Gifford <jim at cross-lfs dot org>
2Date: 2009-01-11
3Initial Package Version: 3.2.7
4Upstream Status: Unkown
5Origin: Fedora
6Description: i18n Updates
7
8diff -Naur procps-3.2.7.orig/Makefile procps-3.2.7/Makefile
9--- procps-3.2.7.orig/Makefile 2006-06-24 02:02:25.000000000 -0700
10+++ procps-3.2.7/Makefile 2009-01-11 00:24:56.000000000 -0800
11@@ -67,7 +67,7 @@
12 # plus the top-level Makefile to make it work stand-alone.
13 _TARFILES := Makefile
14
15-CURSES := -lncurses
16+CURSES := -lncursesw
17
18 # This seems about right for the dynamic library stuff.
19 # Something like this is probably needed to make the SE Linux
20diff -Naur procps-3.2.7.orig/sysctl.c procps-3.2.7/sysctl.c
21--- procps-3.2.7.orig/sysctl.c 2006-06-24 17:51:51.000000000 -0700
22+++ procps-3.2.7/sysctl.c 2009-01-11 00:34:07.000000000 -0800
23@@ -135,7 +135,7 @@
24 }
25
26 /* used to open the file */
27- tmpname = malloc(strlen(name)+strlen(PROC_PATH)+1);
28+ tmpname = malloc(strlen(name)+strlen(PROC_PATH)+2);
29 strcpy(tmpname, PROC_PATH);
30 strcat(tmpname, name);
31 slashdot(tmpname+strlen(PROC_PATH),'.','/'); /* change . to / */
32diff -Naur procps-3.2.7.orig/top.c procps-3.2.7/top.c
33--- procps-3.2.7.orig/top.c 2006-06-24 23:41:48.000000000 -0700
34+++ procps-3.2.7/top.c 2009-01-11 00:34:54.000000000 -0800
35@@ -2462,7 +2462,10 @@
36 int i;
37
38 for (i = 0; i < GROUPSMAX; i++) {
39- win_names(&Winstk[i], Winstk[i].rc.winname);
40+ /* Please, never use something like sprintf(x, "%s", x); ... see win_names() */
41+ char buf[WINNAMSIZ];
42+ strncpy(buf, Winstk[i].rc.winname, WINNAMSIZ);
43+ win_names(&Winstk[i], buf);
44 capsmk(&Winstk[i]);
45 }
46 // rely on this next guy to force a call (eventually) to reframewins
47diff -Naur procps-3.2.7.orig/watch.c procps-3.2.7/watch.c
48--- procps-3.2.7.orig/watch.c 2006-06-17 02:18:38.000000000 -0700
49+++ procps-3.2.7/watch.c 2009-01-11 00:27:15.000000000 -0800
50@@ -19,6 +19,8 @@
51 #include <stdio.h>
52 #include <stdlib.h>
53 #include <string.h>
54+#include <wchar.h>
55+#include <wctype.h>
56 #include <sys/ioctl.h>
57 #include <time.h>
58 #include <unistd.h>
59@@ -134,6 +136,27 @@
60 }
61 }
62
63+static wint_t
64+readwc(FILE *stream, mbstate_t *mbs)
65+{
66+ for (;;) {
67+ int chr;
68+ char c;
69+ wchar_t wc;
70+ size_t len;
71+
72+ chr = getc(stream);
73+ if (chr == EOF)
74+ return WEOF;
75+ c = chr;
76+ len = mbrtowc(&wc, &c, 1, mbs);
77+ if (len == (size_t)-1)
78+ memset(mbs, 0, sizeof(*mbs));
79+ else if (len != (size_t)-2)
80+ return wc;
81+ }
82+}
83+
84 int
85 main(int argc, char *argv[])
86 {
87@@ -239,6 +262,7 @@
88 FILE *p;
89 int x, y;
90 int oldeolseen = 1;
91+ mbstate_t mbs;
92
93 if (screen_size_changed) {
94 get_terminal_size();
95@@ -266,49 +290,63 @@
96 do_exit(2);
97 }
98
99+ memset(&mbs, 0, sizeof(mbs));
100 for (y = show_title; y < height; y++) {
101 int eolseen = 0, tabpending = 0;
102 for (x = 0; x < width; x++) {
103- int c = ' ';
104- int attr = 0;
105+ wint_t c = L' ';
106+ int attr = 0, c_width;
107+ cchar_t cc;
108+ wchar_t wstr[2];
109
110 if (!eolseen) {
111 /* if there is a tab pending, just spit spaces until the
112 next stop instead of reading characters */
113 if (!tabpending)
114 do
115- c = getc(p);
116- while (c != EOF && !isprint(c)
117- && c != '\n'
118- && c != '\t');
119- if (c == '\n')
120+ c = readwc(p, &mbs);
121+ while (c != WEOF && !iswprint(c)
122+ && c != L'\n'
123+ && c != L'\t');
124+ if (c == L'\n')
125 if (!oldeolseen && x == 0) {
126 x = -1;
127 continue;
128 } else
129 eolseen = 1;
130- else if (c == '\t')
131+ else if (c == L'\t')
132 tabpending = 1;
133- if (c == EOF || c == '\n' || c == '\t')
134- c = ' ';
135+ if (c == WEOF || c == L'\n' || c == L'\t')
136+ c = L' ';
137 if (tabpending && (((x + 1) % 8) == 0))
138 tabpending = 0;
139 }
140+ wstr[0] = c;
141+ wstr[1] = 0;
142+ setcchar (&cc, wstr, 0, 0, NULL);
143 move(y, x);
144 if (option_differences) {
145- int oldch = inch();
146- char oldc = oldch & A_CHARTEXT;
147+ cchar_t oldc;
148+ wchar_t oldwstr[2];
149+ attr_t attrs;
150+ short colors;
151+
152+ in_wch(&oldc);
153+ getcchar(&oldc, oldwstr, &attrs, &colors, NULL);
154 attr = !first_screen
155- && (c != oldc
156+ && (wstr[0] != oldwstr[0]
157 ||
158 (option_differences_cumulative
159- && (oldch & A_ATTRIBUTES)));
160+ && attrs));
161 }
162 if (attr)
163 standout();
164- addch(c);
165+ add_wch(&cc);
166 if (attr)
167 standend();
168+ c_width = wcwidth(c);
169+ if (c_width > 1)
170+ x += c_width - 1;
171 }
172 oldeolseen = eolseen;
173 }
Note: See TracBrowser for help on using the repository browser.