* Copyright (c) 1989
* The Regents of the University of California. All rights reserved.
*
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
*
* Original copyright notice is retained at the end of this file.
*/
struct stat sbuf;
if (statok) {
- if (fstat(STDIN_FILENO, &sbuf)) {
- bb_simple_perror_msg_and_die(fname);
- }
+ xfstat(STDIN_FILENO, &sbuf, fname);
if (!(S_ISCHR(sbuf.st_mode) || S_ISBLK(sbuf.st_mode) || S_ISFIFO(sbuf.st_mode))
&& dumper->pub.dump_skip >= sbuf.st_size
) {
for (;;) {
if (*dumper->argv) {
+ dumper->next__done = statok = 1;
if (!(freopen(*dumper->argv, "r", stdin))) {
bb_simple_perror_msg(*dumper->argv);
dumper->exitval = 1;
++dumper->argv;
continue;
}
- dumper->next__done = statok = 1;
} else {
if (dumper->next__done)
- return 0;
+ return 0; /* no next file */
dumper->next__done = 1;
statok = 0;
}
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);
}
} 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 {
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);