hand-sorted ctypes/chtypes upgrade; use table-driven where they make

sense and preprocessored otherwise; unify the logic
saves 144t 1i and lots of cpp(1) time, as well as improves readability
This commit is contained in:
tg
2006-11-10 07:52:04 +00:00
parent feb7dddd44
commit 56ffbf7e70
11 changed files with 72 additions and 76 deletions

6
shf.c
View File

@@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.7 2006/11/09 21:00:13 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.8 2006/11/10 07:52:04 tg Exp $");
/* flags to shf_emptybuf() */
#define EB_READSW 0x01 /* about to switch to reading */
@@ -819,9 +819,9 @@ shf_vfprintf(struct shf *shf, const char *fmt, va_list args)
flags |= FL_SHORT;
continue;
}
if (digit(c)) {
if (ksh_isdigit(c)) {
tmp = c - '0';
while (c = *fmt++, digit(c))
while (c = *fmt++, ksh_isdigit(c))
tmp = tmp * 10 + c - '0';
--fmt;
if (tmp < 0) /* overflow? */