X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fsh%2Fshquote.c;h=4160e70ef6ed30059389290e82ebb42bd7607a32;hb=f73dda092b33638d2d5e9c35375f687a607b5403;hp=981e9673d068c0c867f8bcbcec0b1e107f4487e5;hpb=28ef6c316f1aff914bb95ac09787a3c83c1815fd;p=platform%2Fupstream%2Fbash.git diff --git a/lib/sh/shquote.c b/lib/sh/shquote.c index 981e967..4160e70 100644 --- a/lib/sh/shquote.c +++ b/lib/sh/shquote.c @@ -28,8 +28,7 @@ #include #include "syntax.h" - -extern char *xmalloc (); +#include /* **************************************************************** */ /* */ @@ -46,7 +45,7 @@ sh_single_quote (string) register int c; char *result, *r, *s; - result = xmalloc (3 + (4 * strlen (string))); + result = (char *)xmalloc (3 + (4 * strlen (string))); r = result; *r++ = '\''; @@ -73,10 +72,10 @@ char * sh_double_quote (string) char *string; { - register int c; + register unsigned char c; char *result, *r, *s; - result = xmalloc (3 + (2 * strlen (string))); + result = (char *)xmalloc (3 + (2 * strlen (string))); r = result; *r++ = '"'; @@ -103,7 +102,7 @@ sh_un_double_quote (string) register int c, pass_next; char *result, *r, *s; - r = result = xmalloc (strlen (string) + 1); + r = result = (char *)xmalloc (strlen (string) + 1); for (pass_next = 0, s = string; s && (c = *s); s++) { @@ -113,7 +112,7 @@ sh_un_double_quote (string) pass_next = 0; continue; } - if (c == '\\' && (sh_syntaxtab[s[1]] & CBSDQUOTE)) + if (c == '\\' && (sh_syntaxtab[(unsigned char) s[1]] & CBSDQUOTE)) { pass_next = 1; continue; @@ -134,7 +133,7 @@ sh_backslash_quote (string) int c; char *result, *r, *s; - result = xmalloc (2 * strlen (string) + 1); + result = (char *)xmalloc (2 * strlen (string) + 1); for (r = result, s = string; s && (c = *s); s++) { @@ -179,10 +178,10 @@ char * sh_backslash_quote_for_double_quotes (string) char *string; { - int c; + unsigned char c; char *result, *r, *s; - result = xmalloc (2 * strlen (string) + 1); + result = (char *)xmalloc (2 * strlen (string) + 1); for (r = result, s = string; s && (c = *s); s++) { @@ -219,6 +218,7 @@ sh_contains_shell_metas (string) case '~': /* tilde expansion */ if (s == string || s[-1] == '=' || s[-1] == ':') return (1); + break; case '#': if (s == string) /* comment char */ return (1);