]> granicus.if.org Git - procps-ng/commitdiff
nls: add functions which take translations to be used
authorSami Kerola <kerolasa@iki.fi>
Wed, 7 Dec 2011 12:27:21 +0000 (13:27 +0100)
committerSami Kerola <kerolasa@iki.fi>
Tue, 20 Dec 2011 16:30:53 +0000 (17:30 +0100)
Add the following three functions to most of the commands.

setlocale (LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);

Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
pgrep.c
pmap.c
ps/display.c
pwdx.c
skill.c
sysctl.c
tload.c
uptime.c
vmstat.c
w.c
watch.c

diff --git a/pgrep.c b/pgrep.c
index 13e6dee4d494b9961a6ffd678cec912e0f7bdc50..8cb4a82cce86e2a263f0b5128f92a72f4ed86830 100644 (file)
--- a/pgrep.c
+++ b/pgrep.c
@@ -761,6 +761,10 @@ int main (int argc, char **argv)
        union el *procs;
        int num;
 
+       setlocale (LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
+
        parse_opts (argc, argv);
 
        procs = select_procs (&num);
diff --git a/pmap.c b/pmap.c
index 26a76b18202251330d5decb3686e00d775076400..1c9bcc8774a3875c374d5650e780f953670111ba 100644 (file)
--- a/pmap.c
+++ b/pmap.c
@@ -384,6 +384,10 @@ int main(int argc, char **argv)
                {NULL, 0, NULL, 0}
        };
 
+       setlocale (LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
+
        x_option = d_option = q_option = 0;
 
        while ((c = getopt_long(argc, argv, "xrdqA:hV", longopts, NULL)) != -1)
index c9125e7afcfbdad03ece9ba30c9d3af6be679dfb..2917edb5017610c8470c0a0ab6f4551cf620f26d 100644 (file)
@@ -530,7 +530,9 @@ static void fancy_spew(void){
 /***** no comment */
 int main(int argc, char *argv[]){
 #if (__GNU_LIBRARY__ >= 6)
-  setlocale (LC_CTYPE, "");
+  setlocale (LC_ALL, "");
+  bindtextdomain(PACKAGE, LOCALEDIR);
+  textdomain(PACKAGE);
 #endif
 
 #ifdef DEBUG
diff --git a/pwdx.c b/pwdx.c
index 7e6b251195cdafbf06aba20bfb1d0cac9b95c459..2c699086aeba453d1f28d1fe3290d62b5cf4fcf7 100644 (file)
--- a/pwdx.c
+++ b/pwdx.c
@@ -48,6 +48,10 @@ int main(int argc, char *argv[])
                {NULL, 0, 0, 0}
        };
 
+       setlocale (LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
+
        while ((ch = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
                switch (ch) {
                case 'V':
diff --git a/skill.c b/skill.c
index 2d7982727c3141bded8f0e488e3547c1fe1ec8dc..22e9617eb10b3a47c005399727ee7437a9c54024 100644 (file)
--- a/skill.c
+++ b/skill.c
@@ -363,6 +363,10 @@ static void __attribute__ ((__noreturn__))
                {NULL, 0, NULL, 0}
        };
 
+       setlocale (LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
+
        if (argc < 2)
                kill_usage(stderr);
 
index b7d89a3bf0335562cdaf2d10cead9a19937ca8b7..e51f8d6f9bc7885c0d087f4ec3b007f45bc55a8c 100644 (file)
--- a/sysctl.c
+++ b/sysctl.c
@@ -610,6 +610,10 @@ int main(int argc, char *argv[])
        {NULL, 0, NULL, 0}
     };
 
+   setlocale (LC_ALL, "");
+   bindtextdomain(PACKAGE, LOCALEDIR);
+   textdomain(PACKAGE);
+
    PrintName = true;
    PrintNewline = true;
    IgnoreError = false;
diff --git a/tload.c b/tload.c
index e1cfd46b4681e5d329f606ef7fc3a452a6115086..23b243d12f6c92733efb64aa8f7d38a56adaca67 100644 (file)
--- a/tload.c
+++ b/tload.c
@@ -96,7 +96,12 @@ int main(int argc, char **argv)
                {NULL, 0, NULL, 0}
        };
 
-       while ((opt = getopt_long(argc, argv, "s:d:Vh", longopts, NULL)) != -1)
+       setlocale (LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
+
+       while ((opt =
+               getopt_long(argc, argv, "s:d:Vh", longopts, NULL)) != -1)
                switch (opt) {
                case 's':
                        scale_arg = optarg;
index 51c4c557400292030c2845cb26088b4ce7b82f7d..6ad5d1fd71d65eda289c1d392b354e4a7aaf44f5 100644 (file)
--- a/uptime.c
+++ b/uptime.c
@@ -30,6 +30,10 @@ int main(int argc, char **argv)
                {NULL, 0, NULL, 0}
        };
 
+       setlocale (LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
+
        while ((c = getopt_long(argc, argv, "hV", longopts, NULL)) != -1)
                switch (c) {
                case 'h':
index 0f8f889366e4828d7eb1c0670055581dae097ca6..a81ecdf2167d62da2ac5173d5859c8bf486a1be8 100644 (file)
--- a/vmstat.c
+++ b/vmstat.c
@@ -620,6 +620,10 @@ int main(int argc, char *argv[])
                {NULL, 0, NULL, 0}
        };
 
+       setlocale (LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
+
        while ((c =
                getopt_long(argc, argv, "afmnsdDp:S:hV", longopts,
                            NULL)) != EOF)
diff --git a/w.c b/w.c
index ccdbf766b82d016d7814ca746ca1e305e1425636..001b0724a7ee1549d5c157fb86a6c718a673084d 100644 (file)
--- a/w.c
+++ b/w.c
@@ -343,12 +343,16 @@ int main(int argc, char **argv)
                {NULL, 0, NULL, 0}
        };
 
+       setlocale (LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
+
 #ifndef W_SHOWFROM
        from = 0;
 #endif
 
-       setlocale(LC_ALL, "");
-       while ((ch = getopt_long(argc, argv, "hlusfVo", longopts, NULL)) != -1)
+       while ((ch =
+               getopt_long(argc, argv, "hlusfV", longopts, NULL)) != -1)
                switch (ch) {
                case 'h':
                        header = 0;
diff --git a/watch.c b/watch.c
index bc7c49c579d43e4c1d4c63dcb59936765f12c891..97dce3d6ccfd691f00ba73a1e8f3590a4c1511f3 100644 (file)
--- a/watch.c
+++ b/watch.c
@@ -309,6 +309,8 @@ int main(int argc, char *argv[])
        };
 
        setlocale(LC_ALL, "");
+       bindtextdomain(PACKAGE, LOCALEDIR);
+       textdomain(PACKAGE);
 
        while ((optc =
                getopt_long(argc, argv, "+bced::hn:pvtx", longopts, (int *)0))