diff options
author | Denis Vlasenko | 2007-01-29 22:51:25 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-01-29 22:51:25 +0000 |
commit | b6aae0f38194cd39960a898606ee65d4be93a895 (patch) | |
tree | b73c92aefaf614291a71d05e9d28ca68f4ef021b /shell | |
parent | a41fdf331af344ecd3ec230a072857ea197e1890 (diff) | |
download | busybox-b6aae0f38194cd39960a898606ee65d4be93a895.zip busybox-b6aae0f38194cd39960a898606ee65d4be93a895.tar.gz |
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 7e27432..dca04b5 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -308,7 +308,8 @@ static char *indenter(int i) #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... diff --git a/shell/msh.c b/shell/msh.c index 15ce9ff..5846686 100644 --- a/shell/msh.c +++ b/shell/msh.c @@ -280,9 +280,9 @@ static void onintr(int s); /* SIGINT handler */ 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 int gmatch(char *s, char *p); */ 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 @@ static void leave(void) /* NOTREACHED */ } -static void warn(char *s) +static void warn(const char *s) { if (*s) { prs(s); @@ -1146,7 +1146,7 @@ static void warn(char *s) leave(); } -static void err(char *s) +static void err(const char *s) { warn(s); if (flag['n']) @@ -1202,23 +1202,23 @@ static void quitenv(void) } /* - * 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; } |