svn commit: trunk/busybox: archival editors findutils include init etc...

vda at busybox.net vda at busybox.net
Mon Jan 29 22:51:27 UTC 2007


Author: vda
Date: 2007-01-29 14:51:25 -0800 (Mon, 29 Jan 2007)
New Revision: 17654

Log:
preparatory patch for -Wwrite-strings #2


Modified:
   trunk/busybox/archival/dpkg.c
   trunk/busybox/archival/dpkg_deb.c
   trunk/busybox/editors/sed.c
   trunk/busybox/findutils/xargs.c
   trunk/busybox/include/libbb.h
   trunk/busybox/init/mesg.c
   trunk/busybox/libbb/dump.c
   trunk/busybox/libbb/get_last_path_component.c
   trunk/busybox/libbb/xfuncs.c
   trunk/busybox/miscutils/eject.c
   trunk/busybox/miscutils/hdparm.c
   trunk/busybox/miscutils/strings.c
   trunk/busybox/modutils/insmod.c
   trunk/busybox/modutils/lsmod.c
   trunk/busybox/networking/arping.c
   trunk/busybox/networking/ftpgetput.c
   trunk/busybox/networking/inetd.c
   trunk/busybox/networking/libiproute/utils.c
   trunk/busybox/networking/libiproute/utils.h
   trunk/busybox/networking/netstat.c
   trunk/busybox/networking/route.c
   trunk/busybox/networking/telnet.c
   trunk/busybox/networking/udhcp/common.h
   trunk/busybox/networking/udhcp/dhcpc.h
   trunk/busybox/networking/udhcp/script.c
   trunk/busybox/networking/udhcp/socket.c
   trunk/busybox/networking/wget.c
   trunk/busybox/shell/hush.c
   trunk/busybox/shell/msh.c
   trunk/busybox/util-linux/fbset.c
   trunk/busybox/util-linux/mdev.c
   trunk/busybox/util-linux/switch_root.c


Changeset:
Modified: trunk/busybox/archival/dpkg.c
===================================================================
--- trunk/busybox/archival/dpkg.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/archival/dpkg.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -1417,10 +1417,10 @@
 
 	/* We don't care about data.tar.* or debian-binary, just control.tar.* */
 #ifdef CONFIG_FEATURE_DEB_TAR_GZ
-	llist_add_to(&(ar_handle->accept), "control.tar.gz");
+	llist_add_to(&(ar_handle->accept), (char*)"control.tar.gz");
 #endif
 #ifdef CONFIG_FEATURE_DEB_TAR_BZ2
-	llist_add_to(&(ar_handle->accept), "control.tar.bz2");
+	llist_add_to(&(ar_handle->accept), (char*)"control.tar.bz2");
 #endif
 
 	/* Assign the tar handle as a subarchive of the ar handle */
@@ -1439,10 +1439,10 @@
 
 	/* We don't care about control.tar.* or debian-binary, just data.tar.* */
 #ifdef CONFIG_FEATURE_DEB_TAR_GZ
-	llist_add_to(&(ar_handle->accept), "data.tar.gz");
+	llist_add_to(&(ar_handle->accept), (char*)"data.tar.gz");
 #endif
 #ifdef CONFIG_FEATURE_DEB_TAR_BZ2
-	llist_add_to(&(ar_handle->accept), "data.tar.bz2");
+	llist_add_to(&(ar_handle->accept), (char*)"data.tar.bz2");
 #endif
 
 	/* Assign the tar handle as a subarchive of the ar handle */
@@ -1525,7 +1525,7 @@
 	archive_handle = init_archive_deb_ar(deb_file->filename);
 	init_archive_deb_data(archive_handle);
 	archive_handle->sub_archive->action_data = data_extract_all_prefix;
-	archive_handle->sub_archive->buffer = "/";
+	archive_handle->sub_archive->buffer = (char*)"/"; /* huh? */
 	archive_handle->sub_archive->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
 	unpack_ar_archive(archive_handle);
 
