diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-29 22:51:25 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-29 22:51:25 +0000 |
| commit | b6aae0f38194cd39960a898606ee65d4be93a895 (patch) | |
| tree | b73c92aefaf614291a71d05e9d28ca68f4ef021b /shell | |
| parent | a41fdf331af344ecd3ec230a072857ea197e1890 (diff) | |
| download | busybox-w32-b6aae0f38194cd39960a898606ee65d4be93a895.tar.gz busybox-w32-b6aae0f38194cd39960a898606ee65d4be93a895.tar.bz2 busybox-w32-b6aae0f38194cd39960a898606ee65d4be93a895.zip | |
preparatory patch for -Wwrite-strings #2
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/hush.c | 3 | ||||
| -rw-r--r-- | shell/msh.c | 28 |
2 files changed, 16 insertions, 15 deletions
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 | ||
| 311 | static void __syntax(char *file, int line) { | 311 | static 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 | ||
| 281 | static int newenv(int f); | 281 | static int newenv(int f); |
| 282 | static void quitenv(void); | 282 | static void quitenv(void); |
| 283 | static void err(char *s); | 283 | static void err(const char *s); |
| 284 | static int anys(char *s1, char *s2); | 284 | static int anys(const char *s1, const char *s2); |
| 285 | static int any(int c, char *s); | 285 | static int any(int c, const char *s); |
| 286 | static void next(int f); | 286 | static void next(int f); |
| 287 | static void setdash(void); | 287 | static void setdash(void); |
| 288 | static void onecommand(void); | 288 | static void onecommand(void); |
| @@ -295,7 +295,7 @@ static int gmatch(char *s, char *p); | |||
| 295 | */ | 295 | */ |
| 296 | static void leave(void); /* abort shell (or fail in subshell) */ | 296 | static void leave(void); /* abort shell (or fail in subshell) */ |
| 297 | static void fail(void); /* fail but return to process next command */ | 297 | static void fail(void); /* fail but return to process next command */ |
| 298 | static void warn(char *s); | 298 | static void warn(const char *s); |
| 299 | static void sig(int i); /* default signal handler */ | 299 | static 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 | ||
| 1138 | static void warn(char *s) | 1138 | static 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 | ||
| 1149 | static void err(char *s) | 1149 | static 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 | */ |
| 1207 | static int anys(char *s1, char *s2) | 1207 | static 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 | */ |
| 1218 | static int any(int c, char *s) | 1218 | static 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 | } |
