aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archival/dpkg.c12
-rw-r--r--archival/dpkg_deb.c12
-rw-r--r--editors/sed.c20
-rw-r--r--findutils/xargs.c2
-rw-r--r--include/libbb.h2
-rw-r--r--init/mesg.c24
-rw-r--r--libbb/dump.c2
-rw-r--r--libbb/get_last_path_component.c2
-rw-r--r--libbb/xfuncs.c4
-rw-r--r--miscutils/eject.c2
-rw-r--r--miscutils/hdparm.c18
-rw-r--r--miscutils/strings.c2
-rw-r--r--modutils/insmod.c2
-rw-r--r--modutils/lsmod.c10
-rw-r--r--networking/arping.c2
-rw-r--r--networking/ftpgetput.c4
-rw-r--r--networking/inetd.c2
-rw-r--r--networking/libiproute/utils.c2
-rw-r--r--networking/libiproute/utils.h5
-rw-r--r--networking/netstat.c14
-rw-r--r--networking/route.c2
-rw-r--r--networking/telnet.c2
-rw-r--r--networking/udhcp/common.h4
-rw-r--r--networking/udhcp/dhcpc.h4
-rw-r--r--networking/udhcp/script.c2
-rw-r--r--networking/udhcp/socket.c4
-rw-r--r--networking/wget.c18
-rw-r--r--shell/hush.c3
-rw-r--r--shell/msh.c28
-rw-r--r--util-linux/fbset.c4
-rw-r--r--util-linux/mdev.c3
-rw-r--r--util-linux/switch_root.c2
32 files changed, 110 insertions, 109 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c
index 5535c15a1..126138f80 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -1417,10 +1417,10 @@ static void init_archive_deb_control(archive_handle_t *ar_handle)
1417 1417
1418 /* We don't care about data.tar.* or debian-binary, just control.tar.* */ 1418 /* We don't care about data.tar.* or debian-binary, just control.tar.* */
1419#ifdef CONFIG_FEATURE_DEB_TAR_GZ 1419#ifdef CONFIG_FEATURE_DEB_TAR_GZ
1420 llist_add_to(&(ar_handle->accept), "control.tar.gz"); 1420 llist_add_to(&(ar_handle->accept), (char*)"control.tar.gz");
1421#endif 1421#endif
1422#ifdef CONFIG_FEATURE_DEB_TAR_BZ2 1422#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
1423 llist_add_to(&(ar_handle->accept), "control.tar.bz2"); 1423 llist_add_to(&(ar_handle->accept), (char*)"control.tar.bz2");
1424#endif 1424#endif
1425 1425
1426 /* Assign the tar handle as a subarchive of the ar handle */ 1426 /* Assign the tar handle as a subarchive of the ar handle */
@@ -1439,10 +1439,10 @@ static void init_archive_deb_data(archive_handle_t *ar_handle)
1439 1439
1440 /* We don't care about control.tar.* or debian-binary, just data.tar.* */ 1440 /* We don't care about control.tar.* or debian-binary, just data.tar.* */
1441#ifdef CONFIG_FEATURE_DEB_TAR_GZ 1441#ifdef CONFIG_FEATURE_DEB_TAR_GZ
1442 llist_add_to(&(ar_handle->accept), "data.tar.gz"); 1442 llist_add_to(&(ar_handle->accept), (char*)"data.tar.gz");
1443#endif 1443#endif
1444#ifdef CONFIG_FEATURE_DEB_TAR_BZ2 1444#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
1445 llist_add_to(&(ar_handle->accept), "data.tar.bz2"); 1445 llist_add_to(&(ar_handle->accept), (char*)"data.tar.bz2");
1446#endif 1446#endif
1447 1447
1448 /* Assign the tar handle as a subarchive of the ar handle */ 1448 /* Assign the tar handle as a subarchive of the ar handle */
@@ -1525,7 +1525,7 @@ static void unpack_package(deb_file_t *deb_file)
1525 archive_handle = init_archive_deb_ar(deb_file->filename); 1525 archive_handle = init_archive_deb_ar(deb_file->filename);
1526 init_archive_deb_data(archive_handle); 1526 init_archive_deb_data(archive_handle);
1527 archive_handle->sub_archive->action_data = data_extract_all_prefix; 1527 archive_handle->sub_archive->action_data = data_extract_all_prefix;
1528 archive_handle->sub_archive->buffer = "/"; 1528 archive_handle->sub_archive->buffer = (char*)"/"; /* huh? */
1529 archive_handle->sub_archive->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL; 1529 archive_handle->sub_archive->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL;
1530 unpack_ar_archive(archive_handle); 1530 unpack_ar_archive(archive_handle);
1531 1531
@@ -1629,7 +1629,7 @@ int dpkg_main(int argc, char **argv)
1629 llist_t *control_list = NULL; 1629 llist_t *control_list = NULL;
1630 1630
1631 /* Extract the control file */ 1631 /* Extract the control file */
1632 llist_add_to(&control_list, "./control"); 1632 llist_add_to(&control_list, (char*)"./control");
1633 archive_handle = init_archive_deb_ar(argv[0]); 1633 archive_handle = init_archive_deb_ar(argv[0]);
1634 init_archive_deb_control(archive_handle); 1634 init_archive_deb_control(archive_handle);
1635 deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list); 1635 deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list);
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index d11d9df17..c9b8a0429 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -19,7 +19,7 @@ int dpkg_deb_main(int argc, char **argv)
19 archive_handle_t *tar_archive; 19 archive_handle_t *tar_archive;
20 llist_t *control_tar_llist = NULL; 20 llist_t *control_tar_llist = NULL;
21 unsigned opt; 21 unsigned opt;
22 char *extract_dir = NULL; 22 const char *extract_dir = NULL;
23 short argcount = 1; 23 short argcount = 1;
24 24
25 /* Setup the tar archive handle */ 25 /* Setup the tar archive handle */
@@ -31,13 +31,13 @@ int dpkg_deb_main(int argc, char **argv)
31 ar_archive->filter = filter_accept_list_reassign; 31 ar_archive->filter = filter_accept_list_reassign;
32 32
33#ifdef CONFIG_FEATURE_DEB_TAR_GZ 33#ifdef CONFIG_FEATURE_DEB_TAR_GZ
34 llist_add_to(&(ar_archive->accept), "data.tar.gz"); 34 llist_add_to(&(ar_archive->accept), (char*)"data.tar.gz");
35 llist_add_to(&control_tar_llist, "control.tar.gz"); 35 llist_add_to(&control_tar_llist, (char*)"control.tar.gz");
36#endif 36#endif
37 37
38#ifdef CONFIG_FEATURE_DEB_TAR_BZ2 38#ifdef CONFIG_FEATURE_DEB_TAR_BZ2
39 llist_add_to(&(ar_archive->accept), "data.tar.bz2"); 39 llist_add_to(&(ar_archive->accept), (char*)"data.tar.bz2");
40 llist_add_to(&control_tar_llist, "control.tar.bz2"); 40 llist_add_to(&control_tar_llist, (char*)"control.tar.bz2");
41#endif 41#endif
42 42
43 opt_complementary = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX"; 43 opt_complementary = "?c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
@@ -60,7 +60,7 @@ int dpkg_deb_main(int argc, char **argv)
60 * it should accept a second argument which specifies a 60 * it should accept a second argument which specifies a
61 * specific field to print */ 61 * specific field to print */
62 ar_archive->accept = control_tar_llist; 62 ar_archive->accept = control_tar_llist;
63 llist_add_to(&(tar_archive->accept), "./control"); 63 llist_add_to(&(tar_archive->accept), (char*)"./control");
64 tar_archive->filter = filter_accept_list; 64 tar_archive->filter = filter_accept_list;
65 tar_archive->action_data = data_extract_to_stdout; 65 tar_archive->action_data = data_extract_to_stdout;
66 } 66 }
diff --git a/editors/sed.c b/editors/sed.c
index 695e5e974..70b36095f 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -168,7 +168,7 @@ static void cleanup_outname(void)
168 168
169/* strdup, replacing "\n" with '\n', and "\delimiter" with 'delimiter' */ 169/* strdup, replacing "\n" with '\n', and "\delimiter" with 'delimiter' */
170 170
171static void parse_escapes(char *dest, char *string, int len, char from, char to) 171static void parse_escapes(char *dest, const char *string, int len, char from, char to)
172{ 172{
173 int i = 0; 173 int i = 0;
174 174
@@ -186,7 +186,7 @@ static void parse_escapes(char *dest, char *string, int len, char from, char to)
186 *dest = 0; 186 *dest = 0;
187} 187}
188 188
189static char *copy_parsing_escapes(char *string, int len) 189static char *copy_parsing_escapes(const char *string, int len)
190{ 190{
191 char *dest = xmalloc(len + 1); 191 char *dest = xmalloc(len + 1);
192 192
@@ -201,7 +201,7 @@ static char *copy_parsing_escapes(char *string, int len)
201 * expression delimiter (typically a forward * slash ('/')) not preceded by 201 * expression delimiter (typically a forward * slash ('/')) not preceded by
202 * a backslash ('\'). A negative delimiter disables square bracket checking. 202 * a backslash ('\'). A negative delimiter disables square bracket checking.
203 */ 203 */
204static int index_of_next_unescaped_regexp_delim(int delimiter, char *str) 204static int index_of_next_unescaped_regexp_delim(int delimiter, const char *str)
205{ 205{
206 int bracket = -1; 206 int bracket = -1;
207 int escaped = 0; 207 int escaped = 0;
@@ -262,12 +262,12 @@ static int parse_regex_delim(char *cmdstr, char **match, char **replace)
262/* 262/*
263 * returns the index in the string just past where the address ends. 263 * returns the index in the string just past where the address ends.
264 */ 264 */
265static int get_address(char *my_str, int *linenum, regex_t ** regex) 265static int get_address(const char *my_str, int *linenum, regex_t ** regex)
266{ 266{
267 char *pos = my_str; 267 const char *pos = my_str;
268 268
269 if (isdigit(*my_str)) { 269 if (isdigit(*my_str)) {
270 *linenum = strtol(my_str, &pos, 10); 270 *linenum = strtol(my_str, (char**)&pos, 10);
271 /* endstr shouldnt ever equal NULL */ 271 /* endstr shouldnt ever equal NULL */
272 } else if (*my_str == '$') { 272 } else if (*my_str == '$') {
273 *linenum = -1; 273 *linenum = -1;
@@ -314,7 +314,7 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, char *substr)
314{ 314{
315 int cflags = bbg.regex_type; 315 int cflags = bbg.regex_type;
316 char *match; 316 char *match;
317 int idx = 0; 317 int idx;
318 318
319 /* 319 /*
320 * A substitution command should look something like this: 320 * A substitution command should look something like this:
@@ -469,16 +469,16 @@ static char *parse_cmd_args(sed_cmd_t *sed_cmd, char *cmdstr)
469 469
470/* Parse address+command sets, skipping comment lines. */ 470/* Parse address+command sets, skipping comment lines. */
471 471
472static void add_cmd(char *cmdstr) 472static void add_cmd(const char *cmdstr)
473{ 473{
474 sed_cmd_t *sed_cmd; 474 sed_cmd_t *sed_cmd;
475 int temp; 475 int temp;
476 476
477 /* Append this line to any unfinished line from last time. */ 477 /* Append this line to any unfinished line from last time. */
478 if (bbg.add_cmd_line) { 478 if (bbg.add_cmd_line) {
479 cmdstr = xasprintf("%s\n%s", bbg.add_cmd_line, cmdstr); 479 char *tp = xasprintf("%s\n%s", bbg.add_cmd_line, cmdstr);
480 free(bbg.add_cmd_line); 480 free(bbg.add_cmd_line);
481 bbg.add_cmd_line = cmdstr; 481 bbg.add_cmd_line = tp;
482 } 482 }
483 483
484 /* If this line ends with backslash, request next line. */ 484 /* If this line ends with backslash, request next line. */
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 029d4077d..077b8847f 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -416,7 +416,7 @@ int xargs_main(int argc, char **argv)
416 argv += optind; 416 argv += optind;
417 if (!argc) { 417 if (!argc) {
418 /* default behavior is to echo all the filenames */ 418 /* default behavior is to echo all the filenames */
419 *argv = "echo"; 419 *argv = (char*)"echo";
420 argc++; 420 argc++;
421 } 421 }
422 422
diff --git a/include/libbb.h b/include/libbb.h
index 6f195cf46..99a9422f0 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -248,6 +248,8 @@ extern void bb_copyfd_exact_size(int fd1, int fd2, off_t size);
248/* this helper yells "short read!" if param is not -1 */ 248/* this helper yells "short read!" if param is not -1 */
249extern void complain_copyfd_and_die(off_t sz) ATTRIBUTE_NORETURN; 249extern void complain_copyfd_and_die(off_t sz) ATTRIBUTE_NORETURN;
250extern char bb_process_escape_sequence(const char **ptr); 250extern char bb_process_escape_sequence(const char **ptr);
251/* TODO: sometimes modifies its parameter, which
252 * makes it rather inconvenient at times: */
251extern char *bb_get_last_path_component(char *path); 253extern char *bb_get_last_path_component(char *path);
252extern int ndelay_on(int fd); 254extern int ndelay_on(int fd);
253extern int ndelay_off(int fd); 255extern int ndelay_off(int fd);
diff --git a/init/mesg.c b/init/mesg.c
index 7e47644c3..658c82447 100644
--- a/init/mesg.c
+++ b/init/mesg.c
@@ -8,8 +8,6 @@
8 */ 8 */
9 9
10#include "busybox.h" 10#include "busybox.h"
11#include <unistd.h>
12#include <stdlib.h>
13 11
14#ifdef USE_TTY_GROUP 12#ifdef USE_TTY_GROUP
15#define S_IWGRP_OR_S_IWOTH S_IWGRP 13#define S_IWGRP_OR_S_IWOTH S_IWGRP
@@ -20,24 +18,24 @@
20int mesg_main(int argc, char *argv[]) 18int mesg_main(int argc, char *argv[])
21{ 19{
22 struct stat sb; 20 struct stat sb;
23 char *tty; 21 const char *tty;
24 char c = 0; 22 char c = 0;
25 23
26 if ((--argc == 0) 24 if (--argc == 0
27 || ((argc == 1) && (((c = **++argv) == 'y') || (c == 'n')))) { 25 || (argc == 1 && ((c = **++argv) == 'y' || c == 'n'))
28 if ((tty = ttyname(STDERR_FILENO)) == NULL) { 26 ) {
27 tty = ttyname(STDERR_FILENO);
28 if (tty == NULL) {
29 tty = "ttyname"; 29 tty = "ttyname";
30 } else if (stat(tty, &sb) == 0) { 30 } else if (stat(tty, &sb) == 0) {
31 mode_t m;
31 if (argc == 0) { 32 if (argc == 0) {
32 puts(((sb.st_mode & (S_IWGRP | S_IWOTH)) == 33 puts((sb.st_mode & (S_IWGRP|S_IWOTH)) ? "is y" : "is n");
33 0) ? "is n" : "is y");
34 return EXIT_SUCCESS; 34 return EXIT_SUCCESS;
35 } 35 }
36 if (chmod 36 m = (c == 'y') ? sb.st_mode | S_IWGRP_OR_S_IWOTH
37 (tty, 37 : sb.st_mode & ~(S_IWGRP|S_IWOTH);
38 (c == 38 if (chmod(tty, m) == 0) {
39 'y') ? sb.st_mode | (S_IWGRP_OR_S_IWOTH) : sb.
40 st_mode & ~(S_IWGRP | S_IWOTH)) == 0) {
41 return EXIT_SUCCESS; 39 return EXIT_SUCCESS;
42 } 40 }
43 } 41 }
diff --git a/libbb/dump.c b/libbb/dump.c
index 1815ca914..f078afc1c 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -291,7 +291,7 @@ static void rewrite(FS * fs)
291 } 291 }
292} 292}
293 293
294static void do_skip(char *fname, int statok) 294static void do_skip(const char *fname, int statok)
295{ 295{
296 struct stat sbuf; 296 struct stat sbuf;
297 297
diff --git a/libbb/get_last_path_component.c b/libbb/get_last_path_component.c
index 311909726..b7bc0e626 100644
--- a/libbb/get_last_path_component.c
+++ b/libbb/get_last_path_component.c
@@ -26,7 +26,7 @@ char *bb_get_last_path_component(char *path)
26 if (*first == '/') { 26 if (*first == '/') {
27 last = first; 27 last = first;
28 } 28 }
29 last[1] = 0; 29 last[1] = '\0';
30 30
31 return first; 31 return first;
32} 32}
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 54d291ab1..601ff3f7e 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -184,7 +184,7 @@ pid_t spawn(char **argv)
184 /* Why static? */ 184 /* Why static? */
185 static int failed; 185 static int failed;
186 pid_t pid; 186 pid_t pid;
187 char *prog; 187 const char *prog;
188 188
189 // Be nice to nommu machines. 189 // Be nice to nommu machines.
190 failed = 0; 190 failed = 0;
@@ -240,7 +240,7 @@ void xsetenv(const char *key, const char *value)
240// Fifth char is always '\0' 240// Fifth char is always '\0'
241void smart_ulltoa5(unsigned long long ul, char buf[5]) 241void smart_ulltoa5(unsigned long long ul, char buf[5])
242{ 242{
243 char *fmt; 243 const char *fmt;
244 char c; 244 char c;
245 unsigned v,idx = 0; 245 unsigned v,idx = 0;
246 ul *= 10; 246 ul *= 10;
diff --git a/miscutils/eject.c b/miscutils/eject.c
index ff23b1666..8e37c84b5 100644
--- a/miscutils/eject.c
+++ b/miscutils/eject.c
@@ -28,7 +28,7 @@
28int eject_main(int argc, char **argv) 28int eject_main(int argc, char **argv)
29{ 29{
30 unsigned long flags; 30 unsigned long flags;
31 char *device; 31 const char *device;
32 int dev, cmd; 32 int dev, cmd;
33 33
34 opt_complementary = "?:?1:t--T:T--t"; 34 opt_complementary = "?:?1:t--T:T--t";
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index e60e642d6..afb4ecc7b 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -463,9 +463,7 @@ static void on_off(unsigned int value);
463 463
464static void print_flag_on_off(unsigned long get_arg, const char *s, unsigned long arg) 464static void print_flag_on_off(unsigned long get_arg, const char *s, unsigned long arg)
465{ 465{
466 466 if (get_arg) {
467 if (get_arg)
468 {
469 printf(" setting %s to %ld", s, arg); 467 printf(" setting %s to %ld", s, arg);
470 on_off(arg); 468 on_off(arg);
471 } 469 }
@@ -476,8 +474,7 @@ static void bb_ioctl_on_off(int fd, int request, void *argp, const char *string,
476{ 474{
477 if (ioctl(fd, request, &argp) != 0) 475 if (ioctl(fd, request, &argp) != 0)
478 bb_perror_msg(" %s", string); 476 bb_perror_msg(" %s", string);
479 else 477 else {
480 {
481 printf(" %s\t= %2ld", str, (unsigned long) argp); 478 printf(" %s\t= %2ld", str, (unsigned long) argp);
482 on_off((unsigned long) argp); 479 on_off((unsigned long) argp);
483 } 480 }
@@ -486,16 +483,15 @@ static void bb_ioctl_on_off(int fd, int request, void *argp, const char *string,
486#ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY 483#ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY
487static void print_ascii(uint16_t *p, uint8_t length); 484static void print_ascii(uint16_t *p, uint8_t length);
488 485
489static void xprint_ascii(uint16_t *val ,int i, char * string, int n) 486static void xprint_ascii(uint16_t *val ,int i, const char *string, int n)
490{ 487{
491 if (val[i]) 488 if (val[i]) {
492 { 489 printf("\t%-20s", string);
493 printf("\t%-20s",string);
494 print_ascii(&val[i], n); 490 print_ascii(&val[i], n);
495 } 491 }
496} 492}
497#endif 493#endif
498/* end of busybox specific stuff */ 494/* end of busybox specific stuff */
499 495
500#ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY 496#ifdef CONFIG_FEATURE_HDPARM_GET_IDENTITY
501static uint8_t mode_loop(uint16_t mode_sup, uint16_t mode_sel, int cc, uint8_t *have_mode) 497static uint8_t mode_loop(uint16_t mode_sup, uint16_t mode_sel, int cc, uint8_t *have_mode)
@@ -1587,7 +1583,7 @@ static void interpret_xfermode(unsigned int xfermode)
1587} 1583}
1588#endif /* HDIO_DRIVE_CMD */ 1584#endif /* HDIO_DRIVE_CMD */
1589 1585
1590static void print_flag(unsigned long flag, char *s, unsigned long value) 1586static void print_flag(unsigned long flag, const char *s, unsigned long value)
1591{ 1587{
1592 if (flag) 1588 if (flag)
1593 printf(" setting %s to %ld\n", s, value); 1589 printf(" setting %s to %ld\n", s, value);
diff --git a/miscutils/strings.c b/miscutils/strings.c
index 0d5576e9b..691502dab 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -26,7 +26,7 @@ int strings_main(int argc, char **argv)
26 FILE *file = stdin; 26 FILE *file = stdin;
27 char *string; 27 char *string;
28 const char *fmt = "%s: "; 28 const char *fmt = "%s: ";
29 char *n_arg = "4"; 29 const char *n_arg = "4";
30 30
31 opt = getopt32(argc, argv, "afon:", &n_arg); 31 opt = getopt32(argc, argv, "afon:", &n_arg);
32 /* -a is our default behaviour */ 32 /* -a is our default behaviour */
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 1ad3c23a4..241db45e8 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -1782,7 +1782,7 @@ static int arch_single_init(ElfW(RelM) *rel, struct arch_single_entry *single,
1782 1782
1783#if defined(USE_GOT_ENTRIES) || defined(USE_PLT_ENTRIES) 1783#if defined(USE_GOT_ENTRIES) || defined(USE_PLT_ENTRIES)
1784 1784
1785static struct obj_section *arch_xsect_init(struct obj_file *f, char *name, 1785static struct obj_section *arch_xsect_init(struct obj_file *f, const char *name,
1786 int offset, int size) 1786 int offset, int size)
1787{ 1787{
1788 struct obj_section *myrelsec = obj_find_section(f, name); 1788 struct obj_section *myrelsec = obj_find_section(f, name);
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index 987174081..af16f2c61 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -161,7 +161,7 @@ int lsmod_main(int argc, char **argv)
161 printf(" %s", tok); 161 printf(" %s", tok);
162 tok = strtok(NULL, "\n"); 162 tok = strtok(NULL, "\n");
163 if (!tok) 163 if (!tok)
164 tok = ""; 164 tok = (char*)"";
165 /* New-style has commas, or -. If so, 165 /* New-style has commas, or -. If so,
166 truncate (other fields might follow). */ 166 truncate (other fields might follow). */
167 else if (strchr(tok, ',')) { 167 else if (strchr(tok, ',')) {
@@ -170,9 +170,11 @@ int lsmod_main(int argc, char **argv)
170 if (tok[strlen(tok)-1] == ',') 170 if (tok[strlen(tok)-1] == ',')
171 tok[strlen(tok)-1] = '\0'; 171 tok[strlen(tok)-1] = '\0';
172 } else if (tok[0] == '-' 172 } else if (tok[0] == '-'
173 && (tok[1] == '\0' || isspace(tok[1]))) 173 && (tok[1] == '\0' || isspace(tok[1]))
174 tok = ""; 174 ) {
175 printf(" %s", tok); 175 tok = (char*)"";
176 }
177 printf(" %s", tok);
176 } 178 }
177 puts(""); 179 puts("");
178 free(line); 180 free(line);
diff --git a/networking/arping.c b/networking/arping.c
index 725b0e4cb..7bab0d048 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -240,7 +240,7 @@ static int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM)
240 240
241int arping_main(int argc, char **argv) 241int arping_main(int argc, char **argv)
242{ 242{
243 char *device = "eth0"; 243 const char *device = "eth0";
244 int ifindex; 244 int ifindex;
245 char *source = NULL; 245 char *source = NULL;
246 char *target; 246 char *target;
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index ccc0b5e46..590b7ebcd 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -17,8 +17,8 @@
17#include <getopt.h> 17#include <getopt.h>
18 18
19typedef struct ftp_host_info_s { 19typedef struct ftp_host_info_s {
20 char *user; 20 const char *user;
21 char *password; 21 const char *password;
22 struct len_and_sockaddr *lsa; 22 struct len_and_sockaddr *lsa;
23} ftp_host_info_t; 23} ftp_host_info_t;
24 24
diff --git a/networking/inetd.c b/networking/inetd.c
index c1f9918f0..5e7005e9b 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -327,7 +327,7 @@ static int timingout;
327static struct servent *sp; 327static struct servent *sp;
328static uid_t uid; 328static uid_t uid;
329 329
330static char *CONFIG = _PATH_INETDCONF; 330static const char *CONFIG = _PATH_INETDCONF;
331 331
332static FILE *fconfig; 332static FILE *fconfig;
333static char line[1024]; 333static char line[1024];
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index 7e74e1c4b..5e06656f6 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -259,7 +259,7 @@ void duparg2(char *key, char *arg)
259 exit(-1); 259 exit(-1);
260} 260}
261 261
262int matches(char *cmd, char *pattern) 262int matches(const char *cmd, const char *pattern)
263{ 263{
264 int len = strlen(cmd); 264 int len = strlen(cmd);
265 265
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h
index c8ac63197..5af8ba744 100644
--- a/networking/libiproute/utils.h
+++ b/networking/libiproute/utils.h
@@ -43,8 +43,7 @@ typedef struct
43#define AF_DECnet 12 43#define AF_DECnet 12
44#endif 44#endif
45 45
46struct dn_naddr 46struct dn_naddr {
47{
48 unsigned short a_len; 47 unsigned short a_len;
49 unsigned char a_addr[DN_MAXADDL]; 48 unsigned char a_addr[DN_MAXADDL];
50}; 49};
@@ -79,7 +78,7 @@ extern const char *rt_addr_n2a(int af, int len, void *addr, char *buf, int bufle
79void invarg(const char * const, const char * const) ATTRIBUTE_NORETURN; 78void invarg(const char * const, const char * const) ATTRIBUTE_NORETURN;
80void duparg(char *, char *) ATTRIBUTE_NORETURN; 79void duparg(char *, char *) ATTRIBUTE_NORETURN;
81void duparg2(char *, char *) ATTRIBUTE_NORETURN; 80void duparg2(char *, char *) ATTRIBUTE_NORETURN;
82int matches(char *arg, char *pattern); 81int matches(const char *arg, const char *pattern);
83extern int inet_addr_match(inet_prefix *a, inet_prefix *b, int bits); 82extern int inet_addr_match(inet_prefix *a, inet_prefix *b, int bits);
84 83
85const char *dnet_ntop(int af, const void *addr, char *str, size_t len); 84const char *dnet_ntop(int af, const void *addr, char *str, size_t len);
diff --git a/networking/netstat.c b/networking/netstat.c
index 16ee52d9a..a5631c3c0 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -68,9 +68,10 @@ typedef enum {
68#define SO_WAITDATA (1<<17) /* wait data to read */ 68#define SO_WAITDATA (1<<17) /* wait data to read */
69#define SO_NOSPACE (1<<18) /* no space to write */ 69#define SO_NOSPACE (1<<18) /* no space to write */
70 70
71static char *get_sname(int port, const char *proto, int num) 71static const char *get_sname(int port, const char *proto, int num)
72{ 72{
73 char *str = itoa(ntohs(port)); 73 /* hummm, we return static buffer here!! */
74 const char *str = itoa(ntohs(port));
74 if (!num) { 75 if (!num) {
75 struct servent *se = getservbyport(port, proto); 76 struct servent *se = getservbyport(port, proto);
76 if (se) 77 if (se)
@@ -82,9 +83,9 @@ static char *get_sname(int port, const char *proto, int num)
82 return str; 83 return str;
83} 84}
84 85
85static void snprint_ip_port(char *ip_port, int size, struct sockaddr *addr, int port, char *proto, int numeric) 86static void snprint_ip_port(char *ip_port, int size, struct sockaddr *addr, int port, const char *proto, int numeric)
86{ 87{
87 char *port_name; 88 const char *port_name;
88 89
89#if ENABLE_FEATURE_IPV6 90#if ENABLE_FEATURE_IPV6
90 if (addr->sa_family == AF_INET6) { 91 if (addr->sa_family == AF_INET6) {
@@ -178,7 +179,8 @@ static void tcp_do_one(int lnr, const char *line)
178static void udp_do_one(int lnr, const char *line) 179static void udp_do_one(int lnr, const char *line)
179{ 180{
180 char local_addr[64], rem_addr[64]; 181 char local_addr[64], rem_addr[64];
181 char *state_str, more[512]; 182 const char *state_str;
183 char more[512];
182 int num, local_port, rem_port, d, state, timer_run, uid, timeout; 184 int num, local_port, rem_port, d, state, timer_run, uid, timeout;
183#if ENABLE_FEATURE_IPV6 185#if ENABLE_FEATURE_IPV6
184 struct sockaddr_in6 localaddr, remaddr; 186 struct sockaddr_in6 localaddr, remaddr;
@@ -356,7 +358,7 @@ static void unix_do_one(int nr, const char *line)
356{ 358{
357 static int has = 0; 359 static int has = 0;
358 char path[PATH_MAX], ss_flags[32]; 360 char path[PATH_MAX], ss_flags[32];
359 char *ss_proto, *ss_state, *ss_type; 361 const char *ss_proto, *ss_state, *ss_type;
360 int num, state, type, inode; 362 int num, state, type, inode;
361 void *d; 363 void *d;
362 unsigned long refcnt, proto, unix_flags; 364 unsigned long refcnt, proto, unix_flags;
diff --git a/networking/route.c b/networking/route.c
index 56c6f46c6..d32011cc4 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -296,7 +296,7 @@ static void INET_setroute(int action, char **args)
296 296
297#ifdef RTF_REJECT 297#ifdef RTF_REJECT
298 if ((rt.rt_flags & RTF_REJECT) && !rt.rt_dev) { 298 if ((rt.rt_flags & RTF_REJECT) && !rt.rt_dev) {
299 rt.rt_dev = "lo"; 299 rt.rt_dev = (char*)"lo";
300 } 300 }
301#endif 301#endif
302 302
diff --git a/networking/telnet.c b/networking/telnet.c
index fc70cc406..7407fa413 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -322,7 +322,7 @@ static void putiac_subopt(byte c, char *str)
322static void putiac_subopt_autologin(void) 322static void putiac_subopt_autologin(void)
323{ 323{
324 int len = strlen(autologin) + 6; // (2 + 1 + 1 + strlen + 2) 324 int len = strlen(autologin) + 6; // (2 + 1 + 1 + strlen + 2)
325 char *user = "USER"; 325 const char *user = "USER";
326 326
327 if (G.iaclen + len > IACBUFSIZE) 327 if (G.iaclen + len > IACBUFSIZE)
328 iacflush(); 328 iacflush();
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index ca05a9c2c..a80691b4a 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -89,8 +89,8 @@ void udhcp_sp_setup(void);
89int udhcp_sp_fd_set(fd_set *rfds, int extra_fd); 89int udhcp_sp_fd_set(fd_set *rfds, int extra_fd);
90int udhcp_sp_read(fd_set *rfds); 90int udhcp_sp_read(fd_set *rfds);
91int raw_socket(int ifindex); 91int raw_socket(int ifindex);
92int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp); 92int read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp);
93int listen_socket(uint32_t ip, int port, char *inf); 93int listen_socket(uint32_t ip, int port, const char *inf);
94int pidfile_acquire(const char *pidfile); 94int pidfile_acquire(const char *pidfile);
95void pidfile_write_release(int pid_fd); 95void pidfile_write_release(int pid_fd);
96int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *arp, char *interface); 96int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *arp, char *interface);
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h
index fd17917d0..4ddd12120 100644
--- a/networking/udhcp/dhcpc.h
+++ b/networking/udhcp/dhcpc.h
@@ -20,9 +20,9 @@ struct client_config_t {
20 char release_on_quit; /* perform release on quit */ 20 char release_on_quit; /* perform release on quit */
21 char abort_if_no_lease; /* Abort if no lease */ 21 char abort_if_no_lease; /* Abort if no lease */
22 char background_if_no_lease; /* Fork to background if no lease */ 22 char background_if_no_lease; /* Fork to background if no lease */
23 char *interface; /* The name of the interface to use */ 23 const char *interface; /* The name of the interface to use */
24 char *pidfile; /* Optionally store the process ID */ 24 char *pidfile; /* Optionally store the process ID */
25 char *script; /* User script to run at dhcp events */ 25 const char *script; /* User script to run at dhcp events */
26 uint8_t *clientid; /* Optional client id to use */ 26 uint8_t *clientid; /* Optional client id to use */
27 uint8_t *vendorclass; /* Optional vendor class-id to use */ 27 uint8_t *vendorclass; /* Optional vendor class-id to use */
28 uint8_t *hostname; /* Optional hostname to use */ 28 uint8_t *hostname; /* Optional hostname to use */
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c
index 07f68362c..d2b0bb05b 100644
--- a/networking/udhcp/script.c
+++ b/networking/udhcp/script.c
@@ -35,7 +35,7 @@ static inline int upper_length(int length, int opt_index)
35} 35}
36 36
37 37
38static int sprintip(char *dest, char *pre, uint8_t *ip) 38static int sprintip(char *dest, const char *pre, const uint8_t *ip)
39{ 39{
40 return sprintf(dest, "%s%d.%d.%d.%d", pre, ip[0], ip[1], ip[2], ip[3]); 40 return sprintf(dest, "%s%d.%d.%d.%d", pre, ip[0], ip[1], ip[2], ip[3]);
41} 41}
diff --git a/networking/udhcp/socket.c b/networking/udhcp/socket.c
index 76ae7172d..d294fb259 100644
--- a/networking/udhcp/socket.c
+++ b/networking/udhcp/socket.c
@@ -37,7 +37,7 @@
37#include "common.h" 37#include "common.h"
38 38
39 39
40int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp) 40int read_interface(const char *interface, int *ifindex, uint32_t *addr, uint8_t *arp)
41{ 41{
42 int fd; 42 int fd;
43 struct ifreq ifr; 43 struct ifreq ifr;
@@ -88,7 +88,7 @@ int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *arp)
88} 88}
89 89
90 90
91int listen_socket(uint32_t ip, int port, char *inf) 91int listen_socket(uint32_t ip, int port, const char *inf)
92{ 92{
93 struct ifreq interface; 93 struct ifreq interface;
94 int fd; 94 int fd;
diff --git a/networking/wget.c b/networking/wget.c
index 224e80dc0..7766bde88 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -26,7 +26,7 @@ struct host_info {
26static void parse_url(char *url, struct host_info *h); 26static void parse_url(char *url, struct host_info *h);
27static FILE *open_socket(len_and_sockaddr *lsa); 27static FILE *open_socket(len_and_sockaddr *lsa);
28static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc); 28static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc);
29static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf); 29static int ftpcmd(const char *s1, const char *s2, FILE *fp, char *buf);
30 30
31/* Globals (can be accessed from signal handlers */ 31/* Globals (can be accessed from signal handlers */
32static off_t content_len; /* Content-length of the file */ 32static off_t content_len; /* Content-length of the file */
@@ -37,7 +37,7 @@ static off_t transferred; /* Number of bytes transferred so far */
37static int chunked; /* chunked transfer encoding */ 37static int chunked; /* chunked transfer encoding */
38#if ENABLE_FEATURE_WGET_STATUSBAR 38#if ENABLE_FEATURE_WGET_STATUSBAR
39static void progressmeter(int flag); 39static void progressmeter(int flag);
40static char *curfile; /* Name of current file being transferred */ 40static const char *curfile; /* Name of current file being transferred */
41static struct timeval start; /* Time a transfer started */ 41static struct timeval start; /* Time a transfer started */
42enum { 42enum {
43 STALLTIME = 5 /* Seconds when xfer considered "stalled" */ 43 STALLTIME = 5 /* Seconds when xfer considered "stalled" */
@@ -190,18 +190,18 @@ int wget_main(int argc, char **argv)
190 // Dirty hack. Needed because bb_get_last_path_component 190 // Dirty hack. Needed because bb_get_last_path_component
191 // will destroy trailing / by storing '\0' in last byte! 191 // will destroy trailing / by storing '\0' in last byte!
192 if (!last_char_is(target.path, '/')) { 192 if (!last_char_is(target.path, '/')) {
193 fname_out = 193 fname_out = bb_get_last_path_component(target.path);
194#if ENABLE_FEATURE_WGET_STATUSBAR 194#if ENABLE_FEATURE_WGET_STATUSBAR
195 curfile = 195 curfile = fname_out;
196#endif 196#endif
197 bb_get_last_path_component(target.path);
198 } 197 }
199 if (!fname_out || !fname_out[0]) { 198 if (!fname_out || !fname_out[0]) {
200 fname_out = 199 /* bb_get_last_path_component writes
200 * to last '/' only. We don't have one here... */
201 fname_out = (char*)"index.html";
201#if ENABLE_FEATURE_WGET_STATUSBAR 202#if ENABLE_FEATURE_WGET_STATUSBAR
202 curfile = 203 curfile = fname_out;
203#endif 204#endif
204 "index.html";
205 } 205 }
206 if (dir_prefix != NULL) 206 if (dir_prefix != NULL)
207 fname_out = concat_path_file(dir_prefix, fname_out); 207 fname_out = concat_path_file(dir_prefix, fname_out);
@@ -624,7 +624,7 @@ static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc)
624 return hdrval; 624 return hdrval;
625} 625}
626 626
627static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf) 627static int ftpcmd(const char *s1, const char *s2, FILE *fp, char *buf)
628{ 628{
629 int result; 629 int result;
630 if (s1) { 630 if (s1) {
diff --git a/shell/hush.c b/shell/hush.c
index 7e274324e..dca04b5a6 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -308,7 +308,8 @@ static char *indenter(int i)
308#endif 308#endif
309#define final_printf debug_printf 309#define final_printf debug_printf
310 310
311static void __syntax(char *file, int line) { 311static void __syntax(const char *file, int line)
312{
312 bb_error_msg("syntax error %s:%d", file, line); 313 bb_error_msg("syntax error %s:%d", file, line);
313} 314}
314// NB: was __FILE__, but that produces full path sometimess, so... 315// NB: was __FILE__, but that produces full path sometimess, so...
diff --git a/shell/msh.c b/shell/msh.c
index 15ce9ffdd..584668607 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -280,9 +280,9 @@ static void onintr(int s); /* SIGINT handler */
280 280
281static int newenv(int f); 281static int newenv(int f);
282static void quitenv(void); 282static void quitenv(void);
283static void err(char *s); 283static void err(const char *s);
284static int anys(char *s1, char *s2); 284static int anys(const char *s1, const char *s2);
285static int any(int c, char *s); 285static int any(int c, const char *s);
286static void next(int f); 286static void next(int f);
287static void setdash(void); 287static void setdash(void);
288static void onecommand(void); 288static void onecommand(void);
@@ -295,7 +295,7 @@ static int gmatch(char *s, char *p);
295 */ 295 */
296static void leave(void); /* abort shell (or fail in subshell) */ 296static void leave(void); /* abort shell (or fail in subshell) */
297static void fail(void); /* fail but return to process next command */ 297static void fail(void); /* fail but return to process next command */
298static void warn(char *s); 298static void warn(const char *s);
299static void sig(int i); /* default signal handler */ 299static void sig(int i); /* default signal handler */
300 300
301 301
@@ -1135,7 +1135,7 @@ static void leave(void)
1135 /* NOTREACHED */ 1135 /* NOTREACHED */
1136} 1136}
1137 1137
1138static void warn(char *s) 1138static void warn(const char *s)
1139{ 1139{
1140 if (*s) { 1140 if (*s) {
1141 prs(s); 1141 prs(s);
@@ -1146,7 +1146,7 @@ static void warn(char *s)
1146 leave(); 1146 leave();
1147} 1147}
1148 1148
1149static void err(char *s) 1149static void err(const char *s)
1150{ 1150{
1151 warn(s); 1151 warn(s);
1152 if (flag['n']) 1152 if (flag['n'])
@@ -1202,23 +1202,23 @@ static void quitenv(void)
1202} 1202}
1203 1203
1204/* 1204/*
1205 * Is any character from s1 in s2? 1205 * Is character c in s?
1206 */ 1206 */
1207static int anys(char *s1, char *s2) 1207static int any(int c, const char *s)
1208{ 1208{
1209 while (*s1) 1209 while (*s)
1210 if (any(*s1++, s2)) 1210 if (*s++ == c)
1211 return 1; 1211 return 1;
1212 return 0; 1212 return 0;
1213} 1213}
1214 1214
1215/* 1215/*
1216 * Is character c in s? 1216 * Is any character from s1 in s2?
1217 */ 1217 */
1218static int any(int c, char *s) 1218static int anys(const char *s1, const char *s2)
1219{ 1219{
1220 while (*s) 1220 while (*s1)
1221 if (*s++ == c) 1221 if (any(*s1++, s2))
1222 return 1; 1222 return 1;
1223 return 0; 1223 return 0;
1224} 1224}
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 7ae010163..94d04b12a 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -314,8 +314,8 @@ int fbset_main(int argc, char **argv)
314{ 314{
315 struct fb_var_screeninfo var, varset; 315 struct fb_var_screeninfo var, varset;
316 int fh, i; 316 int fh, i;
317 char *fbdev = DEFAULTFBDEV; 317 const char *fbdev = DEFAULTFBDEV;
318 char *modefile = DEFAULTFBMODE; 318 const char *modefile = DEFAULTFBMODE;
319 char *thisarg, *mode = NULL; 319 char *thisarg, *mode = NULL;
320 320
321 memset(&varset, 0xFF, sizeof(varset)); 321 memset(&varset, 0xFF, sizeof(varset));
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index 957316d52..4a0e9f9fd 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -141,7 +141,8 @@ static void make_device(char *path, int delete)
141 } 141 }
142 if (ENABLE_FEATURE_MDEV_EXEC && field == 3) { 142 if (ENABLE_FEATURE_MDEV_EXEC && field == 3) {
143 // Command to run 143 // Command to run
144 char *s = "@$*", *s2; 144 const char *s = "@$*";
145 const char *s2;
145 s2 = strchr(s, *pos++); 146 s2 = strchr(s, *pos++);
146 if (!s2) { 147 if (!s2) {
147 // Force error 148 // Force error
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index 4c23f69da..007083bef 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -28,7 +28,7 @@ dev_t rootdev;
28 28
29// Recursively delete contents of rootfs. 29// Recursively delete contents of rootfs.
30 30
31static void delete_contents(char *directory) 31static void delete_contents(const char *directory)
32{ 32{
33 DIR *dir; 33 DIR *dir;
34 struct dirent *d; 34 struct dirent *d;