@@ -1629,7 +1629,7 @@
 			llist_t *control_list = NULL;
 
 			/* Extract the control file */
-			llist_add_to(&control_list, "./control");
+			llist_add_to(&control_list, (char*)"./control");
 			archive_handle = init_archive_deb_ar(argv[0]);
 			init_archive_deb_control(archive_handle);
 			deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list);

Modified: trunk/busybox/archival/dpkg_deb.c
===================================================================
--- trunk/busybox/archival/dpkg_deb.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/archival/dpkg_deb.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -19,7 +19,7 @@
 	archive_handle_t *tar_archive;
 	llist_t *control_tar_llist = NULL;
 	unsigned opt;
-	char *extract_dir = NULL;
+	const char *extract_dir = NULL;
 	short argcount = 1;
 
 	/* Setup the tar archive handle */
@@ -31,13 +31,13 @@
 	ar_archive->filter = filter_accept_list_reassign;
 
 #ifdef CONFIG_FEATURE_DEB_TAR_GZ
-	llist_add_to(&(ar_archive->accept), "data.tar.gz");
-	llist_add_to(&control_tar_llist, "control.tar.gz");
+	llist_add_to(&(ar_archive->accept), (char*)"data.tar.gz");
+	llist_add_to(&control_tar_llist, (char*)"control.tar.gz");
 #endif
 
 #ifdef CONFIG_FEATURE_DEB_TAR_BZ2
-	llist_add_to(&(ar_archive->accept), "data.tar.bz2");
-	llist_add_to(&control_tar_llist, "control.tar.bz2");
+	llist_add_to(&(ar_archive->accept), (char*)"data.tar.bz2");
+	llist_add_to(&control_tar_llist, (char*)"control.tar.bz2");
 #endif
 
 	opt_complementary = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
@@ -60,7 +60,7 @@
 		 * it should accept a second argument which specifies a
 		 * specific field to print */
 		ar_archive->accept = control_tar_llist;
-		llist_add_to(&(tar_archive->accept), "./control");
+		llist_add_to(&(tar_archive->accept), (char*)"./control");
 		tar_archive->filter = filter_accept_list;
 		tar_archive->action_data = data_extract_to_stdout;
 	}

Modified: trunk/busybox/editors/sed.c
===================================================================
--- trunk/busybox/editors/sed.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/editors/sed.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -168,7 +168,7 @@
 
 /* strdup, replacing "\n" with '\n', and "\delimiter" with 'delimiter' */
 
-static void parse_escapes(char *dest, char *string, int len, char from, char to)
+static void parse_escapes(char *dest, const char *string, int len, char from, char to)
 {
 	int i = 0;
 
@@ -186,7 +186,7 @@
 	*dest = 0;
 }
 
