From 4aaa5b3257fe43fc8a68d47b9e16b571fdb570aa Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Tue, 16 Oct 2001 11:16:04 +0000 Subject: fix return code and tests of printf and comment above bslashquote func (16064) --- Src/builtin.c | 14 ++++++++++++-- Src/utils.c | 5 +++-- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'Src') diff --git a/Src/builtin.c b/Src/builtin.c index 8b05759b7..113c5931e 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -3125,6 +3125,10 @@ bin_print(char *name, char **args, char *ops, int func) if (*c == '*') { if (*args) width = (int)mathevali(*args++); + if (errflag) { + errflag = 0; + ret = 1; + } c++; } else if (idigit(*c)) { width = strtoul(c, &endptr, 0); @@ -3136,6 +3140,10 @@ bin_print(char *name, char **args, char *ops, int func) c++; if (*c == '*') { prec = (*args) ? (int)mathevali(*args++) : 0; + if (errflag) { + errflag = 0; + ret = 1; + } c++; } else if (idigit(*c)) { prec = strtoul(c, &endptr, 0); @@ -3147,7 +3155,6 @@ bin_print(char *name, char **args, char *ops, int func) /* ignore any size modifier */ if (*c == 'l' || *c == 'L' || *c == 'h') c++; - errflag = 0; d[1] = '\0'; switch (*d = *c) { case 'c': @@ -3226,6 +3233,7 @@ bin_print(char *name, char **args, char *ops, int func) if (errflag) { zlongval = 0; errflag = 0; + ret = 1; } print_val(zlongval) break; @@ -3238,11 +3246,12 @@ bin_print(char *name, char **args, char *ops, int func) if (errflag) { doubleval = 0; errflag = 0; + ret = 1; } print_val(doubleval) break; case 3: -#ifdef ZSH_64_BIT_TYPE +#ifdef ZSH_64_BIT_UTYPE *d++ = 'l'; #endif *d++ = 'l', *d++ = *c, *d = '\0'; @@ -3250,6 +3259,7 @@ bin_print(char *name, char **args, char *ops, int func) if (errflag) { doubleval = 0; errflag = 0; + ret = 1; } print_val(zulongval) } diff --git a/Src/utils.c b/Src/utils.c index 6bede2e43..539b383ee 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -2929,8 +2929,9 @@ hasspecial(char const *s) * pointer it points to may point to a position in s and in e the position * * of the corresponding character in the quoted string is returned. * * The last argument should be zero if this is to be used outside a string, * - * one if it is to be quoted for the inside of a single quoted string, and * - * two if it is for the inside of double quoted string. * + * one if it is to be quoted for the inside of a single quoted string, * + * two if it is for the inside of a double quoted string, and * + * three if it is for the inside of a posix quoted string. * * The string may be metafied and contain tokens. */ /**/ -- cgit 1.4.1