svn commit: trunk/busybox: applets coreutils networking shell

vda at busybox.net vda at busybox.net
Tue Nov 21 00:09:38 UTC 2006


Author: vda
Date: 2006-11-20 16:09:37 -0800 (Mon, 20 Nov 2006)
New Revision: 16596

Log:
httpd: LC_TIME locale _must_ be POSIX to httpd! We speak over the net!


Modified:
   trunk/busybox/applets/busybox.c
   trunk/busybox/coreutils/cal.c
   trunk/busybox/coreutils/ls.c
   trunk/busybox/coreutils/wc.c
   trunk/busybox/networking/httpd.c
   trunk/busybox/shell/ash.c
   trunk/busybox/shell/lash.c


Changeset:
Modified: trunk/busybox/applets/busybox.c
===================================================================
--- trunk/busybox/applets/busybox.c	2006-11-21 00:08:39 UTC (rev 16595)
+++ trunk/busybox/applets/busybox.c	2006-11-21 00:09:37 UTC (rev 16596)
@@ -64,8 +64,8 @@
 	for (s = applet_name; *s ;)
 		if (*(s++) == '/') applet_name = s;
 
-	/* Set locale for everybody except `init' */
-	if(ENABLE_LOCALE_SUPPORT && getpid() != 1)
+	/* Set locale for everybody except 'init' */
+	if (ENABLE_LOCALE_SUPPORT && getpid() != 1)
 		setlocale(LC_ALL, "");
 
 	run_applet_by_name(applet_name, argc, argv);

Modified: trunk/busybox/coreutils/cal.c
===================================================================
--- trunk/busybox/coreutils/cal.c	2006-11-21 00:08:39 UTC (rev 16595)
+++ trunk/busybox/coreutils/cal.c	2006-11-21 00:09:37 UTC (rev 16596)
@@ -87,9 +87,10 @@
 	char day_headings[28];	/* 28 for julian, 21 for nonjulian */
 	char buf[40];
 
-#ifdef CONFIG_LOCALE_SUPPORT
-	setlocale(LC_TIME, "");
-#endif
+// Done in busybox.c, ok to remove?
+//#ifdef CONFIG_LOCALE_SUPPORT
+//	setlocale(LC_TIME, "");
+//#endif
 
 	flags = getopt32(argc, argv, "jy");
 

Modified: trunk/busybox/coreutils/ls.c
===================================================================
--- trunk/busybox/coreutils/ls.c	2006-11-21 00:08:39 UTC (rev 16595)
+++ trunk/busybox/coreutils/ls.c	2006-11-21 00:09:37 UTC (rev 16596)
@@ -359,7 +359,7 @@
 	}
 
 	if (dif == 0) {
-		/* sort by name- may be a tie_breaker for time or size cmp */
+		/* sort by name - may be a tie_breaker for time or size cmp */
 		if (ENABLE_LOCALE_SUPPORT) dif = strcoll(d1->name, d2->name);
 		else dif = strcmp(d1->name, d2->name);
 	}

Modified: trunk/busybox/coreutils/wc.c
===================================================================
--- trunk/busybox/coreutils/wc.c	2006-11-21 00:08:39 UTC (rev 16595)
+++ trunk/busybox/coreutils/wc.c	2006-11-21 00:09:37 UTC (rev 16596)
@@ -44,8 +44,6 @@
 #include "busybox.h"
 
 #ifdef CONFIG_LOCALE_SUPPORT
-#include <locale.h>
-#include <ctype.h>
 #define isspace_given_isprint(c) isspace(c)
 #else
 #undef isspace

Modified: trunk/busybox/networking/httpd.c
===================================================================
--- trunk/busybox/networking/httpd.c	2006-11-21 00:08:39 UTC (rev 16595)
+++ trunk/busybox/networking/httpd.c	2006-11-21 00:09:37 UTC (rev 16596)
@@ -846,9 +846,11 @@
 	time_t timer = time(0);
 	char timeStr[80];
 	int len;
+	enum {
+		numNames = sizeof(httpResponseNames) / sizeof(httpResponseNames[0])
+	};
 
-	for (i = 0;
-		i < (sizeof(httpResponseNames)/sizeof(httpResponseNames[0])); i++) {
+	for (i = 0; i < numNames; i++) {
 		if (httpResponseNames[i].type == responseNum) {
 			responseString = httpResponseNames[i].name;
 			infoString = httpResponseNames[i].info;
@@ -1177,7 +1179,7 @@
 # error "PIPESIZE >= MAX_MEMORY_BUFF"
 #endif
 
-			// There is something to read
+			/* There is something to read */
 			count = safe_read(inFd, rbuf, PIPESIZE);
 			if (count == 0)
 				break;  /* closed */
@@ -1197,7 +1199,7 @@
 					break;
 
 				if (DEBUG)
-					fprintf(stderr, "cgi read %d bytes\n", count);
+					fprintf(stderr, "cgi read %d bytes: '%.*s'\n", count, count, rbuf);
 			}
 		}
 	}
@@ -1838,6 +1840,11 @@
 	USE_FEATURE_HTTPD_SETUID(struct bb_uidgid_t ugid;)
 	USE_FEATURE_HTTPD_AUTH_MD5(const char *pass;)
 
+#if ENABLE_LOCALE_SUPPORT
+	/* Undo busybox.c: we want to speak English in http (dates etc) */
+	setlocale(LC_TIME, "C");
+#endif
+
 	config = xzalloc(sizeof(*config));
 #if ENABLE_FEATURE_HTTPD_BASIC_AUTH
 	config->realm = "Web Server Authentication";

Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2006-11-21 00:08:39 UTC (rev 16595)
+++ trunk/busybox/shell/ash.c	2006-11-21 00:09:37 UTC (rev 16596)
@@ -1495,7 +1495,6 @@
 #endif
 
 #ifdef CONFIG_LOCALE_SUPPORT
-#include <locale.h>
 static void change_lc_all(const char *value);
 static void change_lc_ctype(const char *value);
 #endif

Modified: trunk/busybox/shell/lash.c
===================================================================
--- trunk/busybox/shell/lash.c	2006-11-21 00:08:39 UTC (rev 16595)
+++ trunk/busybox/shell/lash.c	2006-11-21 00:09:37 UTC (rev 16596)
@@ -25,10 +25,6 @@
 #include <getopt.h>
 #include "cmdedit.h"
 
-#ifdef CONFIG_LOCALE_SUPPORT
-#include <locale.h>
-#endif
-
 #include <glob.h>
 #define expand_t	glob_t
 
@@ -377,6 +373,7 @@
 #endif
 
 #ifdef CONFIG_LOCALE_SUPPORT
+	// TODO: why getenv? "" would be just as good...
 	if(strncmp(v, "LC_ALL=", 7)==0)
 		setlocale(LC_ALL, getenv("LC_ALL"));
 	if(strncmp(v, "LC_CTYPE=", 9)==0)




More information about the busybox-cvs mailing list