-static char *copy_parsing_escapes(char *string, int len)
+static char *copy_parsing_escapes(const char *string, int len)
 {
 	char *dest = xmalloc(len + 1);
 
@@ -201,7 +201,7 @@
  * expression delimiter (typically a forward * slash ('/')) not preceded by
  * a backslash ('\').  A negative delimiter disables square bracket checking.
  */
-static int index_of_next_unescaped_regexp_delim(int delimiter, char *str)
+static int index_of_next_unescaped_regexp_delim(int delimiter, const char *str)
 {
 	int bracket = -1;
 	int escaped = 0;
@@ -262,12 +262,12 @@
 /*
  * returns the index in the string just past where the address ends.
  */
-static int get_address(char *my_str, int *linenum, regex_t ** regex)
+static int get_address(const char *my_str, int *linenum, regex_t ** regex)
 {
-	char *pos = my_str;
+	const char *pos = my_str;
 
 	if (isdigit(*my_str)) {
-		*linenum = strtol(my_str, &pos, 10);
+		*linenum = strtol(my_str, (char**)&pos, 10);
 		/* endstr shouldnt ever equal NULL */
 	} else if (*my_str == '$') {
 		*linenum = -1;
@@ -314,7 +314,7 @@
 {
 	int cflags = bbg.regex_type;
 	char *match;
-	int idx = 0;
+	int idx;
 
 	/*
 	 * A substitution command should look something like this:
@@ -469,16 +469,16 @@
 
 /* Parse address+command sets, skipping comment lines. */
 
-static void add_cmd(char *cmdstr)
+static void add_cmd(const char *cmdstr)
 {
 	sed_cmd_t *sed_cmd;
 	int temp;
 
 	/* Append this line to any unfinished line from last time. */
 	if (bbg.add_cmd_line) {
-		cmdstr = xasprintf("%s\n%s", bbg.add_cmd_line, cmdstr);
+		char *tp = xasprintf("%s\n%s", bbg.add_cmd_line, cmdstr);
 		free(bbg.add_cmd_line);
-		bbg.add_cmd_line = cmdstr;
+		bbg.add_cmd_line = tp;
 	}
 
 	/* If this line ends with backslash, request next line. */

Modified: trunk/busybox/findutils/xargs.c
===================================================================
--- trunk/busybox/findutils/xargs.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/findutils/xargs.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -416,7 +416,7 @@
 	argv += optind;
 	if (!argc) {
 		/* default behavior is to echo all the filenames */
-		*argv = "echo";
+		*argv = (char*)"echo";
 		argc++;
 	}
 

Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/include/libbb.h	2007-01-29 22:51:25 UTC (rev 17654)
@@ -248,6 +248,8 @@
 /* this helper yells "short read!" if param is not -1 */
 extern void complain_copyfd_and_die(off_t sz) ATTRIBUTE_NORETURN;
 extern char bb_process_escape_sequence(const char **ptr);
+/* TODO: sometimes modifies its parameter, which
+ * makes it rather inconvenient at times: */
 extern char *bb_get_last_path_component(char *path);
 extern int ndelay_on(int fd);
 extern int ndelay_off(int fd);

Modified: trunk/busybox/init/mesg.c
===================================================================
--- trunk/busybox/init/mesg.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/init/mesg.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -8,8 +8,6 @@
  */
 
 #include "busybox.h"
-#include <unistd.h>
-#include <stdlib.h>
 
 #ifdef USE_TTY_GROUP
 #define S_IWGRP_OR_S_IWOTH	S_IWGRP
@@ -20,24 +18,24 @@
 int mesg_main(int argc, char *argv[])
 {
 	struct stat sb;
-	char *tty;
+	const char *tty;
 	char c = 0;
 
-	if ((--argc == 0)
-		|| ((argc == 1) && (((c = **++argv) == 'y') || (c == 'n')))) {
-		if ((tty = ttyname(STDERR_FILENO)) == NULL) {
+	if (--argc == 0
+	 || (argc == 1 && ((c = **++argv) == 'y' || c == 'n'))
+	) {
+		tty = ttyname(STDERR_FILENO);
+		if (tty == NULL) {
 			tty = "ttyname";
 		} else if (stat(tty, &sb) == 0) {
+			mode_t m;
 			if (argc == 0) {
-				puts(((sb.st_mode & (S_IWGRP | S_IWOTH)) ==
-					  0) ? "is n" : "is y");
+				puts((sb.st_mode & (S_IWGRP|S_IWOTH)) ? "is y" : "is n");
 				return EXIT_SUCCESS;
 			}
-			if (chmod
-				(tty,
-				 (c ==
-				  'y') ? sb.st_mode | (S_IWGRP_OR_S_IWOTH) : sb.
-				 st_mode & ~(S_IWGRP | S_IWOTH)) == 0) {
+			m = (c == 'y') ? sb.st_mode | S_IWGRP_OR_S_IWOTH
+			               : sb.st_mode & ~(S_IWGRP|S_IWOTH);
+			if (chmod(tty, m) == 0) {
 				return EXIT_SUCCESS;
 			}
 		}

Modified: trunk/busybox/libbb/dump.c
===================================================================
--- trunk/busybox/libbb/dump.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/libbb/dump.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -291,7 +291,7 @@
 	}
 }
 
-static void do_skip(char *fname, int statok)
+static void do_skip(const char *fname, int statok)
 {
 	struct stat sbuf;
 

Modified: trunk/busybox/libbb/get_last_path_component.c
===================================================================
--- trunk/busybox/libbb/get_last_path_component.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/libbb/get_last_path_component.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -26,7 +26,7 @@
 	if (*first == '/') {
 		last = first;
 	}
-	last[1] = 0;
+	last[1] = '\0';
 
 	return first;
 }

Modified: trunk/busybox/libbb/xfuncs.c
===================================================================
--- trunk/busybox/libbb/xfuncs.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/libbb/xfuncs.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -184,7 +184,7 @@
 	/* Why static? */
 	static int failed;
 	pid_t pid;
-	char *prog;
+	const char *prog;
 
 	// Be nice to nommu machines.
 	failed = 0;
@@ -240,7 +240,7 @@
 // Fifth char is always '\0'
 void smart_ulltoa5(unsigned long long ul, char buf[5])
 {
-	char *fmt;
+	const char *fmt;
 	char c;
 	unsigned v,idx = 0;
 	ul *= 10;

Modified: trunk/busybox/miscutils/eject.c
===================================================================
--- trunk/busybox/miscutils/eject.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/miscutils/eject.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -28,7 +28,7 @@
 int eject_main(int argc, char **argv)
 {
 	unsigned long flags;
-	char *device;
+	const char *device;
 	int dev, cmd;
 
 	opt_complementary = "?:?1:t--T:T--t";

Modified: trunk/busybox/miscutils/hdparm.c
===================================================================
--- trunk/busybox/miscutils/hdparm.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/miscutils/hdparm.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -463,9 +463,7 @@
 
 static void print_flag_on_off(unsigned long get_arg, const char *s, unsigned long arg)
 {
-
-	if (get_arg)
-	{
+	if (get_arg) {
 		printf(" setting %s to %ld", s, arg);
 		on_off(arg);
 	}
@@ -476,8 +474,7 @@
 {
 	if (ioctl(fd, request, &argp) != 0)
 		bb_perror_msg(" %s", string);
-	else
-	{
+	else {
 		printf(" %s\t= %2ld", str, (unsigned long) argp);
 		on_off((unsigned long) argp);
 	}
@@ -486,16 +483,15 @@
 #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY
 static void print_ascii(uint16_t *p, uint8_t length);
 
-static void xprint_ascii(uint16_t *val ,int i, char * string, int n)
+static void xprint_ascii(uint16_t *val ,int i, const char *string, int n)
 {
-	if (val[i])
-	{
-		printf("\t%-20s",string);
+	if (val[i]) {
+		printf("\t%-20s", string);
 		print_ascii(&val[i], n);
 	}
 }
 #endif
-/* end of  busybox specific stuff */
+/* end of busybox specific stuff */
 
 #ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY
 static uint8_t mode_loop(uint16_t mode_sup, uint16_t mode_sel, int cc, uint8_t *have_mode)
@@ -1587,7 +1583,7 @@
 }
 #endif /* HDIO_DRIVE_CMD */
 
-static void print_flag(unsigned long flag, char *s, unsigned long value)
+static void print_flag(unsigned long flag, const char *s, unsigned long value)
 {
 	if (flag)
 		printf(" setting %s to %ld\n", s, value);

Modified: trunk/busybox/miscutils/strings.c
===================================================================
--- trunk/busybox/miscutils/strings.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/miscutils/strings.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -26,7 +26,7 @@
 	FILE *file = stdin;
 	char *string;
 	const char *fmt = "%s: ";
-	char *n_arg = "4";
+	const char *n_arg = "4";
 
 	opt = getopt32(argc, argv, "afon:", &n_arg);
 	/* -a is our default behaviour */

Modified: trunk/busybox/modutils/insmod.c
===================================================================
--- trunk/busybox/modutils/insmod.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/modutils/insmod.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -1782,7 +1782,7 @@
 
 #if defined(USE_GOT_ENTRIES) || defined(USE_PLT_ENTRIES)
 
-static struct obj_section *arch_xsect_init(struct obj_file *f, char *name,
+static struct obj_section *arch_xsect_init(struct obj_file *f, const char *name,
 					   int offset, int size)
 {
 	struct obj_section *myrelsec = obj_find_section(f, name);

Modified: trunk/busybox/modutils/lsmod.c
===================================================================
--- trunk/busybox/modutils/lsmod.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/modutils/lsmod.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -161,7 +161,7 @@
 				printf("  %s", tok);
 				tok = strtok(NULL, "\n");
 				if (!tok)
-					tok = "";
+					tok = (char*)"";
 				/* New-style has commas, or -.  If so,
 				truncate (other fields might follow). */
 				else if (strchr(tok, ',')) {
@@ -170,9 +170,11 @@
 					if (tok[strlen(tok)-1] == ',')
 						tok[strlen(tok)-1] = '\0';
 				} else if (tok[0] == '-'
-						&& (tok[1] == '\0' || isspace(tok[1])))
-					tok = "";
-					printf(" %s", tok);
+				 && (tok[1] == '\0' || isspace(tok[1]))
+				) {
+					tok = (char*)"";
+				}
+				printf(" %s", tok);
 			}
 			puts("");
 			free(line);

Modified: trunk/busybox/networking/arping.c
===================================================================
--- trunk/busybox/networking/arping.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/arping.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -240,7 +240,7 @@
 
 int arping_main(int argc, char **argv)
 {
-	char *device = "eth0";
+	const char *device = "eth0";
 	int ifindex;
 	char *source = NULL;
 	char *target;

Modified: trunk/busybox/networking/ftpgetput.c
===================================================================
--- trunk/busybox/networking/ftpgetput.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/ftpgetput.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -17,8 +17,8 @@
 #include <getopt.h>
 
 typedef struct ftp_host_info_s {
-	char *user;
-	char *password;
+	const char *user;
+	const char *password;
 	struct len_and_sockaddr *lsa;
 } ftp_host_info_t;
 

Modified: trunk/busybox/networking/inetd.c
===================================================================
--- trunk/busybox/networking/inetd.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/inetd.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -327,7 +327,7 @@
 static struct servent *sp;
 static uid_t uid;
 
-static char *CONFIG = _PATH_INETDCONF;
+static const char *CONFIG = _PATH_INETDCONF;
 
 static FILE *fconfig;
 static char line[1024];

Modified: trunk/busybox/networking/libiproute/utils.c
===================================================================
--- trunk/busybox/networking/libiproute/utils.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/libiproute/utils.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -259,7 +259,7 @@
 	exit(-1);
 }
 
-int matches(char *cmd, char *pattern)
+int matches(const char *cmd, const char *pattern)
 {
 	int len = strlen(cmd);
 

Modified: trunk/busybox/networking/libiproute/utils.h
===================================================================
--- trunk/busybox/networking/libiproute/utils.h	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/libiproute/utils.h	2007-01-29 22:51:25 UTC (rev 17654)
@@ -43,8 +43,7 @@
 #define AF_DECnet 12
 #endif
 
-struct dn_naddr
-{
+struct dn_naddr {
 	unsigned short          a_len;
 	unsigned char a_addr[DN_MAXADDL];
 };
@@ -79,7 +78,7 @@
 void invarg(const char * const, const char * const) ATTRIBUTE_NORETURN;
 void duparg(char *, char *) ATTRIBUTE_NORETURN;
 void duparg2(char *, char *) ATTRIBUTE_NORETURN;
-int matches(char *arg, char *pattern);
+int matches(const char *arg, const char *pattern);
 extern int inet_addr_match(inet_prefix *a, inet_prefix *b, int bits);
 
 const char *dnet_ntop(int af, const void *addr, char *str, size_t len);

Modified: trunk/busybox/networking/netstat.c
===================================================================
--- trunk/busybox/networking/netstat.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/netstat.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -68,9 +68,10 @@
 #define SO_WAITDATA  (1<<17)	/* wait data to read            */
 #define SO_NOSPACE   (1<<18)	/* no space to write            */
 
-static char *get_sname(int port, const char *proto, int num)
+static const char *get_sname(int port, const char *proto, int num)
 {
-	char *str = itoa(ntohs(port));
+	/* hummm, we return static buffer here!! */
+	const char *str = itoa(ntohs(port));
 	if (!num) {
 		struct servent *se = getservbyport(port, proto);
 		if (se)
@@ -82,9 +83,9 @@
 	return str;
 }
 
-static void snprint_ip_port(char *ip_port, int size, struct sockaddr *addr, int port, char *proto, int numeric)
+static void snprint_ip_port(char *ip_port, int size, struct sockaddr *addr, int port, const char *proto, int numeric)
 {
-	char *port_name;
+	const char *port_name;
 
 #if ENABLE_FEATURE_IPV6
 	if (addr->sa_family == AF_INET6) {
@@ -178,7 +179,8 @@
 static void udp_do_one(int lnr, const char *line)
 {
 	char local_addr[64], rem_addr[64];
-	char *state_str, more[512];
+	const char *state_str;
+	char more[512];
 	int num, local_port, rem_port, d, state, timer_run, uid, timeout;
 #if ENABLE_FEATURE_IPV6
 	struct sockaddr_in6 localaddr, remaddr;
@@ -356,7 +358,7 @@
 {
 	static int has = 0;
 	char path[PATH_MAX], ss_flags[32];
-	char *ss_proto, *ss_state, *ss_type;
+	const char *ss_proto, *ss_state, *ss_type;
 	int num, state, type, inode;
 	void *d;
 	unsigned long refcnt, proto, unix_flags;

Modified: trunk/busybox/networking/route.c
===================================================================
--- trunk/busybox/networking/route.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/route.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -296,7 +296,7 @@
 
 #ifdef RTF_REJECT
 	if ((rt.rt_flags & RTF_REJECT) && !rt.rt_dev) {
-		rt.rt_dev = "lo";
+		rt.rt_dev = (char*)"lo";
 	}
 #endif
 

Modified: trunk/busybox/networking/telnet.c
===================================================================
--- trunk/busybox/networking/telnet.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/telnet.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -322,7 +322,7 @@
 static void putiac_subopt_autologin(void)
 {
 	int len = strlen(autologin) + 6;	// (2 + 1 + 1 + strlen + 2)
-	char *user = "USER";
+	const char *user = "USER";
 
 	if (G.iaclen + len > IACBUFSIZE)
 		iacflush();

Modified: trunk/busybox/networking/udhcp/common.h
===================================================================
--- trunk/busybox/networking/udhcp/common.h	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/udhcp/common.h	2007-01-29 22:51:25 UTC (rev 17654)
@@ -89,8 +89,8 @@
 int udhcp_sp_fd_set(fd_set *rfds, int extra_fd);
 int udhcp_sp_read(fd_set *rfds);
 int raw_socket(int ifindex);
-int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp);
-int listen_socket(uint32_t ip, int port, char *inf);
+int read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp);
+int listen_socket(uint32_t ip, int port, const char *inf);
 int pidfile_acquire(const char *pidfile);
 void pidfile_write_release(int pid_fd);
 int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *arp, char *interface);

Modified: trunk/busybox/networking/udhcp/dhcpc.h
===================================================================
--- trunk/busybox/networking/udhcp/dhcpc.h	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/udhcp/dhcpc.h	2007-01-29 22:51:25 UTC (rev 17654)
@@ -20,9 +20,9 @@
 	char release_on_quit;           /* perform release on quit */
 	char abort_if_no_lease;         /* Abort if no lease */
 	char background_if_no_lease;    /* Fork to background if no lease */
-	char *interface;                /* The name of the interface to use */
+	const char *interface;                /* The name of the interface to use */
 	char *pidfile;                  /* Optionally store the process ID */
-	char *script;                   /* User script to run at dhcp events */
+	const char *script;                   /* User script to run at dhcp events */
 	uint8_t *clientid;              /* Optional client id to use */
 	uint8_t *vendorclass;           /* Optional vendor class-id to use */
 	uint8_t *hostname;              /* Optional hostname to use */

Modified: trunk/busybox/networking/udhcp/script.c
===================================================================
--- trunk/busybox/networking/udhcp/script.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/udhcp/script.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -35,7 +35,7 @@
 }
 
 
-static int sprintip(char *dest, char *pre, uint8_t *ip)
+static int sprintip(char *dest, const char *pre, const uint8_t *ip)
 {
 	return sprintf(dest, "%s%d.%d.%d.%d", pre, ip[0], ip[1], ip[2], ip[3]);
 }

Modified: trunk/busybox/networking/udhcp/socket.c
===================================================================
--- trunk/busybox/networking/udhcp/socket.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/udhcp/socket.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -37,7 +37,7 @@
 #include "common.h"
 
 
-int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp)
+int read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp)
 {
 	int fd;
 	struct ifreq ifr;
@@ -88,7 +88,7 @@
 }
 
 
-int listen_socket(uint32_t ip, int port, char *inf)
+int listen_socket(uint32_t ip, int port, const char *inf)
 {
 	struct ifreq interface;
 	int fd;

Modified: trunk/busybox/networking/wget.c
===================================================================
--- trunk/busybox/networking/wget.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/networking/wget.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -26,7 +26,7 @@
 static void parse_url(char *url, struct host_info *h);
 static FILE *open_socket(len_and_sockaddr *lsa);
 static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc);
-static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf);
+static int ftpcmd(const char *s1, const char *s2, FILE *fp, char *buf);
 
 /* Globals (can be accessed from signal handlers */
 static off_t content_len;        /* Content-length of the file */
@@ -37,7 +37,7 @@
 static int chunked;                     /* chunked transfer encoding */
 #if ENABLE_FEATURE_WGET_STATUSBAR
 static void progressmeter(int flag);
-static char *curfile;                   /* Name of current file being transferred */
+static const char *curfile;             /* Name of current file being transferred */
 static struct timeval start;            /* Time a transfer started */
 enum {
 	STALLTIME = 5                   /* Seconds when xfer considered "stalled" */
@@ -190,18 +190,18 @@
 		// Dirty hack. Needed because bb_get_last_path_component
 		// will destroy trailing / by storing '\0' in last byte!
 		if (!last_char_is(target.path, '/')) {
-			fname_out =
+			fname_out = bb_get_last_path_component(target.path);
 #if ENABLE_FEATURE_WGET_STATUSBAR
-				curfile =
+			curfile = fname_out;
 #endif
-				bb_get_last_path_component(target.path);
 		}
 		if (!fname_out || !fname_out[0]) {
-			fname_out =
+			/* bb_get_last_path_component writes
+			 * to last '/' only. We don't have one here... */
+			fname_out = (char*)"index.html";
 #if ENABLE_FEATURE_WGET_STATUSBAR
-				curfile =
+			curfile = fname_out;
 #endif
-				"index.html";
 		}
 		if (dir_prefix != NULL)
 			fname_out = concat_path_file(dir_prefix, fname_out);
@@ -624,7 +624,7 @@
 	return hdrval;
 }
 
-static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf)
+static int ftpcmd(const char *s1, const char *s2, FILE *fp, char *buf)
 {
 	int result;
 	if (s1) {

Modified: trunk/busybox/shell/hush.c
===================================================================
--- trunk/busybox/shell/hush.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/shell/hush.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -308,7 +308,8 @@
 #endif
 #define final_printf debug_printf
 
-static void __syntax(char *file, int line) {
+static void __syntax(const char *file, int line)
+{
 	bb_error_msg("syntax error %s:%d", file, line);
 }
 // NB: was __FILE__, but that produces full path sometimess, so...

Modified: trunk/busybox/shell/msh.c
===================================================================
--- trunk/busybox/shell/msh.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/shell/msh.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -280,9 +280,9 @@
 
 static int newenv(int f);
 static void quitenv(void);
-static void err(char *s);
-static int anys(char *s1, char *s2);
-static int any(int c, char *s);
+static void err(const char *s);
+static int anys(const char *s1, const char *s2);
+static int any(int c, const char *s);
 static void next(int f);
 static void setdash(void);
 static void onecommand(void);
@@ -295,7 +295,7 @@
  */
 static void leave(void);		/* abort shell (or fail in subshell) */
 static void fail(void);			/* fail but return to process next command */
-static void warn(char *s);
+static void warn(const char *s);
 static void sig(int i);			/* default signal handler */
 
 
@@ -1135,7 +1135,7 @@
 	/* NOTREACHED */
 }
 
-static void warn(char *s)
+static void warn(const char *s)
 {
 	if (*s) {
 		prs(s);
@@ -1146,7 +1146,7 @@
 		leave();
 }
 
-static void err(char *s)
+static void err(const char *s)
 {
 	warn(s);
 	if (flag['n'])
@@ -1202,23 +1202,23 @@
 }
 
 /*
- * Is any character from s1 in s2?
+ * Is character c in s?
  */
-static int anys(char *s1, char *s2)
+static int any(int c, const char *s)
 {
-	while (*s1)
-		if (any(*s1++, s2))
+	while (*s)
+		if (*s++ == c)
 			return 1;
 	return 0;
 }
 
 /*
- * Is character c in s?
+ * Is any character from s1 in s2?
  */
-static int any(int c, char *s)
+static int anys(const char *s1, const char *s2)
 {
-	while (*s)
-		if (*s++ == c)
+	while (*s1)
+		if (any(*s1++, s2))
 			return 1;
 	return 0;
 }

Modified: trunk/busybox/util-linux/fbset.c
===================================================================
--- trunk/busybox/util-linux/fbset.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/util-linux/fbset.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -314,8 +314,8 @@
 {
 	struct fb_var_screeninfo var, varset;
 	int fh, i;
-	char *fbdev = DEFAULTFBDEV;
-	char *modefile = DEFAULTFBMODE;
+	const char *fbdev = DEFAULTFBDEV;
+	const char *modefile = DEFAULTFBMODE;
 	char *thisarg, *mode = NULL;
 
 	memset(&varset, 0xFF, sizeof(varset));

Modified: trunk/busybox/util-linux/mdev.c
===================================================================
--- trunk/busybox/util-linux/mdev.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/util-linux/mdev.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -141,7 +141,8 @@
 				}
 				if (ENABLE_FEATURE_MDEV_EXEC && field == 3) {
 					// Command to run
-					char *s = "@$*", *s2;
+					const char *s = "@$*";
+					const char *s2;
 					s2 = strchr(s, *pos++);
 					if (!s2) {
 						// Force error

Modified: trunk/busybox/util-linux/switch_root.c
===================================================================
--- trunk/busybox/util-linux/switch_root.c	2007-01-29 22:51:00 UTC (rev 17653)
+++ trunk/busybox/util-linux/switch_root.c	2007-01-29 22:51:25 UTC (rev 17654)
@@ -28,7 +28,7 @@
 
 // Recursively delete contents of rootfs.
 
-static void delete_contents(char *directory)
+static void delete_contents(const char *directory)
 {
 	DIR *dir;
 	struct dirent *d;




More information about the busybox-cvs mailing list