libbb: robustify isXXXX(). +39 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2009-11-18 11:34:43 +01:00
parent 5b0a7f1a6e
commit 8684cbb5cc
9 changed files with 28 additions and 25 deletions

View File

@@ -492,13 +492,13 @@ static void conv_c(PR *pr, unsigned char *p)
str += 4;
} while (*str);
if (isprint(*p)) {
if (isprint_asciionly(*p)) {
*pr->cchar = 'c';
printf(pr->fmt, *p);
} else {
sprintf(buf, "%03o", (int) *p);
str = buf;
strpr:
strpr:
*pr->cchar = 's';
printf(pr->fmt, str);
}
@@ -519,7 +519,7 @@ static void conv_u(PR *pr, unsigned char *p)
} else if (*p == 0x7f) {
*pr->cchar = 's';
printf(pr->fmt, "del");
} else if (isprint(*p)) {
} else if (*p < 0x7f) { /* isprint() */
*pr->cchar = 'c';
printf(pr->fmt, *p);
} else {
@@ -609,7 +609,7 @@ static void display(priv_dumper_t* dumper)
break;
}
case F_P:
printf(pr->fmt, isprint(*bp) ? *bp : '.');
printf(pr->fmt, isprint_asciionly(*bp) ? *bp : '.');
break;
case F_STR:
printf(pr->fmt, (char *) bp);