From 6fc4ae7a28f4603daee61672949835aa6e6059ff Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 12 Mar 1996 23:49:29 +0000 Subject: [PATCH] (main): Initialize for internationalized message support: call setlocale, bindtextdomain, and textdomain. --- src/basename.c | 3 +++ src/date.c | 3 +++ src/dirname.c | 3 +++ src/echo.c | 3 +++ src/env.c | 3 +++ src/expr.c | 3 +++ src/factor.c | 3 +++ src/hostname.c | 7 +++++-- src/id.c | 3 +++ src/logname.c | 3 +++ src/nice.c | 4 ++++ src/pathchk.c | 3 +++ src/printenv.c | 3 +++ src/printf.c | 4 ++++ src/pwd.c | 3 +++ src/seq.c | 4 ++++ src/sleep.c | 3 +++ src/stty.c | 3 +++ src/su.c | 4 ++++ src/tee.c | 4 ++++ src/test.c | 3 +++ src/tty.c | 4 ++++ src/uname.c | 4 ++++ src/who-users.c | 3 +++ src/whoami.c | 3 +++ src/yes.c | 3 +++ 26 files changed, 87 insertions(+), 2 deletions(-) diff --git a/src/basename.c b/src/basename.c index ad2dcdad76..6d2ea21f10 100644 --- a/src/basename.c +++ b/src/basename.c @@ -72,6 +72,9 @@ main (int argc, char **argv) char *name; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); parse_long_options (argc, argv, "basename", version_string, usage); diff --git a/src/date.c b/src/date.c index 744900e777..7b0c456c3e 100644 --- a/src/date.c +++ b/src/date.c @@ -159,6 +159,9 @@ main (int argc, char **argv) int option_specified_date; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); while ((optc = getopt_long (argc, argv, "d:f:r:Rs:u", long_options, NULL)) != EOF) diff --git a/src/dirname.c b/src/dirname.c index 52ef010e5b..82eca22296 100644 --- a/src/dirname.c +++ b/src/dirname.c @@ -62,6 +62,9 @@ main (int argc, char **argv) register char *slash; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); parse_long_options (argc, argv, "dirname", version_string, usage); diff --git a/src/echo.c b/src/echo.c index 9a72b553a6..3f31a444bd 100644 --- a/src/echo.c +++ b/src/echo.c @@ -107,6 +107,9 @@ main (int argc, char **argv) int display_return = 1, do_v9 = 0; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); parse_long_options (argc, argv, "echo", version_string, usage); diff --git a/src/env.c b/src/env.c index 0711de8c3d..24ad743de7 100644 --- a/src/env.c +++ b/src/env.c @@ -119,6 +119,9 @@ main (register int argc, register char **argv, char **envp) int ignore_environment = 0; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); while ((optc = getopt_long (argc, argv, "+iu:", longopts, (int *) 0)) != EOF) { diff --git a/src/expr.c b/src/expr.c index f6e13aa215..3376a6dfd2 100644 --- a/src/expr.c +++ b/src/expr.c @@ -155,6 +155,9 @@ main (int argc, char **argv) VALUE *v; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); parse_long_options (argc, argv, "expr", version_string, usage); diff --git a/src/factor.c b/src/factor.c index 816b266888..11251244c5 100644 --- a/src/factor.c +++ b/src/factor.c @@ -174,6 +174,9 @@ main (int argc, char **argv) int fail; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); parse_long_options (argc, argv, "factor", version_string, usage); diff --git a/src/hostname.c b/src/hostname.c index fff5954c09..239dba08ca 100644 --- a/src/hostname.c +++ b/src/hostname.c @@ -38,9 +38,9 @@ sethostname (name, namelen) { /* Using sysinfo() is the SVR4 mechanism to set a hostname. */ int result; - + result = sysinfo (SI_SET_HOSTNAME, name, namelen); - + return (result == -1 ? result : 0); } @@ -79,6 +79,9 @@ main (int argc, char **argv) char *hostname; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); parse_long_options (argc, argv, "hostname", version_string, usage); diff --git a/src/id.c b/src/id.c index 5864415d88..a03ba6e689 100644 --- a/src/id.c +++ b/src/id.c @@ -101,6 +101,9 @@ main (int argc, char **argv) int optc; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); while ((optc = getopt_long (argc, argv, "gnruG", longopts, (int *) 0)) != EOF) diff --git a/src/logname.c b/src/logname.c index 9a0b0ec485..9d71c751e7 100644 --- a/src/logname.c +++ b/src/logname.c @@ -65,6 +65,9 @@ main (int argc, char **argv) int c; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF) { diff --git a/src/nice.c b/src/nice.c index 61d4d87a8c..579a206bef 100644 --- a/src/nice.c +++ b/src/nice.c @@ -64,6 +64,10 @@ main (int argc, char **argv) int last_optind = 0; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + parse_long_options (argc, argv, "nice", version_string, usage); for (optind = 1; optind < argc; /* empty */) diff --git a/src/pathchk.c b/src/pathchk.c index 3aaa099688..ad5daddf69 100644 --- a/src/pathchk.c +++ b/src/pathchk.c @@ -121,6 +121,9 @@ main (int argc, char **argv) int optc; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); while ((optc = getopt_long (argc, argv, "p", longopts, (int *) 0)) != EOF) { diff --git a/src/printenv.c b/src/printenv.c index 9e13aa3fe7..6bc45c1fa5 100644 --- a/src/printenv.c +++ b/src/printenv.c @@ -83,6 +83,9 @@ main (int argc, char **argv) int exit_status; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF) { diff --git a/src/printf.c b/src/printf.c index 35eb193192..7c5f338a96 100644 --- a/src/printf.c +++ b/src/printf.c @@ -132,6 +132,10 @@ main (int argc, char **argv) int args_used; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + exit_status = 0; parse_long_options (argc, argv, "printf", version_string, usage); diff --git a/src/pwd.c b/src/pwd.c index ff9f6d93ac..c61c19438a 100644 --- a/src/pwd.c +++ b/src/pwd.c @@ -56,6 +56,9 @@ main (int argc, char **argv) char *wd; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); parse_long_options (argc, argv, "pwd", version_string, usage); diff --git a/src/seq.c b/src/seq.c index dae55db97d..cdfcd6da36 100644 --- a/src/seq.c +++ b/src/seq.c @@ -103,6 +103,10 @@ main (int argc, char **argv) int step_is_set; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + equal_width = 0; format_str = NULL; separator = "\n"; diff --git a/src/sleep.c b/src/sleep.c index dcf4db65e2..b37e943931 100644 --- a/src/sleep.c +++ b/src/sleep.c @@ -69,6 +69,9 @@ main (int argc, char **argv) int c; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF) { diff --git a/src/stty.c b/src/stty.c index 72a6f1afe0..e18e34bb33 100644 --- a/src/stty.c +++ b/src/stty.c @@ -650,6 +650,9 @@ main (int argc, char **argv) int k; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); parse_long_options (argc, argv, "stty", version_string, usage); diff --git a/src/su.c b/src/su.c index 44cacbb3e6..25168fc14d 100644 --- a/src/su.c +++ b/src/su.c @@ -195,6 +195,10 @@ main (argc, argv) struct passwd pw_copy; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + fast_startup = 0; simulate_login = 0; change_environment = 1; diff --git a/src/tee.c b/src/tee.c index 34dc614c87..95018ddb79 100644 --- a/src/tee.c +++ b/src/tee.c @@ -84,6 +84,10 @@ main (int argc, char **argv) int optc; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + append = 0; ignore_interrupts = 0; diff --git a/src/test.c b/src/test.c index 512ccfb5e6..face6a5b2f 100644 --- a/src/test.c +++ b/src/test.c @@ -1065,6 +1065,9 @@ main (int margc, char **margv) return (test_error_return); #else /* TEST_STANDALONE */ program_name = margv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); #endif /* TEST_STANDALONE */ argv = margv; diff --git a/src/tty.c b/src/tty.c index 5986063392..26c293bb7b 100644 --- a/src/tty.c +++ b/src/tty.c @@ -61,6 +61,10 @@ main (int argc, char **argv) int optc; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + silent = 0; while ((optc = getopt_long (argc, argv, "s", longopts, (int *) 0)) != EOF) diff --git a/src/uname.c b/src/uname.c index ca1caa0c42..e64af98ed4 100644 --- a/src/uname.c +++ b/src/uname.c @@ -88,6 +88,10 @@ main (int argc, char **argv) int c; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + toprint = 0; while ((c = getopt_long (argc, argv, "snrvma", long_options, (int *) 0)) diff --git a/src/who-users.c b/src/who-users.c index 4518e152da..4cc9206abe 100644 --- a/src/who-users.c +++ b/src/who-users.c @@ -573,6 +573,9 @@ main (int argc, char **argv) #endif /* WHO */ program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); #ifdef WHO while ((optc = getopt_long (argc, argv, "imqsuwHT", longopts, &longind)) diff --git a/src/whoami.c b/src/whoami.c index 66293d8496..0bd3cdddec 100644 --- a/src/whoami.c +++ b/src/whoami.c @@ -70,6 +70,9 @@ main (int argc, char **argv) int c; program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); while ((c = getopt_long (argc, argv, "", long_options, (int *) 0)) != EOF) { diff --git a/src/yes.c b/src/yes.c index 2b78ea51cf..58a06d6a63 100644 --- a/src/yes.c +++ b/src/yes.c @@ -50,6 +50,9 @@ void main (int argc, char **argv) { program_name = argv[0]; + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); parse_long_options (argc, argv, "yes", version_string, usage); -- 2.47.2