From b6aae0f38194cd39960a898606ee65d4be93a895 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 29 Jan 2007 22:51:25 +0000 Subject: preparatory patch for -Wwrite-strings #2 --- shell/msh.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'shell/msh.c') 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 */ 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; } -- cgit v1.2.3