diff options
-rw-r--r-- | applets/applets.c | 6 | ||||
-rw-r--r-- | archival/tar.c | 2 | ||||
-rw-r--r-- | coreutils/cat.c | 2 | ||||
-rw-r--r-- | coreutils/date.c | 6 | ||||
-rw-r--r-- | coreutils/du.c | 2 | ||||
-rw-r--r-- | coreutils/expr.c | 8 | ||||
-rw-r--r-- | coreutils/fold.c | 2 | ||||
-rw-r--r-- | coreutils/head.c | 2 | ||||
-rw-r--r-- | coreutils/ln.c | 2 | ||||
-rw-r--r-- | coreutils/md5_sha1_sum.c | 2 | ||||
-rw-r--r-- | coreutils/printf.c | 20 | ||||
-rw-r--r-- | coreutils/tail.c | 2 | ||||
-rw-r--r-- | coreutils/yes.c | 2 | ||||
-rw-r--r-- | editors/awk.c | 47 | ||||
-rw-r--r-- | editors/ed.c | 2 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | libbb/find_root_device.c | 2 |
17 files changed, 59 insertions, 52 deletions
diff --git a/applets/applets.c b/applets/applets.c index a974743da..8a17cbf0b 100644 --- a/applets/applets.c +++ b/applets/applets.c | |||
@@ -106,7 +106,7 @@ static char *get_trimmed_slice(char *s, char *e) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | #define parse_error(x) { err=x; goto pe_label; } | 109 | #define parse_error(x) do { errmsg = x; goto pe_label; } while(0) |
110 | 110 | ||
111 | /* Don't depend on the tools to combine strings. */ | 111 | /* Don't depend on the tools to combine strings. */ |
112 | static const char config_file[] = CONFIG_FILE; | 112 | static const char config_file[] = CONFIG_FILE; |
@@ -130,7 +130,7 @@ static void parse_config_file(void) | |||
130 | struct BB_suid_config *sct; | 130 | struct BB_suid_config *sct; |
131 | struct BB_applet *applet; | 131 | struct BB_applet *applet; |
132 | FILE *f; | 132 | FILE *f; |
133 | char *err; | 133 | const char *errmsg; |
134 | char *s; | 134 | char *s; |
135 | char *e; | 135 | char *e; |
136 | int i, lc, section; | 136 | int i, lc, section; |
@@ -307,7 +307,7 @@ static void parse_config_file(void) | |||
307 | 307 | ||
308 | pe_label: | 308 | pe_label: |
309 | fprintf(stderr, "Parse error in %s, line %d: %s\n", | 309 | fprintf(stderr, "Parse error in %s, line %d: %s\n", |
310 | config_file, lc, err); | 310 | config_file, lc, errmsg); |
311 | 311 | ||
312 | fclose(f); | 312 | fclose(f); |
313 | /* Release any allocated memory before returning. */ | 313 | /* Release any allocated memory before returning. */ |
diff --git a/archival/tar.c b/archival/tar.c index ca59643e5..6c15f65c9 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -504,7 +504,7 @@ static int writeTarFile(const int tar_fd, const int verboseFlag, | |||
504 | int gzipDataPipe[2] = { -1, -1 }; | 504 | int gzipDataPipe[2] = { -1, -1 }; |
505 | int gzipStatusPipe[2] = { -1, -1 }; | 505 | int gzipStatusPipe[2] = { -1, -1 }; |
506 | volatile int vfork_exec_errno = 0; | 506 | volatile int vfork_exec_errno = 0; |
507 | char *zip_exec = (gzip == 1) ? "gzip" : "bzip2"; | 507 | const char *zip_exec = (gzip == 1) ? "gzip" : "bzip2"; |
508 | 508 | ||
509 | if (pipe(gzipDataPipe) < 0 || pipe(gzipStatusPipe) < 0) | 509 | if (pipe(gzipDataPipe) < 0 || pipe(gzipStatusPipe) < 0) |
510 | bb_perror_msg_and_die("pipe"); | 510 | bb_perror_msg_and_die("pipe"); |
diff --git a/coreutils/cat.c b/coreutils/cat.c index 2b7c6035f..7a34891e8 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c | |||
@@ -14,7 +14,7 @@ | |||
14 | 14 | ||
15 | int bb_cat(char **argv) | 15 | int bb_cat(char **argv) |
16 | { | 16 | { |
17 | static char *const argv_dash[] = { "-", NULL }; | 17 | static const char *const argv_dash[] = { "-", NULL }; |
18 | FILE *f; | 18 | FILE *f; |
19 | int retval = EXIT_SUCCESS; | 19 | int retval = EXIT_SUCCESS; |
20 | 20 | ||
diff --git a/coreutils/date.c b/coreutils/date.c index a6690e8bd..034a18b98 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -41,7 +41,7 @@ static void xputenv(char *s) | |||
41 | static void maybe_set_utc(int opt) | 41 | static void maybe_set_utc(int opt) |
42 | { | 42 | { |
43 | if (opt & DATE_OPT_UTC) | 43 | if (opt & DATE_OPT_UTC) |
44 | xputenv("TZ=UTC0"); | 44 | xputenv((char*)"TZ=UTC0"); |
45 | } | 45 | } |
46 | 46 | ||
47 | int date_main(int argc, char **argv) | 47 | int date_main(int argc, char **argv) |
@@ -218,7 +218,7 @@ format_utc: | |||
218 | i = 22; | 218 | i = 22; |
219 | goto format_utc; | 219 | goto format_utc; |
220 | } else /* default case */ | 220 | } else /* default case */ |
221 | date_fmt = "%a %b %e %H:%M:%S %Z %Y"; | 221 | date_fmt = (char*)"%a %b %e %H:%M:%S %Z %Y"; |
222 | } | 222 | } |
223 | 223 | ||
224 | if (*date_fmt == '\0') { | 224 | if (*date_fmt == '\0') { |
@@ -228,7 +228,7 @@ format_utc: | |||
228 | /* Handle special conversions */ | 228 | /* Handle special conversions */ |
229 | 229 | ||
230 | if (strncmp(date_fmt, "%f", 2) == 0) { | 230 | if (strncmp(date_fmt, "%f", 2) == 0) { |
231 | date_fmt = "%Y.%m.%d-%H:%M:%S"; | 231 | date_fmt = (char*)"%Y.%m.%d-%H:%M:%S"; |
232 | } | 232 | } |
233 | 233 | ||
234 | /* Generate output string */ | 234 | /* Generate output string */ |
diff --git a/coreutils/du.c b/coreutils/du.c index a1ca5b59b..a4b3c817e 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -222,7 +222,7 @@ int du_main(int argc, char **argv) | |||
222 | /* go through remaining args (if any) */ | 222 | /* go through remaining args (if any) */ |
223 | argv += optind; | 223 | argv += optind; |
224 | if (optind >= argc) { | 224 | if (optind >= argc) { |
225 | *--argv = "."; | 225 | *--argv = (char*)"."; |
226 | if (slink_depth == 1) { | 226 | if (slink_depth == 1) { |
227 | slink_depth = 0; | 227 | slink_depth = 0; |
228 | } | 228 | } |
diff --git a/coreutils/expr.c b/coreutils/expr.c index 51e553dc6..469d467bf 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
@@ -67,8 +67,8 @@ static char **args; | |||
67 | static VALUE *docolon(VALUE * sv, VALUE * pv); | 67 | static VALUE *docolon(VALUE * sv, VALUE * pv); |
68 | static VALUE *eval(void); | 68 | static VALUE *eval(void); |
69 | static VALUE *int_value(arith_t i); | 69 | static VALUE *int_value(arith_t i); |
70 | static VALUE *str_value(char *s); | 70 | static VALUE *str_value(const char *s); |
71 | static int nextarg(char *str); | 71 | static int nextarg(const char *str); |
72 | static int null(VALUE * v); | 72 | static int null(VALUE * v); |
73 | static int toarith(VALUE * v); | 73 | static int toarith(VALUE * v); |
74 | static void freev(VALUE * v); | 74 | static void freev(VALUE * v); |
@@ -110,7 +110,7 @@ static VALUE *int_value(arith_t i) | |||
110 | 110 | ||
111 | /* Return a VALUE for S. */ | 111 | /* Return a VALUE for S. */ |
112 | 112 | ||
113 | static VALUE *str_value(char *s) | 113 | static VALUE *str_value(const char *s) |
114 | { | 114 | { |
115 | VALUE *v; | 115 | VALUE *v; |
116 | 116 | ||
@@ -172,7 +172,7 @@ static int toarith(VALUE * v) | |||
172 | /* Return nonzero if the next token matches STR exactly. | 172 | /* Return nonzero if the next token matches STR exactly. |
173 | STR must not be NULL. */ | 173 | STR must not be NULL. */ |
174 | 174 | ||
175 | static int nextarg(char *str) | 175 | static int nextarg(const char *str) |
176 | { | 176 | { |
177 | if (*args == NULL) | 177 | if (*args == NULL) |
178 | return 0; | 178 | return 0; |
diff --git a/coreutils/fold.c b/coreutils/fold.c index fd7298169..490882f6d 100644 --- a/coreutils/fold.c +++ b/coreutils/fold.c | |||
@@ -66,7 +66,7 @@ int fold_main(int argc, char **argv) | |||
66 | 66 | ||
67 | argv += optind; | 67 | argv += optind; |
68 | if (!*argv) { | 68 | if (!*argv) { |
69 | *--argv = "-"; | 69 | *--argv = (char*)"-"; |
70 | } | 70 | } |
71 | 71 | ||
72 | do { | 72 | do { |
diff --git a/coreutils/head.c b/coreutils/head.c index 56e7a960c..59b4d552c 100644 --- a/coreutils/head.c +++ b/coreutils/head.c | |||
@@ -92,7 +92,7 @@ int head_main(int argc, char **argv) | |||
92 | 92 | ||
93 | argv += optind; | 93 | argv += optind; |
94 | if (!*argv) { | 94 | if (!*argv) { |
95 | *--argv = "-"; | 95 | *--argv = (char*)"-"; |
96 | } | 96 | } |
97 | 97 | ||
98 | fmt = header_fmt_str + 1; | 98 | fmt = header_fmt_str + 1; |
diff --git a/coreutils/ln.c b/coreutils/ln.c index 231a3bf03..a307e5579 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -26,7 +26,7 @@ int ln_main(int argc, char **argv) | |||
26 | char *last; | 26 | char *last; |
27 | char *src_name; | 27 | char *src_name; |
28 | char *src; | 28 | char *src; |
29 | char *suffix = "~"; | 29 | char *suffix = (char*)"~"; |
30 | struct stat statbuf; | 30 | struct stat statbuf; |
31 | int (*link_func)(const char *, const char *); | 31 | int (*link_func)(const char *, const char *); |
32 | 32 | ||
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c index 014ecefd0..d945ce7e0 100644 --- a/coreutils/md5_sha1_sum.c +++ b/coreutils/md5_sha1_sum.c | |||
@@ -102,7 +102,7 @@ int md5_sha1_sum_main(int argc, char **argv) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | if (argc == optind) { | 104 | if (argc == optind) { |
105 | argv[argc++] = "-"; | 105 | argv[argc++] = (char*)"-"; |
106 | } | 106 | } |
107 | 107 | ||
108 | if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && (flags & FLAG_CHECK)) { | 108 | if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && (flags & FLAG_CHECK)) { |
diff --git a/coreutils/printf.c b/coreutils/printf.c index 0e818354f..924499b29 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c | |||
@@ -42,11 +42,11 @@ | |||
42 | 42 | ||
43 | static int print_formatted(char *format, int argc, char **argv); | 43 | static int print_formatted(char *format, int argc, char **argv); |
44 | static void print_direc(char *start, size_t length, | 44 | static void print_direc(char *start, size_t length, |
45 | int field_width, int precision, char *argument); | 45 | int field_width, int precision, const char *argument); |
46 | 46 | ||
47 | typedef void (*converter)(char *arg, void *result); | 47 | typedef void (*converter)(const char *arg, void *result); |
48 | 48 | ||
49 | static void multiconvert(char *arg, void *result, converter convert) | 49 | static void multiconvert(const char *arg, void *result, converter convert) |
50 | { | 50 | { |
51 | char s[16]; | 51 | char s[16]; |
52 | if (*arg == '"' || *arg == '\'') { | 52 | if (*arg == '"' || *arg == '\'') { |
@@ -58,15 +58,15 @@ static void multiconvert(char *arg, void *result, converter convert) | |||
58 | fputs(arg, stderr); | 58 | fputs(arg, stderr); |
59 | } | 59 | } |
60 | 60 | ||
61 | static void conv_strtoul(char *arg, void *result) | 61 | static void conv_strtoul(const char *arg, void *result) |
62 | { | 62 | { |
63 | *(unsigned long*)result = bb_strtoul(arg, NULL, 10); | 63 | *(unsigned long*)result = bb_strtoul(arg, NULL, 10); |
64 | } | 64 | } |
65 | static void conv_strtol(char *arg, void *result) | 65 | static void conv_strtol(const char *arg, void *result) |
66 | { | 66 | { |
67 | *(long*)result = bb_strtol(arg, NULL, 10); | 67 | *(long*)result = bb_strtol(arg, NULL, 10); |
68 | } | 68 | } |
69 | static void conv_strtod(char *arg, void *result) | 69 | static void conv_strtod(const char *arg, void *result) |
70 | { | 70 | { |
71 | char *end; | 71 | char *end; |
72 | /* Well, this one allows leading whitespace... so what */ | 72 | /* Well, this one allows leading whitespace... so what */ |
@@ -75,21 +75,21 @@ static void conv_strtod(char *arg, void *result) | |||
75 | if (end[0]) errno = ERANGE; | 75 | if (end[0]) errno = ERANGE; |
76 | } | 76 | } |
77 | 77 | ||
78 | static unsigned long my_xstrtoul(char *arg) | 78 | static unsigned long my_xstrtoul(const char *arg) |
79 | { | 79 | { |
80 | unsigned long result; | 80 | unsigned long result; |
81 | multiconvert(arg, &result, conv_strtoul); | 81 | multiconvert(arg, &result, conv_strtoul); |
82 | return result; | 82 | return result; |
83 | } | 83 | } |
84 | 84 | ||
85 | static long my_xstrtol(char *arg) | 85 | static long my_xstrtol(const char *arg) |
86 | { | 86 | { |
87 | long result; | 87 | long result; |
88 | multiconvert(arg, &result, conv_strtol); | 88 | multiconvert(arg, &result, conv_strtol); |
89 | return result; | 89 | return result; |
90 | } | 90 | } |
91 | 91 | ||
92 | static double my_xstrtod(char *arg) | 92 | static double my_xstrtod(const char *arg) |
93 | { | 93 | { |
94 | double result; | 94 | double result; |
95 | multiconvert(arg, &result, conv_strtod); | 95 | multiconvert(arg, &result, conv_strtod); |
@@ -239,7 +239,7 @@ static int print_formatted(char *format, int argc, char **argv) | |||
239 | 239 | ||
240 | static void | 240 | static void |
241 | print_direc(char *start, size_t length, int field_width, int precision, | 241 | print_direc(char *start, size_t length, int field_width, int precision, |
242 | char *argument) | 242 | const char *argument) |
243 | { | 243 | { |
244 | char *p; /* Null-terminated copy of % directive. */ | 244 | char *p; /* Null-terminated copy of % directive. */ |
245 | 245 | ||
diff --git a/coreutils/tail.c b/coreutils/tail.c index f1ba04ec6..2a1645309 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -91,7 +91,7 @@ int tail_main(int argc, char **argv) | |||
91 | if (argc >= 2 && (argv[1][0] == '+' || argv[1][0] == '-') | 91 | if (argc >= 2 && (argv[1][0] == '+' || argv[1][0] == '-') |
92 | && isdigit(argv[1][1]) | 92 | && isdigit(argv[1][1]) |
93 | ) { | 93 | ) { |
94 | argv[0] = "-n"; | 94 | argv[0] = (char*)"-n"; |
95 | argv--; | 95 | argv--; |
96 | argc++; | 96 | argc++; |
97 | } | 97 | } |
diff --git a/coreutils/yes.c b/coreutils/yes.c index 894506a89..fc6e611e6 100644 --- a/coreutils/yes.c +++ b/coreutils/yes.c | |||
@@ -22,7 +22,7 @@ int yes_main(int argc, char **argv) | |||
22 | const char *fmt; | 22 | const char *fmt; |
23 | char **first_arg; | 23 | char **first_arg; |
24 | 24 | ||
25 | *argv = "y"; | 25 | *argv = (char*)"y"; |
26 | if (argc != 1) { | 26 | if (argc != 1) { |
27 | ++argv; | 27 | ++argv; |
28 | } | 28 | } |
diff --git a/editors/awk.c b/editors/awk.c index d6dcd9578..ae7ca23d4 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -47,7 +47,7 @@ typedef struct var_s { | |||
47 | typedef struct chain_s { | 47 | typedef struct chain_s { |
48 | struct node_s *first; | 48 | struct node_s *first; |
49 | struct node_s *last; | 49 | struct node_s *last; |
50 | char *programname; | 50 | const char *programname; |
51 | } chain; | 51 | } chain; |
52 | 52 | ||
53 | /* Function */ | 53 | /* Function */ |
@@ -399,7 +399,7 @@ static int nextrec, nextfile; | |||
399 | static node *break_ptr, *continue_ptr; | 399 | static node *break_ptr, *continue_ptr; |
400 | static rstream *iF; | 400 | static rstream *iF; |
401 | static xhash *vhash, *ahash, *fdhash, *fnhash; | 401 | static xhash *vhash, *ahash, *fdhash, *fnhash; |
402 | static char *programname; | 402 | static const char *programname; |
403 | static short lineno; | 403 | static short lineno; |
404 | static int is_f0_split; | 404 | static int is_f0_split; |
405 | static int nfields; | 405 | static int nfields; |
@@ -703,7 +703,7 @@ static var *setvar_i(var *v, double value) | |||
703 | return v; | 703 | return v; |
704 | } | 704 | } |
705 | 705 | ||
706 | static char *getvar_s(var *v) | 706 | static const char *getvar_s(var *v) |
707 | { | 707 | { |
708 | /* if v is numeric and has no cached string, convert it to string */ | 708 | /* if v is numeric and has no cached string, convert it to string */ |
709 | if ((v->type & (VF_NUMBER | VF_CACHED)) == VF_NUMBER) { | 709 | if ((v->type & (VF_NUMBER | VF_CACHED)) == VF_NUMBER) { |
@@ -995,7 +995,7 @@ static node *new_node(uint32_t info) | |||
995 | return n; | 995 | return n; |
996 | } | 996 | } |
997 | 997 | ||
998 | static node *mk_re_node(char *s, node *n, regex_t *re) | 998 | static node *mk_re_node(const char *s, node *n, regex_t *re) |
999 | { | 999 | { |
1000 | n->info = OC_REGEXP; | 1000 | n->info = OC_REGEXP; |
1001 | n->l.re = re; | 1001 | n->l.re = re; |
@@ -1347,7 +1347,7 @@ static void parse_program(char *p) | |||
1347 | 1347 | ||
1348 | /* -------- program execution part -------- */ | 1348 | /* -------- program execution part -------- */ |
1349 | 1349 | ||
1350 | static node *mk_splitter(char *s, tsplitter *spl) | 1350 | static node *mk_splitter(const char *s, tsplitter *spl) |
1351 | { | 1351 | { |
1352 | regex_t *re, *ire; | 1352 | regex_t *re, *ire; |
1353 | node *n; | 1353 | node *n; |
@@ -1375,7 +1375,7 @@ static node *mk_splitter(char *s, tsplitter *spl) | |||
1375 | static regex_t *as_regex(node *op, regex_t *preg) | 1375 | static regex_t *as_regex(node *op, regex_t *preg) |
1376 | { | 1376 | { |
1377 | var *v; | 1377 | var *v; |
1378 | char *s; | 1378 | const char *s; |
1379 | 1379 | ||
1380 | if ((op->info & OPCLSMASK) == OC_REGEXP) { | 1380 | if ((op->info & OPCLSMASK) == OC_REGEXP) { |
1381 | return icase ? op->r.ire : op->l.re; | 1381 | return icase ? op->r.ire : op->l.re; |
@@ -1419,7 +1419,7 @@ static void fsrealloc(int size) | |||
1419 | nfields = size; | 1419 | nfields = size; |
1420 | } | 1420 | } |
1421 | 1421 | ||
1422 | static int awk_split(char *s, node *spl, char **slist) | 1422 | static int awk_split(const char *s, node *spl, char **slist) |
1423 | { | 1423 | { |
1424 | int l, n = 0; | 1424 | int l, n = 0; |
1425 | char c[4]; | 1425 | char c[4]; |
@@ -1427,7 +1427,8 @@ static int awk_split(char *s, node *spl, char **slist) | |||
1427 | regmatch_t pmatch[2]; | 1427 | regmatch_t pmatch[2]; |
1428 | 1428 | ||
1429 | /* in worst case, each char would be a separate field */ | 1429 | /* in worst case, each char would be a separate field */ |
1430 | *slist = s1 = xstrndup(s, strlen(s) * 2 + 3); | 1430 | *slist = s1 = xzalloc(strlen(s) * 2 + 3); |
1431 | strcpy(s1, s); | ||
1431 | 1432 | ||
1432 | c[0] = c[1] = (char)spl->info; | 1433 | c[0] = c[1] = (char)spl->info; |
1433 | c[2] = c[3] = '\0'; | 1434 | c[2] = c[3] = '\0'; |
@@ -1436,8 +1437,9 @@ static int awk_split(char *s, node *spl, char **slist) | |||
1436 | if ((spl->info & OPCLSMASK) == OC_REGEXP) { /* regex split */ | 1437 | if ((spl->info & OPCLSMASK) == OC_REGEXP) { /* regex split */ |
1437 | while (*s) { | 1438 | while (*s) { |
1438 | l = strcspn(s, c+2); | 1439 | l = strcspn(s, c+2); |
1439 | if (regexec(icase ? spl->r.ire : spl->l.re, s, 1, pmatch, 0) == 0 && | 1440 | if (regexec(icase ? spl->r.ire : spl->l.re, s, 1, pmatch, 0) == 0 |
1440 | pmatch[0].rm_so <= l) { | 1441 | && pmatch[0].rm_so <= l |
1442 | ) { | ||
1441 | l = pmatch[0].rm_so; | 1443 | l = pmatch[0].rm_so; |
1442 | if (pmatch[0].rm_eo == 0) { l++; pmatch[0].rm_eo++; } | 1444 | if (pmatch[0].rm_eo == 0) { l++; pmatch[0].rm_eo++; } |
1443 | } else { | 1445 | } else { |
@@ -1510,7 +1512,8 @@ static void split_f0(void) | |||
1510 | static void handle_special(var *v) | 1512 | static void handle_special(var *v) |
1511 | { | 1513 | { |
1512 | int n; | 1514 | int n; |
1513 | char *b, *sep, *s; | 1515 | char *b; |
1516 | const char *sep, *s; | ||
1514 | int sl, l, len, i, bsize; | 1517 | int sl, l, len, i, bsize; |
1515 | 1518 | ||
1516 | if (!(v->type & VF_SPECIAL)) | 1519 | if (!(v->type & VF_SPECIAL)) |
@@ -1737,7 +1740,8 @@ static int fmt_num(char *b, int size, const char *format, double n, int int_as_i | |||
1737 | static char *awk_printf(node *n) | 1740 | static char *awk_printf(node *n) |
1738 | { | 1741 | { |
1739 | char *b = NULL; | 1742 | char *b = NULL; |
1740 | char *fmt, *s, *s1, *f; | 1743 | char *fmt, *s, *f; |
1744 | const char *s1; | ||
1741 | int i, j, incr, bsize; | 1745 | int i, j, incr, bsize; |
1742 | char c, c1; | 1746 | char c, c1; |
1743 | var *v, *arg; | 1747 | var *v, *arg; |
@@ -1793,10 +1797,11 @@ static char *awk_printf(node *n) | |||
1793 | * all matches. If src or dst is NULL, use $0. If ex=TRUE, enable | 1797 | * all matches. If src or dst is NULL, use $0. If ex=TRUE, enable |
1794 | * subexpression matching (\1-\9) | 1798 | * subexpression matching (\1-\9) |
1795 | */ | 1799 | */ |
1796 | static int awk_sub(node *rn, char *repl, int nm, var *src, var *dest, int ex) | 1800 | static int awk_sub(node *rn, const char *repl, int nm, var *src, var *dest, int ex) |
1797 | { | 1801 | { |
1798 | char *ds = NULL; | 1802 | char *ds = NULL; |
1799 | char *sp, *s; | 1803 | const char *s; |
1804 | const char *sp; | ||
1800 | int c, i, j, di, rl, so, eo, nbs, n, dssize; | 1805 | int c, i, j, di, rl, so, eo, nbs, n, dssize; |
1801 | regmatch_t pmatch[10]; | 1806 | regmatch_t pmatch[10]; |
1802 | regex_t sreg, *re; | 1807 | regex_t sreg, *re; |
@@ -1865,7 +1870,7 @@ static var *exec_builtin(node *op, var *res) | |||
1865 | var *tv; | 1870 | var *tv; |
1866 | node *an[4]; | 1871 | node *an[4]; |
1867 | var *av[4]; | 1872 | var *av[4]; |
1868 | char *as[4]; | 1873 | const char *as[4]; |
1869 | regmatch_t pmatch[2]; | 1874 | regmatch_t pmatch[2]; |
1870 | regex_t sreg, *re; | 1875 | regex_t sreg, *re; |
1871 | static tsplitter tspl; | 1876 | static tsplitter tspl; |
@@ -1998,8 +2003,10 @@ static var *exec_builtin(node *op, var *res) | |||
1998 | tt = getvar_i(av[1]); | 2003 | tt = getvar_i(av[1]); |
1999 | else | 2004 | else |
2000 | time(&tt); | 2005 | time(&tt); |
2001 | s = (nargs > 0) ? as[0] : "%a %b %d %H:%M:%S %Z %Y"; | 2006 | //s = (nargs > 0) ? as[0] : "%a %b %d %H:%M:%S %Z %Y"; |
2002 | i = strftime(buf, MAXVARFMT, s, localtime(&tt)); | 2007 | i = strftime(buf, MAXVARFMT, |
2008 | ((nargs > 0) ? as[0] : "%a %b %d %H:%M:%S %Z %Y"), | ||
2009 | localtime(&tt)); | ||
2003 | buf[i] = '\0'; | 2010 | buf[i] = '\0'; |
2004 | setvar_s(res, buf); | 2011 | setvar_s(res, buf); |
2005 | break; | 2012 | break; |
@@ -2054,7 +2061,7 @@ static var *evaluate(node *op, var *res) | |||
2054 | var *v1; | 2061 | var *v1; |
2055 | union { | 2062 | union { |
2056 | var *v; | 2063 | var *v; |
2057 | char *s; | 2064 | const char *s; |
2058 | double d; | 2065 | double d; |
2059 | int i; | 2066 | int i; |
2060 | } L, R; | 2067 | } L, R; |
@@ -2168,7 +2175,7 @@ static var *evaluate(node *op, var *res) | |||
2168 | } else { /* OC_PRINTF */ | 2175 | } else { /* OC_PRINTF */ |
2169 | L.s = awk_printf(op1); | 2176 | L.s = awk_printf(op1); |
2170 | fputs(L.s, X.F); | 2177 | fputs(L.s, X.F); |
2171 | free(L.s); | 2178 | free((char*)L.s); |
2172 | } | 2179 | } |
2173 | fflush(X.F); | 2180 | fflush(X.F); |
2174 | break; | 2181 | break; |
@@ -2610,7 +2617,7 @@ static rstream *next_input_file(void) | |||
2610 | { | 2617 | { |
2611 | static rstream rsm; | 2618 | static rstream rsm; |
2612 | FILE *F = NULL; | 2619 | FILE *F = NULL; |
2613 | char *fname, *ind; | 2620 | const char *fname, *ind; |
2614 | static int files_happen = FALSE; | 2621 | static int files_happen = FALSE; |
2615 | 2622 | ||
2616 | if (rsm.F) fclose(rsm.F); | 2623 | if (rsm.F) fclose(rsm.F); |
diff --git a/editors/ed.c b/editors/ed.c index 3aca75912..5a48fbe75 100644 --- a/editors/ed.c +++ b/editors/ed.c | |||
@@ -401,7 +401,7 @@ static void subCommand(const char * cmd, int num1, int num2) | |||
401 | if (cp) | 401 | if (cp) |
402 | *cp++ = '\0'; | 402 | *cp++ = '\0'; |
403 | else | 403 | else |
404 | cp = ""; | 404 | cp = (char*)""; |
405 | 405 | ||
406 | while (*cp) switch (*cp++) { | 406 | while (*cp) switch (*cp++) { |
407 | case 'g': | 407 | case 'g': |
diff --git a/include/libbb.h b/include/libbb.h index 540170cdd..6f195cf46 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -239,7 +239,7 @@ extern int recursive_action(const char *fileName, int recurse, | |||
239 | void* userData, int depth); | 239 | void* userData, int depth); |
240 | extern int device_open(const char *device, int mode); | 240 | extern int device_open(const char *device, int mode); |
241 | extern int get_console_fd(void); | 241 | extern int get_console_fd(void); |
242 | extern char *find_block_device(char *path); | 242 | extern char *find_block_device(const char *path); |
243 | /* bb_copyfd_XX print read/write errors and return -1 if they occur */ | 243 | /* bb_copyfd_XX print read/write errors and return -1 if they occur */ |
244 | extern off_t bb_copyfd_eof(int fd1, int fd2); | 244 | extern off_t bb_copyfd_eof(int fd1, int fd2); |
245 | extern off_t bb_copyfd_size(int fd1, int fd2, off_t size); | 245 | extern off_t bb_copyfd_size(int fd1, int fd2, off_t size); |
diff --git a/libbb/find_root_device.c b/libbb/find_root_device.c index 1d74d1ea8..ea360eae5 100644 --- a/libbb/find_root_device.c +++ b/libbb/find_root_device.c | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | #include "libbb.h" | 10 | #include "libbb.h" |
11 | 11 | ||
12 | char *find_block_device(char *path) | 12 | char *find_block_device(const char *path) |
13 | { | 13 | { |
14 | DIR *dir; | 14 | DIR *dir; |
15 | struct dirent *entry; | 15 | struct dirent *entry; |