diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-21 00:09:37 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-21 00:09:37 +0000 |
| commit | fcdb00f7359488d197ac3361dfbc49ccdead8b87 (patch) | |
| tree | f9dae67bb1b22c7249c24e20b7f4ae82ec824d52 | |
| parent | 6c85ddc8509e4b72ca5b4e47ca5085101a02f07c (diff) | |
| download | busybox-w32-fcdb00f7359488d197ac3361dfbc49ccdead8b87.tar.gz busybox-w32-fcdb00f7359488d197ac3361dfbc49ccdead8b87.tar.bz2 busybox-w32-fcdb00f7359488d197ac3361dfbc49ccdead8b87.zip | |
httpd: LC_TIME locale _must_ be POSIX to httpd! We speak over the net!
| -rw-r--r-- | applets/busybox.c | 4 | ||||
| -rw-r--r-- | coreutils/cal.c | 7 | ||||
| -rw-r--r-- | coreutils/ls.c | 2 | ||||
| -rw-r--r-- | coreutils/wc.c | 2 | ||||
| -rw-r--r-- | networking/httpd.c | 15 | ||||
| -rw-r--r-- | shell/ash.c | 1 | ||||
| -rw-r--r-- | shell/lash.c | 5 |
7 files changed, 19 insertions, 17 deletions
diff --git a/applets/busybox.c b/applets/busybox.c index 9f2eddebd..4d59b4518 100644 --- a/applets/busybox.c +++ b/applets/busybox.c | |||
| @@ -64,8 +64,8 @@ int main(int argc, char **argv) | |||
| 64 | for (s = applet_name; *s ;) | 64 | for (s = applet_name; *s ;) |
| 65 | if (*(s++) == '/') applet_name = s; | 65 | if (*(s++) == '/') applet_name = s; |
| 66 | 66 | ||
| 67 | /* Set locale for everybody except `init' */ | 67 | /* Set locale for everybody except 'init' */ |
| 68 | if(ENABLE_LOCALE_SUPPORT && getpid() != 1) | 68 | if (ENABLE_LOCALE_SUPPORT && getpid() != 1) |
| 69 | setlocale(LC_ALL, ""); | 69 | setlocale(LC_ALL, ""); |
| 70 | 70 | ||
| 71 | run_applet_by_name(applet_name, argc, argv); | 71 | run_applet_by_name(applet_name, argc, argv); |
diff --git a/coreutils/cal.c b/coreutils/cal.c index 6f5f0a434..681a88d90 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c | |||
| @@ -87,9 +87,10 @@ int cal_main(int argc, char **argv) | |||
| 87 | char day_headings[28]; /* 28 for julian, 21 for nonjulian */ | 87 | char day_headings[28]; /* 28 for julian, 21 for nonjulian */ |
| 88 | char buf[40]; | 88 | char buf[40]; |
| 89 | 89 | ||
| 90 | #ifdef CONFIG_LOCALE_SUPPORT | 90 | // Done in busybox.c, ok to remove? |
| 91 | setlocale(LC_TIME, ""); | 91 | //#ifdef CONFIG_LOCALE_SUPPORT |
| 92 | #endif | 92 | // setlocale(LC_TIME, ""); |
| 93 | //#endif | ||
| 93 | 94 | ||
| 94 | flags = getopt32(argc, argv, "jy"); | 95 | flags = getopt32(argc, argv, "jy"); |
| 95 | 96 | ||
diff --git a/coreutils/ls.c b/coreutils/ls.c index 8a83d7543..909f4d54e 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
| @@ -359,7 +359,7 @@ static int sortcmp(const void *a, const void *b) | |||
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | if (dif == 0) { | 361 | if (dif == 0) { |
| 362 | /* sort by name- may be a tie_breaker for time or size cmp */ | 362 | /* sort by name - may be a tie_breaker for time or size cmp */ |
| 363 | if (ENABLE_LOCALE_SUPPORT) dif = strcoll(d1->name, d2->name); | 363 | if (ENABLE_LOCALE_SUPPORT) dif = strcoll(d1->name, d2->name); |
| 364 | else dif = strcmp(d1->name, d2->name); | 364 | else dif = strcmp(d1->name, d2->name); |
| 365 | } | 365 | } |
diff --git a/coreutils/wc.c b/coreutils/wc.c index 4b76e5499..973929ebe 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c | |||
| @@ -44,8 +44,6 @@ | |||
| 44 | #include "busybox.h" | 44 | #include "busybox.h" |
| 45 | 45 | ||
| 46 | #ifdef CONFIG_LOCALE_SUPPORT | 46 | #ifdef CONFIG_LOCALE_SUPPORT |
| 47 | #include <locale.h> | ||
| 48 | #include <ctype.h> | ||
| 49 | #define isspace_given_isprint(c) isspace(c) | 47 | #define isspace_given_isprint(c) isspace(c) |
| 50 | #else | 48 | #else |
| 51 | #undef isspace | 49 | #undef isspace |
diff --git a/networking/httpd.c b/networking/httpd.c index afcd089b0..47d41a1e2 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
| @@ -846,9 +846,11 @@ static int sendHeaders(HttpResponseNum responseNum) | |||
| 846 | time_t timer = time(0); | 846 | time_t timer = time(0); |
| 847 | char timeStr[80]; | 847 | char timeStr[80]; |
| 848 | int len; | 848 | int len; |
| 849 | enum { | ||
| 850 | numNames = sizeof(httpResponseNames) / sizeof(httpResponseNames[0]) | ||
| 851 | }; | ||
| 849 | 852 | ||
| 850 | for (i = 0; | 853 | for (i = 0; i < numNames; i++) { |
| 851 | i < (sizeof(httpResponseNames)/sizeof(httpResponseNames[0])); i++) { | ||
| 852 | if (httpResponseNames[i].type == responseNum) { | 854 | if (httpResponseNames[i].type == responseNum) { |
| 853 | responseString = httpResponseNames[i].name; | 855 | responseString = httpResponseNames[i].name; |
| 854 | infoString = httpResponseNames[i].info; | 856 | infoString = httpResponseNames[i].info; |
| @@ -1177,7 +1179,7 @@ static int sendCgi(const char *url, | |||
| 1177 | # error "PIPESIZE >= MAX_MEMORY_BUFF" | 1179 | # error "PIPESIZE >= MAX_MEMORY_BUFF" |
| 1178 | #endif | 1180 | #endif |
| 1179 | 1181 | ||
| 1180 | // There is something to read | 1182 | /* There is something to read */ |
| 1181 | count = safe_read(inFd, rbuf, PIPESIZE); | 1183 | count = safe_read(inFd, rbuf, PIPESIZE); |
| 1182 | if (count == 0) | 1184 | if (count == 0) |
| 1183 | break; /* closed */ | 1185 | break; /* closed */ |
| @@ -1197,7 +1199,7 @@ static int sendCgi(const char *url, | |||
| 1197 | break; | 1199 | break; |
| 1198 | 1200 | ||
| 1199 | if (DEBUG) | 1201 | if (DEBUG) |
| 1200 | fprintf(stderr, "cgi read %d bytes\n", count); | 1202 | fprintf(stderr, "cgi read %d bytes: '%.*s'\n", count, count, rbuf); |
| 1201 | } | 1203 | } |
| 1202 | } | 1204 | } |
| 1203 | } | 1205 | } |
| @@ -1838,6 +1840,11 @@ int httpd_main(int argc, char *argv[]) | |||
| 1838 | USE_FEATURE_HTTPD_SETUID(struct bb_uidgid_t ugid;) | 1840 | USE_FEATURE_HTTPD_SETUID(struct bb_uidgid_t ugid;) |
| 1839 | USE_FEATURE_HTTPD_AUTH_MD5(const char *pass;) | 1841 | USE_FEATURE_HTTPD_AUTH_MD5(const char *pass;) |
| 1840 | 1842 | ||
| 1843 | #if ENABLE_LOCALE_SUPPORT | ||
| 1844 | /* Undo busybox.c: we want to speak English in http (dates etc) */ | ||
| 1845 | setlocale(LC_TIME, "C"); | ||
| 1846 | #endif | ||
| 1847 | |||
| 1841 | config = xzalloc(sizeof(*config)); | 1848 | config = xzalloc(sizeof(*config)); |
| 1842 | #if ENABLE_FEATURE_HTTPD_BASIC_AUTH | 1849 | #if ENABLE_FEATURE_HTTPD_BASIC_AUTH |
| 1843 | config->realm = "Web Server Authentication"; | 1850 | config->realm = "Web Server Authentication"; |
diff --git a/shell/ash.c b/shell/ash.c index 3c7639707..4fef0f2d3 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -1495,7 +1495,6 @@ static void getoptsreset(const char *); | |||
| 1495 | #endif | 1495 | #endif |
| 1496 | 1496 | ||
| 1497 | #ifdef CONFIG_LOCALE_SUPPORT | 1497 | #ifdef CONFIG_LOCALE_SUPPORT |
| 1498 | #include <locale.h> | ||
| 1499 | static void change_lc_all(const char *value); | 1498 | static void change_lc_all(const char *value); |
| 1500 | static void change_lc_ctype(const char *value); | 1499 | static void change_lc_ctype(const char *value); |
| 1501 | #endif | 1500 | #endif |
diff --git a/shell/lash.c b/shell/lash.c index 4067bc6bc..472cbddb9 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
| @@ -25,10 +25,6 @@ | |||
| 25 | #include <getopt.h> | 25 | #include <getopt.h> |
| 26 | #include "cmdedit.h" | 26 | #include "cmdedit.h" |
| 27 | 27 | ||
| 28 | #ifdef CONFIG_LOCALE_SUPPORT | ||
| 29 | #include <locale.h> | ||
| 30 | #endif | ||
| 31 | |||
| 32 | #include <glob.h> | 28 | #include <glob.h> |
| 33 | #define expand_t glob_t | 29 | #define expand_t glob_t |
| 34 | 30 | ||
| @@ -377,6 +373,7 @@ static int builtin_export(struct child_prog *child) | |||
| 377 | #endif | 373 | #endif |
| 378 | 374 | ||
| 379 | #ifdef CONFIG_LOCALE_SUPPORT | 375 | #ifdef CONFIG_LOCALE_SUPPORT |
| 376 | // TODO: why getenv? "" would be just as good... | ||
| 380 | if(strncmp(v, "LC_ALL=", 7)==0) | 377 | if(strncmp(v, "LC_ALL=", 7)==0) |
| 381 | setlocale(LC_ALL, getenv("LC_ALL")); | 378 | setlocale(LC_ALL, getenv("LC_ALL")); |
| 382 | if(strncmp(v, "LC_CTYPE=", 9)==0) | 379 | if(strncmp(v, "LC_CTYPE=", 9)==0) |
