From: albert <> Date: Tue, 8 Oct 2002 18:45:19 +0000 (+0000) Subject: Alexandra N. Kossovsky's KOI8-R locale fix #153043 X-Git-Tag: v3.3.0~477 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f0b745c22246fc96e91a9f50bde8d2f656682c7e;p=procps-ng Alexandra N. Kossovsky's KOI8-R locale fix #153043 --- diff --git a/proc/output.c b/proc/output.c index 66e4e407..a1a0c6a5 100644 --- a/proc/output.c +++ b/proc/output.c @@ -16,7 +16,7 @@ unsigned print_str(FILE* file, char *s, unsigned max) { fputc(s[i], file); else { if (max - i > 3) { - fprintf(file, "\\%03o", s[i]); + fprintf(file, "\\%03o", (unsigned char)s[i]); i += 3; /* 4 printed, but i counts one */ } else return max - i; @@ -36,7 +36,7 @@ unsigned print_strlist(FILE* file, char **strs, char* sep, unsigned max) { fputc(strs[0][i], file); else { if (max-(n+i) > 3) { - fprintf(file, "\\%03o", strs[0][i]); + fprintf(file, "\\%03o", (unsigned char)strs[0][i]); n += 3; /* 4 printed, but i counts one */ } else return max - n; diff --git a/w.c b/w.c index 7d112b91..dfb7ee3b 100644 --- a/w.c +++ b/w.c @@ -23,7 +23,7 @@ #include #include #include -/* #include */ /* for HZ */ +#include static int ignoreuser = 0; /* for '-u' */ static proc_t **procs; /* our snapshot of the process table */ @@ -238,6 +238,7 @@ int main(int argc, char **argv) { from = 0; #endif + setlocale(LC_ALL, ""); for (args=0; (ch = getopt(argc, argv, "hlusfV")) != EOF; args++) switch (ch) { case 'h': header = 0; break;