source: patches/procps-3.2.7-i18n-1.patch @ 9676bac

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 9676bac was 702b89c, checked in by Jim Gifford <clfs@…>, 15 years ago

Added: procps-3.2.7-i18n-1.patch

  • Property mode set to 100644
File size: 4.5 KB
  • procps-3.2.7

    Submitted By: Jim Gifford <jim at cross-lfs dot org>
    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
    old new  
    6767# plus the top-level Makefile to make it work stand-alone.
    6868_TARFILES := Makefile
    6969
    70 CURSES := -lncurses
     70CURSES := -lncursesw
    7171
    7272# This seems about right for the dynamic library stuff.
    7373# Something like this is probably needed to make the SE Linux
  • procps-3.2.7

    diff -Naur procps-3.2.7.orig/sysctl.c procps-3.2.7/sysctl.c
    old new  
    135135   }
    136136
    137137   /* used to open the file */
    138    tmpname = malloc(strlen(name)+strlen(PROC_PATH)+1);
     138   tmpname = malloc(strlen(name)+strlen(PROC_PATH)+2);
    139139   strcpy(tmpname, PROC_PATH);
    140140   strcat(tmpname, name);
    141141   slashdot(tmpname+strlen(PROC_PATH),'.','/'); /* change . to / */
  • procps-3.2.7

    diff -Naur procps-3.2.7.orig/top.c procps-3.2.7/top.c
    old new  
    24622462   int i;
    24632463
    24642464   for (i = 0; i < GROUPSMAX; i++) {
    2465       win_names(&Winstk[i], Winstk[i].rc.winname);
     2465      /* Please, never use something like sprintf(x, "%s", x); ... see win_names() */
     2466      char buf[WINNAMSIZ];
     2467      strncpy(buf, Winstk[i].rc.winname, WINNAMSIZ);
     2468      win_names(&Winstk[i], buf);
    24662469      capsmk(&Winstk[i]);
    24672470   }
    24682471   // rely on this next guy to force a call (eventually) to reframewins
  • procps-3.2.7

    diff -Naur procps-3.2.7.orig/watch.c procps-3.2.7/watch.c
    old new  
    1919#include <stdio.h>
    2020#include <stdlib.h>
    2121#include <string.h>
     22#include <wchar.h>
     23#include <wctype.h>
    2224#include <sys/ioctl.h>
    2325#include <time.h>
    2426#include <unistd.h>
     
    134136        }
    135137}
    136138
     139static wint_t
     140readwc(FILE *stream, mbstate_t *mbs)
     141{
     142        for (;;) {
     143                int chr;
     144                char c;
     145                wchar_t wc;
     146                size_t len;
     147
     148                chr = getc(stream);
     149                if (chr == EOF)
     150                        return WEOF;
     151                c = chr;
     152                len = mbrtowc(&wc, &c, 1, mbs);
     153                if (len == (size_t)-1)
     154                        memset(mbs, 0, sizeof(*mbs));
     155                else if (len != (size_t)-2)
     156                        return wc;
     157        }
     158}
     159
    137160int
    138161main(int argc, char *argv[])
    139162{
     
    239262                FILE *p;
    240263                int x, y;
    241264                int oldeolseen = 1;
     265                mbstate_t mbs;
    242266
    243267                if (screen_size_changed) {
    244268                        get_terminal_size();
     
    266290                        do_exit(2);
    267291                }
    268292
     293                memset(&mbs, 0, sizeof(mbs));
    269294                for (y = show_title; y < height; y++) {
    270295                        int eolseen = 0, tabpending = 0;
    271296                        for (x = 0; x < width; x++) {
    272                                 int c = ' ';
    273                                 int attr = 0;
     297                                wint_t c = L' ';
     298                                int attr = 0, c_width;
     299                                cchar_t cc;
     300                                wchar_t wstr[2];
    274301
    275302                                if (!eolseen) {
    276303                                        /* if there is a tab pending, just spit spaces until the
    277304                                           next stop instead of reading characters */
    278305                                        if (!tabpending)
    279306                                                do
    280                                                         c = getc(p);
    281                                                 while (c != EOF && !isprint(c)
    282                                                        && c != '\n'
    283                                                        && c != '\t');
    284                                         if (c == '\n')
     307                                                        c = readwc(p, &mbs);
     308                                                while (c != WEOF && !iswprint(c)
     309                                                       && c != L'\n'
     310                                                       && c != L'\t');
     311                                        if (c == L'\n')
    285312                                                if (!oldeolseen && x == 0) {
    286313                                                        x = -1;
    287314                                                        continue;
    288315                                                } else
    289316                                                        eolseen = 1;
    290                                         else if (c == '\t')
     317                                        else if (c == L'\t')
    291318                                                tabpending = 1;
    292                                         if (c == EOF || c == '\n' || c == '\t')
    293                                                 c = ' ';
     319                                        if (c == WEOF || c == L'\n' || c == L'\t')
     320                                                c = L' ';
    294321                                        if (tabpending && (((x + 1) % 8) == 0))
    295322                                                tabpending = 0;
    296323                                }
     324                                wstr[0] = c;
     325                                wstr[1] = 0;
     326                                setcchar (&cc, wstr, 0, 0, NULL);
    297327                                move(y, x);
    298328                                if (option_differences) {
    299                                         int oldch = inch();
    300                                         char oldc = oldch & A_CHARTEXT;
     329                                        cchar_t oldc;
     330                                        wchar_t oldwstr[2];
     331                                        attr_t attrs;
     332                                        short colors;
     333
     334                                        in_wch(&oldc);
     335                                        getcchar(&oldc, oldwstr, &attrs, &colors, NULL);
    301336                                        attr = !first_screen
    302                                             && (c != oldc
     337                                            && (wstr[0] != oldwstr[0]
    303338                                                ||
    304339                                                (option_differences_cumulative
    305                                                  && (oldch & A_ATTRIBUTES)));
     340                                                 && attrs));
    306341                                }
    307342                                if (attr)
    308343                                        standout();
    309                                 addch(c);
     344                                add_wch(&cc);
    310345                                if (attr)
    311346                                        standend();
     347                                c_width = wcwidth(c);
     348                                if (c_width > 1)
     349                                        x += c_width - 1;
    312350                        }
    313351                        oldeolseen = eolseen;
    314352                }
Note: See TracBrowser for help on using the repository browser.