aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-12-12 22:17:44 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-12-12 22:17:44 +0100
commit3e97eeb408a1107b0ffacc6ba39682428c4598f1 (patch)
treef6f7df81821d543bef855f961a76b09e79d49855
parent8cbc300d083001bccac4f33bf61b9dc97f29cb04 (diff)
downloadbusybox-w32-3e97eeb408a1107b0ffacc6ba39682428c4598f1.tar.gz
busybox-w32-3e97eeb408a1107b0ffacc6ba39682428c4598f1.tar.bz2
busybox-w32-3e97eeb408a1107b0ffacc6ba39682428c4598f1.zip
apply post-1.15.2 fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--Makefile11
-rw-r--r--coreutils/split.c6
-rw-r--r--editors/awk.c12
-rw-r--r--findutils/grep.c2
-rw-r--r--include/platform.h2
-rw-r--r--libbb/Kbuild1
-rw-r--r--miscutils/flash_eraseall.c47
-rw-r--r--networking/ping.c36
-rw-r--r--scripts/kconfig/Makefile23
-rw-r--r--shell/ash.c773
-rwxr-xr-xtestsuite/awk.tests17
-rwxr-xr-xtestsuite/grep.tests5
-rw-r--r--util-linux/mount.c24
13 files changed, 530 insertions, 429 deletions
diff --git a/Makefile b/Makefile
index 3ab0524dc..7529cd8d8 100644
--- a/Makefile
+++ b/Makefile
@@ -358,6 +358,15 @@ scripts_basic:
358# To avoid any implicit rule to kick in, define an empty command. 358# To avoid any implicit rule to kick in, define an empty command.
359scripts/basic/%: scripts_basic ; 359scripts/basic/%: scripts_basic ;
360 360
361# bbox: we have helpers in applets/
362# we depend on scripts_basic, since scripts/basic/fixdep
363# must be built before any other host prog
364PHONY += applets_dir
365applets_dir: scripts_basic
366 $(Q)$(MAKE) $(build)=applets
367
368applets/%: applets_dir ;
369
361PHONY += outputmakefile 370PHONY += outputmakefile
362# outputmakefile generates a Makefile in the output directory, if using a 371# outputmakefile generates a Makefile in the output directory, if using a
363# separate output directory. This allows convenient use of make in the 372# separate output directory. This allows convenient use of make in the
@@ -797,7 +806,7 @@ ifneq ($(KBUILD_MODULES),)
797 $(Q)rm -f $(MODVERDIR)/* 806 $(Q)rm -f $(MODVERDIR)/*
798endif 807endif
799 808
800archprepare: prepare1 scripts_basic 809archprepare: prepare1 scripts_basic applets_dir
801 810
802prepare0: archprepare FORCE 811prepare0: archprepare FORCE
803 $(Q)$(MAKE) $(build)=. 812 $(Q)$(MAKE) $(build)=.
diff --git a/coreutils/split.c b/coreutils/split.c
index f1ec64be0..55927a491 100644
--- a/coreutils/split.c
+++ b/coreutils/split.c
@@ -79,9 +79,13 @@ int split_main(int argc UNUSED_PARAM, char **argv)
79 79
80 argv += optind; 80 argv += optind;
81 if (argv[0]) { 81 if (argv[0]) {
82 int fd;
82 if (argv[1]) 83 if (argv[1])
83 sfx = argv[1]; 84 sfx = argv[1];
84 xmove_fd(xopen(argv[0], O_RDONLY), 0); 85 fd = open_or_warn_stdin(argv[0]);
86 if (fd == -1)
87 return EXIT_FAILURE;
88 xmove_fd(fd, STDIN_FILENO);
85 } else { 89 } else {
86 argv[0] = (char *) bb_msg_standard_input; 90 argv[0] = (char *) bb_msg_standard_input;
87 } 91 }
diff --git a/editors/awk.c b/editors/awk.c
index cef73342c..a8c5476a7 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -2393,12 +2393,14 @@ static var *evaluate(node *op, var *res)
2393 2393
2394 case XC( OC_MOVE ): 2394 case XC( OC_MOVE ):
2395 /* if source is a temporary string, jusk relink it to dest */ 2395 /* if source is a temporary string, jusk relink it to dest */
2396 if (R.v == v1+1 && R.v->string) { 2396//Disabled: if R.v is numeric but happens to have cached R.v->string,
2397 res = setvar_p(L.v, R.v->string); 2397//then L.v ends up being a string, which is wrong
2398 R.v->string = NULL; 2398// if (R.v == v1+1 && R.v->string) {
2399 } else { 2399// res = setvar_p(L.v, R.v->string);
2400// R.v->string = NULL;
2401// } else {
2400 res = copyvar(L.v, R.v); 2402 res = copyvar(L.v, R.v);
2401 } 2403// }
2402 break; 2404 break;
2403 2405
2404 case XC( OC_TERNARY ): 2406 case XC( OC_TERNARY ):
diff --git a/findutils/grep.c b/findutils/grep.c
index 776a629be..dc26b5f07 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -377,6 +377,8 @@ static int grep_file(FILE *file)
377 print_line(line + gl->matched_range.rm_so, 377 print_line(line + gl->matched_range.rm_so,
378 end - gl->matched_range.rm_so, 378 end - gl->matched_range.rm_so,
379 linenum, ':'); 379 linenum, ':');
380 if (old == '\0')
381 break;
380 line[end] = old; 382 line[end] = old;
381#if !ENABLE_EXTRA_COMPAT 383#if !ENABLE_EXTRA_COMPAT
382 if (regexec(&gl->compiled_regex, line + end, 384 if (regexec(&gl->compiled_regex, line + end,
diff --git a/include/platform.h b/include/platform.h
index 7c88d1ba6..b3847f70d 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -174,12 +174,14 @@ char *strchrnul(const char *s, int c);
174 * a lvalue. This makes it more likely to not swap them by mistake 174 * a lvalue. This makes it more likely to not swap them by mistake
175 */ 175 */
176#if defined(i386) || defined(__x86_64__) 176#if defined(i386) || defined(__x86_64__)
177# define move_from_unaligned_int(v, intp) ((v) = *(int*)(intp))
177# define move_from_unaligned16(v, u16p) ((v) = *(uint16_t*)(u16p)) 178# define move_from_unaligned16(v, u16p) ((v) = *(uint16_t*)(u16p))
178# define move_from_unaligned32(v, u32p) ((v) = *(uint32_t*)(u32p)) 179# define move_from_unaligned32(v, u32p) ((v) = *(uint32_t*)(u32p))
179# define move_to_unaligned32(u32p, v) (*(uint32_t*)(u32p) = (v)) 180# define move_to_unaligned32(u32p, v) (*(uint32_t*)(u32p) = (v))
180/* #elif ... - add your favorite arch today! */ 181/* #elif ... - add your favorite arch today! */
181#else 182#else
182/* performs reasonably well (gcc usually inlines memcpy here) */ 183/* performs reasonably well (gcc usually inlines memcpy here) */
184# define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int)))
183# define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2)) 185# define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2))
184# define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4)) 186# define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4))
185# define move_to_unaligned32(u32p, v) do { \ 187# define move_to_unaligned32(u32p, v) do { \
diff --git a/libbb/Kbuild b/libbb/Kbuild
index 8c7a189b4..8558e117a 100644
--- a/libbb/Kbuild
+++ b/libbb/Kbuild
@@ -143,6 +143,7 @@ lib-$(CONFIG_FEATURE_HTTPD_AUTH_MD5) += pw_encrypt.o
143lib-$(CONFIG_DF) += find_mount_point.o 143lib-$(CONFIG_DF) += find_mount_point.o
144lib-$(CONFIG_MKFS_MINIX) += find_mount_point.o 144lib-$(CONFIG_MKFS_MINIX) += find_mount_point.o
145lib-$(CONFIG_FSCK_MINIX) += find_mount_point.o 145lib-$(CONFIG_FSCK_MINIX) += find_mount_point.o
146lib-$(CONFIG_MOUNT) += find_mount_point.o
146 147
147lib-$(CONFIG_HWCLOCK) += rtc.o 148lib-$(CONFIG_HWCLOCK) += rtc.o
148lib-$(CONFIG_RTCWAKE) += rtc.o 149lib-$(CONFIG_RTCWAKE) += rtc.o
diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c
index 4f3e94dc1..faed9c345 100644
--- a/miscutils/flash_eraseall.c
+++ b/miscutils/flash_eraseall.c
@@ -12,22 +12,35 @@
12 12
13#include "libbb.h" 13#include "libbb.h"
14#include <mtd/mtd-user.h> 14#include <mtd/mtd-user.h>
15#include <mtd/jffs2-user.h> 15#include <linux/jffs2.h>
16 16
17#define OPTION_J (1 << 0) 17#define OPTION_J (1 << 0)
18#define OPTION_Q (1 << 1) 18#define OPTION_Q (1 << 1)
19#define IS_NAND (1 << 2) 19#define IS_NAND (1 << 2)
20#define BBTEST (1 << 3) 20#define BBTEST (1 << 3)
21 21
22struct globals { 22/* mtd/jffs2-user.h used to have this atrocity:
23 /* This is used in the cpu_to_je/je_to_cpu macros in jffs2_user.h */ 23extern int target_endian;
24 int tgt_endian; 24
25}; 25#define t16(x) ({ __u16 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); })
26#define G (*(struct globals*)&bb_common_bufsiz1) 26#define t32(x) ({ __u32 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); })
27#define target_endian (G.tgt_endian) 27
28#define INIT_G() do { \ 28#define cpu_to_je16(x) ((jint16_t){t16(x)})
29 target_endian = __BYTE_ORDER; \ 29#define cpu_to_je32(x) ((jint32_t){t32(x)})
30} while (0) 30#define cpu_to_jemode(x) ((jmode_t){t32(x)})
31
32#define je16_to_cpu(x) (t16((x).v16))
33#define je32_to_cpu(x) (t32((x).v32))
34#define jemode_to_cpu(x) (t32((x).m))
35
36but mtd/jffs2-user.h is gone now (at least 2.6.31.6 does not have it anymore)
37*/
38
39/* We always use native endianness */
40#undef cpu_to_je16
41#undef cpu_to_je32
42#define cpu_to_je16(v) ((jint16_t){(v)})
43#define cpu_to_je32(v) ((jint32_t){(v)})
31 44
32static uint32_t crc32(uint32_t val, const void *ss, int len, 45static uint32_t crc32(uint32_t val, const void *ss, int len,
33 uint32_t *crc32_table) 46 uint32_t *crc32_table)
@@ -40,9 +53,11 @@ static uint32_t crc32(uint32_t val, const void *ss, int len,
40 53
41static void show_progress(mtd_info_t *meminfo, erase_info_t *erase) 54static void show_progress(mtd_info_t *meminfo, erase_info_t *erase)
42{ 55{
43 printf("\rErasing %d Kibyte @ %x -- %2llu %% complete.", 56 printf("\rErasing %u Kibyte @ %x - %2u%% complete.",
44 (unsigned)meminfo->erasesize / 1024, erase->start, 57 (unsigned)meminfo->erasesize / 1024,
45 (unsigned long long) erase->start * 100 / meminfo->size); 58 erase->start,
59 (unsigned) ((unsigned long long) erase->start * 100 / meminfo->size)
60 );
46 fflush(stdout); 61 fflush(stdout);
47} 62}
48 63
@@ -57,17 +72,15 @@ int flash_eraseall_main(int argc UNUSED_PARAM, char **argv)
57 unsigned int flags; 72 unsigned int flags;
58 char *mtd_name; 73 char *mtd_name;
59 74
60 INIT_G();
61 opt_complementary = "=1"; 75 opt_complementary = "=1";
62 flags = BBTEST | getopt32(argv, "jq"); 76 flags = BBTEST | getopt32(argv, "jq");
63 77
64 mtd_name = argv[optind]; 78 mtd_name = argv[optind];
65 xstat(mtd_name, &st); 79 fd = xopen(mtd_name, O_RDWR);
80 fstat(fd, &st);
66 if (!S_ISCHR(st.st_mode)) 81 if (!S_ISCHR(st.st_mode))
67 bb_error_msg_and_die("%s: not a char device", mtd_name); 82 bb_error_msg_and_die("%s: not a char device", mtd_name);
68 83
69 fd = xopen(mtd_name, O_RDWR);
70
71 xioctl(fd, MEMGETINFO, &meminfo); 84 xioctl(fd, MEMGETINFO, &meminfo);
72 erase.length = meminfo.erasesize; 85 erase.length = meminfo.erasesize;
73 if (meminfo.type == MTD_NANDFLASH) 86 if (meminfo.type == MTD_NANDFLASH)
diff --git a/networking/ping.c b/networking/ping.c
index 71b2a4be8..0d89cb6f6 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -173,13 +173,14 @@ static void ping6(len_and_sockaddr *lsa)
173} 173}
174#endif 174#endif
175 175
176int ping_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 176#if !ENABLE_PING6
177int ping_main(int argc UNUSED_PARAM, char **argv) 177# define common_ping_main(af, argv) common_ping_main(argv)
178#endif
179static int common_ping_main(sa_family_t af, char **argv)
178{ 180{
179 len_and_sockaddr *lsa; 181 len_and_sockaddr *lsa;
180#if ENABLE_PING6
181 sa_family_t af = AF_UNSPEC;
182 182
183#if ENABLE_PING6
183 while ((++argv)[0] && argv[0][0] == '-') { 184 while ((++argv)[0] && argv[0][0] == '-') {
184 if (argv[0][1] == '4') { 185 if (argv[0][1] == '4') {
185 af = AF_INET; 186 af = AF_INET;
@@ -689,7 +690,8 @@ static void ping6(len_and_sockaddr *lsa)
689 /* don't check len - we trust the kernel: */ 690 /* don't check len - we trust the kernel: */
690 /* && mp->cmsg_len >= CMSG_LEN(sizeof(int)) */ 691 /* && mp->cmsg_len >= CMSG_LEN(sizeof(int)) */
691 ) { 692 ) {
692 hoplimit = *(int*)CMSG_DATA(mp); 693 /*hoplimit = *(int*)CMSG_DATA(mp); - unaligned access */
694 move_from_unaligned_int(hoplimit, CMSG_DATA(mp));
693 } 695 }
694 } 696 }
695 unpack6(packet, c, /*&from,*/ hoplimit); 697 unpack6(packet, c, /*&from,*/ hoplimit);
@@ -716,18 +718,16 @@ static void ping(len_and_sockaddr *lsa)
716 ping4(lsa); 718 ping4(lsa);
717} 719}
718 720
719int ping_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 721static int common_ping_main(int opt, char **argv)
720int ping_main(int argc UNUSED_PARAM, char **argv)
721{ 722{
722 len_and_sockaddr *lsa; 723 len_and_sockaddr *lsa;
723 char *str_s; 724 char *str_s;
724 int opt;
725 725
726 INIT_G(); 726 INIT_G();
727 727
728 /* exactly one argument needed; -v and -q don't mix; -c NUM, -w NUM, -W NUM */ 728 /* exactly one argument needed; -v and -q don't mix; -c NUM, -w NUM, -W NUM */
729 opt_complementary = "=1:q--v:v--q:c+:w+:W+"; 729 opt_complementary = "=1:q--v:v--q:c+:w+:W+";
730 opt = getopt32(argv, OPT_STRING, &pingcount, &str_s, &deadline, &timeout, &str_I); 730 opt |= getopt32(argv, OPT_STRING, &pingcount, &str_s, &deadline, &timeout, &str_I);
731 if (opt & OPT_s) 731 if (opt & OPT_s)
732 datalen = xatou16(str_s); // -s 732 datalen = xatou16(str_s); // -s
733 if (opt & OPT_I) { // -I 733 if (opt & OPT_I) { // -I
@@ -765,13 +765,25 @@ int ping_main(int argc UNUSED_PARAM, char **argv)
765#endif /* FEATURE_FANCY_PING */ 765#endif /* FEATURE_FANCY_PING */
766 766
767 767
768int ping_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
769int ping_main(int argc UNUSED_PARAM, char **argv)
770{
771#if !ENABLE_FEATURE_FANCY_PING
772 return common_ping_main(AF_UNSPEC, argv);
773#else
774 return common_ping_main(0, argv);
775#endif
776}
777
768#if ENABLE_PING6 778#if ENABLE_PING6
769int ping6_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 779int ping6_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
770int ping6_main(int argc UNUSED_PARAM, char **argv) 780int ping6_main(int argc UNUSED_PARAM, char **argv)
771{ 781{
772 argv[0] = (char*)"-6"; 782# if !ENABLE_FEATURE_FANCY_PING
773 return ping_main(0 /* argc+1 - but it's unused anyway */, 783 return common_ping_main(AF_INET6, argv);
774 argv - 1); 784# else
785 return common_ping_main(OPT_IPV6, argv);
786# endif
775} 787}
776#endif 788#endif
777 789
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index f56863f7c..b5708e2e4 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -17,11 +17,28 @@ menuconfig: $(obj)/mconf
17config: $(obj)/conf 17config: $(obj)/conf
18 $< Config.in 18 $< Config.in
19 19
20# Mtime granularity problem.
21# It was observed that these commands:
22# make allnoconfig; sed -i -e '/CONFIG_TRUE/s/.*/CONFIG_TRUE=y/' .config; make
23# sometimes produce busybox with "true" applet still disabled.
24# This is caused by .config updated by sed having mtime which is still
25# equal to (not bigger than) include/autoconf.h's mtime,
26# and thus 2nd make does not regenerate include/autoconf.h.
27# Waiting for 1 second after non-interactive "make XXXXconfig"
28# prevents this from happening.
29#
30# We'd like to detect whether filesystem we are on has coarse mtimes,
31# but can't do it yet, bbox ls hasn't got --full-time.
32#MTIME_IS_COARSE:=@ls --full-time -ld | grep -F .000 >/dev/null
33MTIME_IS_COARSE:=@true
34
20oldconfig: $(obj)/conf 35oldconfig: $(obj)/conf
21 $< -o Config.in 36 $< -o Config.in
37 $(MTIME_IS_COARSE) && sleep 1
22 38
23silentoldconfig: $(obj)/conf 39silentoldconfig: $(obj)/conf
24 $< -s Config.in 40 $< -s Config.in
41 $(MTIME_IS_COARSE) && sleep 1
25 42
26update-po-config: $(obj)/kxgettext 43update-po-config: $(obj)/kxgettext
27 xgettext --default-domain=linux \ 44 xgettext --default-domain=linux \
@@ -46,15 +63,19 @@ PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
46 63
47randconfig: $(obj)/conf 64randconfig: $(obj)/conf
48 $< -r Config.in 65 $< -r Config.in
66 $(MTIME_IS_COARSE) && sleep 1
49 67
50allyesconfig: $(obj)/conf 68allyesconfig: $(obj)/conf
51 $< -y Config.in 69 $< -y Config.in
70 $(MTIME_IS_COARSE) && sleep 1
52 71
53allnoconfig: $(obj)/conf 72allnoconfig: $(obj)/conf
54 $< -n Config.in 73 $< -n Config.in
74 $(MTIME_IS_COARSE) && sleep 1
55 75
56allmodconfig: $(obj)/conf 76allmodconfig: $(obj)/conf
57 $< -m Config.in 77 $< -m Config.in
78 $(MTIME_IS_COARSE) && sleep 1
58 79
59defconfig: $(obj)/conf 80defconfig: $(obj)/conf
60ifeq ($(KBUILD_DEFCONFIG),) 81ifeq ($(KBUILD_DEFCONFIG),)
@@ -63,9 +84,11 @@ else
63 @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)' 84 @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)'
64 $(Q)$< -D $(KBUILD_DEFCONFIG) Config.in 85 $(Q)$< -D $(KBUILD_DEFCONFIG) Config.in
65endif 86endif
87 $(MTIME_IS_COARSE) && sleep 1
66 88
67%_defconfig: $(obj)/conf 89%_defconfig: $(obj)/conf
68 $(Q)$< -D $@ Config.in 90 $(Q)$< -D $@ Config.in
91 $(MTIME_IS_COARSE) && sleep 1
69 92
70# Help text used by make help 93# Help text used by make help
71help: 94help:
diff --git a/shell/ash.c b/shell/ash.c
index a9529f86b..3ca7fa376 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -258,9 +258,6 @@ static void trace_vprintf(const char *fmt, va_list va);
258/* ============ Utility functions */ 258/* ============ Utility functions */
259#define xbarrier() do { __asm__ __volatile__ ("": : :"memory"); } while (0) 259#define xbarrier() do { __asm__ __volatile__ ("": : :"memory"); } while (0)
260 260
261/* C99 says: "char" declaration may be signed or unsigned by default */
262#define signed_char2int(sc) ((int)(signed char)(sc))
263
264static int isdigit_str9(const char *str) 261static int isdigit_str9(const char *str)
265{ 262{
266 int maxlen = 9 + 1; /* max 9 digits: 999999999 */ 263 int maxlen = 9 + 1; /* max 9 digits: 999999999 */
@@ -718,17 +715,17 @@ trace_puts_quoted(char *s)
718 return; 715 return;
719 putc('"', tracefile); 716 putc('"', tracefile);
720 for (p = s; *p; p++) { 717 for (p = s; *p; p++) {
721 switch (*p) { 718 switch ((unsigned char)*p) {
722 case '\n': c = 'n'; goto backslash; 719 case '\n': c = 'n'; goto backslash;
723 case '\t': c = 't'; goto backslash; 720 case '\t': c = 't'; goto backslash;
724 case '\r': c = 'r'; goto backslash; 721 case '\r': c = 'r'; goto backslash;
725 case '"': c = '"'; goto backslash; 722 case '\"': c = '\"'; goto backslash;
726 case '\\': c = '\\'; goto backslash; 723 case '\\': c = '\\'; goto backslash;
727 case CTLESC: c = 'e'; goto backslash; 724 case CTLESC: c = 'e'; goto backslash;
728 case CTLVAR: c = 'v'; goto backslash; 725 case CTLVAR: c = 'v'; goto backslash;
729 case CTLVAR+CTLQUOTE: c = 'V'; goto backslash; 726 case CTLVAR+CTLQUOTE: c = 'V'; goto backslash;
730 case CTLBACKQ: c = 'q'; goto backslash; 727 case CTLBACKQ: c = 'q'; goto backslash;
731 case CTLBACKQ+CTLQUOTE: c = 'Q'; goto backslash; 728 case CTLBACKQ+CTLQUOTE: c = 'Q'; goto backslash;
732 backslash: 729 backslash:
733 putc('\\', tracefile); 730 putc('\\', tracefile);
734 putc(c, tracefile); 731 putc(c, tracefile);
@@ -738,8 +735,8 @@ trace_puts_quoted(char *s)
738 putc(*p, tracefile); 735 putc(*p, tracefile);
739 else { 736 else {
740 putc('\\', tracefile); 737 putc('\\', tracefile);
741 putc(*p >> 6 & 03, tracefile); 738 putc((*p >> 6) & 03, tracefile);
742 putc(*p >> 3 & 07, tracefile); 739 putc((*p >> 3) & 07, tracefile);
743 putc(*p & 07, tracefile); 740 putc(*p & 07, tracefile);
744 } 741 }
745 break; 742 break;
@@ -823,7 +820,7 @@ sharg(union node *arg, FILE *fp)
823{ 820{
824 char *p; 821 char *p;
825 struct nodelist *bqlist; 822 struct nodelist *bqlist;
826 int subtype; 823 unsigned char subtype;
827 824
828 if (arg->type != NARG) { 825 if (arg->type != NARG) {
829 out1fmt("<node type %d>\n", arg->type); 826 out1fmt("<node type %d>\n", arg->type);
@@ -831,7 +828,7 @@ sharg(union node *arg, FILE *fp)
831 } 828 }
832 bqlist = arg->narg.backquote; 829 bqlist = arg->narg.backquote;
833 for (p = arg->narg.text; *p; p++) { 830 for (p = arg->narg.text; *p; p++) {
834 switch (*p) { 831 switch ((unsigned char)*p) {
835 case CTLESC: 832 case CTLESC:
836 putc(*++p, fp); 833 putc(*++p, fp);
837 break; 834 break;
@@ -1581,21 +1578,21 @@ single_quote(const char *s)
1581 1578
1582 STADJUST(q - p, p); 1579 STADJUST(q - p, p);
1583 1580
1584 len = strspn(s, "'"); 1581 if (*s != '\'')
1585 if (!len)
1586 break; 1582 break;
1583 len = 0;
1584 do len++; while (*++s == '\'');
1587 1585
1588 q = p = makestrspace(len + 3, p); 1586 q = p = makestrspace(len + 3, p);
1589 1587
1590 *q++ = '"'; 1588 *q++ = '"';
1591 q = (char *)memcpy(q, s, len) + len; 1589 q = (char *)memcpy(q, s - len, len) + len;
1592 *q++ = '"'; 1590 *q++ = '"';
1593 s += len;
1594 1591
1595 STADJUST(q - p, p); 1592 STADJUST(q - p, p);
1596 } while (*s); 1593 } while (*s);
1597 1594
1598 USTPUTC(0, p); 1595 USTPUTC('\0', p);
1599 1596
1600 return stackblock(); 1597 return stackblock();
1601} 1598}
@@ -2603,14 +2600,10 @@ pwdcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
2603#define CIGN 14 /* character should be ignored */ 2600#define CIGN 14 /* character should be ignored */
2604 2601
2605#if ENABLE_ASH_ALIAS 2602#if ENABLE_ASH_ALIAS
2606#define SYNBASE 130 2603# define PEOA 256
2607#define PEOF -130 2604# define PEOF 257
2608#define PEOA -129
2609#define PEOA_OR_PEOF PEOA
2610#else 2605#else
2611#define SYNBASE 129 2606# define PEOF 256
2612#define PEOF -129
2613#define PEOA_OR_PEOF PEOF
2614#endif 2607#endif
2615 2608
2616/* number syntax index */ 2609/* number syntax index */
@@ -2621,14 +2614,14 @@ pwdcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
2621#define PSSYNTAX 4 /* prompt */ 2614#define PSSYNTAX 4 /* prompt */
2622 2615
2623#if ENABLE_ASH_OPTIMIZE_FOR_SIZE 2616#if ENABLE_ASH_OPTIMIZE_FOR_SIZE
2624#define USE_SIT_FUNCTION 2617# define USE_SIT_FUNCTION
2625#endif 2618#endif
2626 2619
2627#if ENABLE_SH_MATH_SUPPORT 2620#if ENABLE_SH_MATH_SUPPORT
2628static const char S_I_T[][4] = { 2621static const uint8_t S_I_T[][4] = {
2629#if ENABLE_ASH_ALIAS 2622# if ENABLE_ASH_ALIAS
2630 { CSPCL, CIGN, CIGN, CIGN }, /* 0, PEOA */ 2623 { CSPCL, CIGN, CIGN, CIGN }, /* 0, PEOA */
2631#endif 2624# endif
2632 { CSPCL, CWORD, CWORD, CWORD }, /* 1, ' ' */ 2625 { CSPCL, CWORD, CWORD, CWORD }, /* 1, ' ' */
2633 { CNL, CNL, CNL, CNL }, /* 2, \n */ 2626 { CNL, CNL, CNL, CNL }, /* 2, \n */
2634 { CWORD, CCTL, CCTL, CWORD }, /* 3, !*-/:=?[]~ */ 2627 { CWORD, CCTL, CCTL, CWORD }, /* 3, !*-/:=?[]~ */
@@ -2640,17 +2633,17 @@ static const char S_I_T[][4] = {
2640 { CBACK, CBACK, CCTL, CBACK }, /* 9, \ */ 2633 { CBACK, CBACK, CCTL, CBACK }, /* 9, \ */
2641 { CBQUOTE, CBQUOTE, CWORD, CBQUOTE }, /* 10, ` */ 2634 { CBQUOTE, CBQUOTE, CWORD, CBQUOTE }, /* 10, ` */
2642 { CENDVAR, CENDVAR, CWORD, CENDVAR }, /* 11, } */ 2635 { CENDVAR, CENDVAR, CWORD, CENDVAR }, /* 11, } */
2643#ifndef USE_SIT_FUNCTION 2636# ifndef USE_SIT_FUNCTION
2644 { CENDFILE, CENDFILE, CENDFILE, CENDFILE }, /* 12, PEOF */ 2637 { CENDFILE, CENDFILE, CENDFILE, CENDFILE }, /* 12, PEOF */
2645 { CWORD, CWORD, CWORD, CWORD }, /* 13, 0-9A-Za-z */ 2638 { CWORD, CWORD, CWORD, CWORD }, /* 13, 0-9A-Za-z */
2646 { CCTL, CCTL, CCTL, CCTL } /* 14, CTLESC ... */ 2639 { CCTL, CCTL, CCTL, CCTL } /* 14, CTLESC ... */
2647#endif 2640# endif
2648}; 2641};
2649#else 2642#else
2650static const char S_I_T[][3] = { 2643static const uint8_t S_I_T[][3] = {
2651#if ENABLE_ASH_ALIAS 2644# if ENABLE_ASH_ALIAS
2652 { CSPCL, CIGN, CIGN }, /* 0, PEOA */ 2645 { CSPCL, CIGN, CIGN }, /* 0, PEOA */
2653#endif 2646# endif
2654 { CSPCL, CWORD, CWORD }, /* 1, ' ' */ 2647 { CSPCL, CWORD, CWORD }, /* 1, ' ' */
2655 { CNL, CNL, CNL }, /* 2, \n */ 2648 { CNL, CNL, CNL }, /* 2, \n */
2656 { CWORD, CCTL, CCTL }, /* 3, !*-/:=?[]~ */ 2649 { CWORD, CCTL, CCTL }, /* 3, !*-/:=?[]~ */
@@ -2662,46 +2655,50 @@ static const char S_I_T[][3] = {
2662 { CBACK, CBACK, CCTL }, /* 9, \ */ 2655 { CBACK, CBACK, CCTL }, /* 9, \ */
2663 { CBQUOTE, CBQUOTE, CWORD }, /* 10, ` */ 2656 { CBQUOTE, CBQUOTE, CWORD }, /* 10, ` */
2664 { CENDVAR, CENDVAR, CWORD }, /* 11, } */ 2657 { CENDVAR, CENDVAR, CWORD }, /* 11, } */
2665#ifndef USE_SIT_FUNCTION 2658# ifndef USE_SIT_FUNCTION
2666 { CENDFILE, CENDFILE, CENDFILE }, /* 12, PEOF */ 2659 { CENDFILE, CENDFILE, CENDFILE }, /* 12, PEOF */
2667 { CWORD, CWORD, CWORD }, /* 13, 0-9A-Za-z */ 2660 { CWORD, CWORD, CWORD }, /* 13, 0-9A-Za-z */
2668 { CCTL, CCTL, CCTL } /* 14, CTLESC ... */ 2661 { CCTL, CCTL, CCTL } /* 14, CTLESC ... */
2669#endif 2662# endif
2670}; 2663};
2671#endif /* SH_MATH_SUPPORT */ 2664#endif /* SH_MATH_SUPPORT */
2672 2665
2666/* c in SIT(c, syntax) must be an *unsigned char* or PEOA or PEOF,
2667 * caller must ensure proper cast on it if c is *char_ptr!
2668 */
2669
2673#ifdef USE_SIT_FUNCTION 2670#ifdef USE_SIT_FUNCTION
2674 2671
2675static int 2672static int
2676SIT(int c, int syntax) 2673SIT(int c, int syntax)
2677{ 2674{
2678 static const char spec_symbls[] ALIGN1 = "\t\n !\"$&'()*-/:;<=>?[\\]`|}~"; 2675 static const char spec_symbls[] ALIGN1 = "\t\n !\"$&'()*-/:;<=>?[\\]`|}~";
2679#if ENABLE_ASH_ALIAS 2676# if ENABLE_ASH_ALIAS
2680 static const char syntax_index_table[] ALIGN1 = { 2677 static const uint8_t syntax_index_table[] ALIGN1 = {
2681 1, 2, 1, 3, 4, 5, 1, 6, /* "\t\n !\"$&'" */ 2678 1, 2, 1, 3, 4, 5, 1, 6, /* "\t\n !\"$&'" */
2682 7, 8, 3, 3, 3, 3, 1, 1, /* "()*-/:;<" */ 2679 7, 8, 3, 3, 3, 3, 1, 1, /* "()*-/:;<" */
2683 3, 1, 3, 3, 9, 3, 10, 1, /* "=>?[\\]`|" */ 2680 3, 1, 3, 3, 9, 3, 10, 1, /* "=>?[\\]`|" */
2684 11, 3 /* "}~" */ 2681 11, 3 /* "}~" */
2685 }; 2682 };
2686#else 2683# else
2687 static const char syntax_index_table[] ALIGN1 = { 2684 static const uint8_t syntax_index_table[] ALIGN1 = {
2688 0, 1, 0, 2, 3, 4, 0, 5, /* "\t\n !\"$&'" */ 2685 0, 1, 0, 2, 3, 4, 0, 5, /* "\t\n !\"$&'" */
2689 6, 7, 2, 2, 2, 2, 0, 0, /* "()*-/:;<" */ 2686 6, 7, 2, 2, 2, 2, 0, 0, /* "()*-/:;<" */
2690 2, 0, 2, 2, 8, 2, 9, 0, /* "=>?[\\]`|" */ 2687 2, 0, 2, 2, 8, 2, 9, 0, /* "=>?[\\]`|" */
2691 10, 2 /* "}~" */ 2688 10, 2 /* "}~" */
2692 }; 2689 };
2693#endif 2690# endif
2694 const char *s; 2691 const char *s;
2695 int indx; 2692 int indx;
2696 2693
2697 if (c == PEOF) { /* 2^8+2 */ 2694 if (c == PEOF) { /* 2^8+2 */
2698 return CENDFILE; 2695 return CENDFILE;
2699 } 2696 }
2700#if ENABLE_ASH_ALIAS 2697# if ENABLE_ASH_ALIAS
2701 if (c == PEOA) { /* 2^8+1 */ 2698 if (c == PEOA) { /* 2^8+1 */
2702 indx = 0; 2699 indx = 0;
2703 } else 2700 } else
2704#endif 2701# endif
2705 { 2702 {
2706 if ((unsigned char)c >= CTLESC 2703 if ((unsigned char)c >= CTLESC
2707 && (unsigned char)c <= CTLQUOTEMARK 2704 && (unsigned char)c <= CTLQUOTEMARK
@@ -2719,304 +2716,304 @@ SIT(int c, int syntax)
2719 2716
2720#else /* !USE_SIT_FUNCTION */ 2717#else /* !USE_SIT_FUNCTION */
2721 2718
2722#if ENABLE_ASH_ALIAS 2719# if ENABLE_ASH_ALIAS
2723#define CSPCL_CIGN_CIGN_CIGN 0 2720# define CSPCL_CIGN_CIGN_CIGN 0
2724#define CSPCL_CWORD_CWORD_CWORD 1 2721# define CSPCL_CWORD_CWORD_CWORD 1
2725#define CNL_CNL_CNL_CNL 2 2722# define CNL_CNL_CNL_CNL 2
2726#define CWORD_CCTL_CCTL_CWORD 3 2723# define CWORD_CCTL_CCTL_CWORD 3
2727#define CDQUOTE_CENDQUOTE_CWORD_CWORD 4 2724# define CDQUOTE_CENDQUOTE_CWORD_CWORD 4
2728#define CVAR_CVAR_CWORD_CVAR 5 2725# define CVAR_CVAR_CWORD_CVAR 5
2729#define CSQUOTE_CWORD_CENDQUOTE_CWORD 6 2726# define CSQUOTE_CWORD_CENDQUOTE_CWORD 6
2730#define CSPCL_CWORD_CWORD_CLP 7 2727# define CSPCL_CWORD_CWORD_CLP 7
2731#define CSPCL_CWORD_CWORD_CRP 8 2728# define CSPCL_CWORD_CWORD_CRP 8
2732#define CBACK_CBACK_CCTL_CBACK 9 2729# define CBACK_CBACK_CCTL_CBACK 9
2733#define CBQUOTE_CBQUOTE_CWORD_CBQUOTE 10 2730# define CBQUOTE_CBQUOTE_CWORD_CBQUOTE 10
2734#define CENDVAR_CENDVAR_CWORD_CENDVAR 11 2731# define CENDVAR_CENDVAR_CWORD_CENDVAR 11
2735#define CENDFILE_CENDFILE_CENDFILE_CENDFILE 12 2732# define CENDFILE_CENDFILE_CENDFILE_CENDFILE 12
2736#define CWORD_CWORD_CWORD_CWORD 13 2733# define CWORD_CWORD_CWORD_CWORD 13
2737#define CCTL_CCTL_CCTL_CCTL 14 2734# define CCTL_CCTL_CCTL_CCTL 14
2738#else 2735# else
2739#define CSPCL_CWORD_CWORD_CWORD 0 2736# define CSPCL_CWORD_CWORD_CWORD 0
2740#define CNL_CNL_CNL_CNL 1 2737# define CNL_CNL_CNL_CNL 1
2741#define CWORD_CCTL_CCTL_CWORD 2 2738# define CWORD_CCTL_CCTL_CWORD 2
2742#define CDQUOTE_CENDQUOTE_CWORD_CWORD 3 2739# define CDQUOTE_CENDQUOTE_CWORD_CWORD 3
2743#define CVAR_CVAR_CWORD_CVAR 4 2740# define CVAR_CVAR_CWORD_CVAR 4
2744#define CSQUOTE_CWORD_CENDQUOTE_CWORD 5 2741# define CSQUOTE_CWORD_CENDQUOTE_CWORD 5
2745#define CSPCL_CWORD_CWORD_CLP 6 2742# define CSPCL_CWORD_CWORD_CLP 6
2746#define CSPCL_CWORD_CWORD_CRP 7 2743# define CSPCL_CWORD_CWORD_CRP 7
2747#define CBACK_CBACK_CCTL_CBACK 8 2744# define CBACK_CBACK_CCTL_CBACK 8
2748#define CBQUOTE_CBQUOTE_CWORD_CBQUOTE 9 2745# define CBQUOTE_CBQUOTE_CWORD_CBQUOTE 9
2749#define CENDVAR_CENDVAR_CWORD_CENDVAR 10 2746# define CENDVAR_CENDVAR_CWORD_CENDVAR 10
2750#define CENDFILE_CENDFILE_CENDFILE_CENDFILE 11 2747# define CENDFILE_CENDFILE_CENDFILE_CENDFILE 11
2751#define CWORD_CWORD_CWORD_CWORD 12 2748# define CWORD_CWORD_CWORD_CWORD 12
2752#define CCTL_CCTL_CCTL_CCTL 13 2749# define CCTL_CCTL_CCTL_CCTL 13
2753#endif 2750# endif
2754 2751
2755static const char syntax_index_table[258] = { 2752static const uint8_t syntax_index_table[258] = {
2756 /* BASESYNTAX_DQSYNTAX_SQSYNTAX_ARISYNTAX */ 2753 /* BASESYNTAX_DQSYNTAX_SQSYNTAX_ARISYNTAX */
2757 /* 0 PEOF */ CENDFILE_CENDFILE_CENDFILE_CENDFILE, 2754 /* 0 */ CWORD_CWORD_CWORD_CWORD,
2758#if ENABLE_ASH_ALIAS 2755 /* 1 */ CWORD_CWORD_CWORD_CWORD,
2759 /* 1 PEOA */ CSPCL_CIGN_CIGN_CIGN, 2756 /* 2 */ CWORD_CWORD_CWORD_CWORD,
2760#endif 2757 /* 3 */ CWORD_CWORD_CWORD_CWORD,
2761 /* 2 -128 0x80 */ CWORD_CWORD_CWORD_CWORD, 2758 /* 4 */ CWORD_CWORD_CWORD_CWORD,
2762 /* 3 -127 CTLESC */ CCTL_CCTL_CCTL_CCTL, 2759 /* 5 */ CWORD_CWORD_CWORD_CWORD,
2763 /* 4 -126 CTLVAR */ CCTL_CCTL_CCTL_CCTL, 2760 /* 6 */ CWORD_CWORD_CWORD_CWORD,
2764 /* 5 -125 CTLENDVAR */ CCTL_CCTL_CCTL_CCTL, 2761 /* 7 */ CWORD_CWORD_CWORD_CWORD,
2765 /* 6 -124 CTLBACKQ */ CCTL_CCTL_CCTL_CCTL, 2762 /* 8 */ CWORD_CWORD_CWORD_CWORD,
2766 /* 7 -123 CTLQUOTE */ CCTL_CCTL_CCTL_CCTL, 2763 /* 9 "\t" */ CSPCL_CWORD_CWORD_CWORD,
2767 /* 8 -122 CTLARI */ CCTL_CCTL_CCTL_CCTL, 2764 /* 10 "\n" */ CNL_CNL_CNL_CNL,
2768 /* 9 -121 CTLENDARI */ CCTL_CCTL_CCTL_CCTL, 2765 /* 11 */ CWORD_CWORD_CWORD_CWORD,
2769 /* 10 -120 CTLQUOTEMARK */ CCTL_CCTL_CCTL_CCTL, 2766 /* 12 */ CWORD_CWORD_CWORD_CWORD,
2770 /* 11 -119 */ CWORD_CWORD_CWORD_CWORD, 2767 /* 13 */ CWORD_CWORD_CWORD_CWORD,
2771 /* 12 -118 */ CWORD_CWORD_CWORD_CWORD, 2768 /* 14 */ CWORD_CWORD_CWORD_CWORD,
2772 /* 13 -117 */ CWORD_CWORD_CWORD_CWORD, 2769 /* 15 */ CWORD_CWORD_CWORD_CWORD,
2773 /* 14 -116 */ CWORD_CWORD_CWORD_CWORD, 2770 /* 16 */ CWORD_CWORD_CWORD_CWORD,
2774 /* 15 -115 */ CWORD_CWORD_CWORD_CWORD, 2771 /* 17 */ CWORD_CWORD_CWORD_CWORD,
2775 /* 16 -114 */ CWORD_CWORD_CWORD_CWORD, 2772 /* 18 */ CWORD_CWORD_CWORD_CWORD,
2776 /* 17 -113 */ CWORD_CWORD_CWORD_CWORD, 2773 /* 19 */ CWORD_CWORD_CWORD_CWORD,
2777 /* 18 -112 */ CWORD_CWORD_CWORD_CWORD, 2774 /* 20 */ CWORD_CWORD_CWORD_CWORD,
2778 /* 19 -111 */ CWORD_CWORD_CWORD_CWORD, 2775 /* 21 */ CWORD_CWORD_CWORD_CWORD,
2779 /* 20 -110 */ CWORD_CWORD_CWORD_CWORD, 2776 /* 22 */ CWORD_CWORD_CWORD_CWORD,
2780 /* 21 -109 */ CWORD_CWORD_CWORD_CWORD, 2777 /* 23 */ CWORD_CWORD_CWORD_CWORD,
2781 /* 22 -108 */ CWORD_CWORD_CWORD_CWORD, 2778 /* 24 */ CWORD_CWORD_CWORD_CWORD,
2782 /* 23 -107 */ CWORD_CWORD_CWORD_CWORD, 2779 /* 25 */ CWORD_CWORD_CWORD_CWORD,
2783 /* 24 -106 */ CWORD_CWORD_CWORD_CWORD, 2780 /* 26 */ CWORD_CWORD_CWORD_CWORD,
2784 /* 25 -105 */ CWORD_CWORD_CWORD_CWORD, 2781 /* 27 */ CWORD_CWORD_CWORD_CWORD,
2785 /* 26 -104 */ CWORD_CWORD_CWORD_CWORD, 2782 /* 28 */ CWORD_CWORD_CWORD_CWORD,
2786 /* 27 -103 */ CWORD_CWORD_CWORD_CWORD, 2783 /* 29 */ CWORD_CWORD_CWORD_CWORD,
2787 /* 28 -102 */ CWORD_CWORD_CWORD_CWORD, 2784 /* 30 */ CWORD_CWORD_CWORD_CWORD,
2788 /* 29 -101 */ CWORD_CWORD_CWORD_CWORD, 2785 /* 31 */ CWORD_CWORD_CWORD_CWORD,
2789 /* 30 -100 */ CWORD_CWORD_CWORD_CWORD, 2786 /* 32 " " */ CSPCL_CWORD_CWORD_CWORD,
2790 /* 31 -99 */ CWORD_CWORD_CWORD_CWORD, 2787 /* 33 "!" */ CWORD_CCTL_CCTL_CWORD,
2791 /* 32 -98 */ CWORD_CWORD_CWORD_CWORD, 2788 /* 34 """ */ CDQUOTE_CENDQUOTE_CWORD_CWORD,
2792 /* 33 -97 */ CWORD_CWORD_CWORD_CWORD, 2789 /* 35 "#" */ CWORD_CWORD_CWORD_CWORD,
2793 /* 34 -96 */ CWORD_CWORD_CWORD_CWORD, 2790 /* 36 "$" */ CVAR_CVAR_CWORD_CVAR,
2794 /* 35 -95 */ CWORD_CWORD_CWORD_CWORD, 2791 /* 37 "%" */ CWORD_CWORD_CWORD_CWORD,
2795 /* 36 -94 */ CWORD_CWORD_CWORD_CWORD, 2792 /* 38 "&" */ CSPCL_CWORD_CWORD_CWORD,
2796 /* 37 -93 */ CWORD_CWORD_CWORD_CWORD, 2793 /* 39 "'" */ CSQUOTE_CWORD_CENDQUOTE_CWORD,
2797 /* 38 -92 */ CWORD_CWORD_CWORD_CWORD, 2794 /* 40 "(" */ CSPCL_CWORD_CWORD_CLP,
2798 /* 39 -91 */ CWORD_CWORD_CWORD_CWORD, 2795 /* 41 ")" */ CSPCL_CWORD_CWORD_CRP,
2799 /* 40 -90 */ CWORD_CWORD_CWORD_CWORD, 2796 /* 42 "*" */ CWORD_CCTL_CCTL_CWORD,
2800 /* 41 -89 */ CWORD_CWORD_CWORD_CWORD, 2797 /* 43 "+" */ CWORD_CWORD_CWORD_CWORD,
2801 /* 42 -88 */ CWORD_CWORD_CWORD_CWORD, 2798 /* 44 "," */ CWORD_CWORD_CWORD_CWORD,
2802 /* 43 -87 */ CWORD_CWORD_CWORD_CWORD, 2799 /* 45 "-" */ CWORD_CCTL_CCTL_CWORD,
2803 /* 44 -86 */ CWORD_CWORD_CWORD_CWORD, 2800 /* 46 "." */ CWORD_CWORD_CWORD_CWORD,
2804 /* 45 -85 */ CWORD_CWORD_CWORD_CWORD, 2801 /* 47 "/" */ CWORD_CCTL_CCTL_CWORD,
2805 /* 46 -84 */ CWORD_CWORD_CWORD_CWORD, 2802 /* 48 "0" */ CWORD_CWORD_CWORD_CWORD,
2806 /* 47 -83 */ CWORD_CWORD_CWORD_CWORD, 2803 /* 49 "1" */ CWORD_CWORD_CWORD_CWORD,
2807 /* 48 -82 */ CWORD_CWORD_CWORD_CWORD, 2804 /* 50 "2" */ CWORD_CWORD_CWORD_CWORD,
2808 /* 49 -81 */ CWORD_CWORD_CWORD_CWORD, 2805 /* 51 "3" */ CWORD_CWORD_CWORD_CWORD,
2809 /* 50 -80 */ CWORD_CWORD_CWORD_CWORD, 2806 /* 52 "4" */ CWORD_CWORD_CWORD_CWORD,
2810 /* 51 -79 */ CWORD_CWORD_CWORD_CWORD, 2807 /* 53 "5" */ CWORD_CWORD_CWORD_CWORD,
2811 /* 52 -78 */ CWORD_CWORD_CWORD_CWORD, 2808 /* 54 "6" */ CWORD_CWORD_CWORD_CWORD,
2812 /* 53 -77 */ CWORD_CWORD_CWORD_CWORD, 2809 /* 55 "7" */ CWORD_CWORD_CWORD_CWORD,
2813 /* 54 -76 */ CWORD_CWORD_CWORD_CWORD, 2810 /* 56 "8" */ CWORD_CWORD_CWORD_CWORD,
2814 /* 55 -75 */ CWORD_CWORD_CWORD_CWORD, 2811 /* 57 "9" */ CWORD_CWORD_CWORD_CWORD,
2815 /* 56 -74 */ CWORD_CWORD_CWORD_CWORD, 2812 /* 58 ":" */ CWORD_CCTL_CCTL_CWORD,
2816 /* 57 -73 */ CWORD_CWORD_CWORD_CWORD, 2813 /* 59 ";" */ CSPCL_CWORD_CWORD_CWORD,
2817 /* 58 -72 */ CWORD_CWORD_CWORD_CWORD, 2814 /* 60 "<" */ CSPCL_CWORD_CWORD_CWORD,
2818 /* 59 -71 */ CWORD_CWORD_CWORD_CWORD, 2815 /* 61 "=" */ CWORD_CCTL_CCTL_CWORD,
2819 /* 60 -70 */ CWORD_CWORD_CWORD_CWORD, 2816 /* 62 ">" */ CSPCL_CWORD_CWORD_CWORD,
2820 /* 61 -69 */ CWORD_CWORD_CWORD_CWORD, 2817 /* 63 "?" */ CWORD_CCTL_CCTL_CWORD,
2821 /* 62 -68 */ CWORD_CWORD_CWORD_CWORD, 2818 /* 64 "@" */ CWORD_CWORD_CWORD_CWORD,
2822 /* 63 -67 */ CWORD_CWORD_CWORD_CWORD, 2819 /* 65 "A" */ CWORD_CWORD_CWORD_CWORD,
2823 /* 64 -66 */ CWORD_CWORD_CWORD_CWORD, 2820 /* 66 "B" */ CWORD_CWORD_CWORD_CWORD,
2824 /* 65 -65 */ CWORD_CWORD_CWORD_CWORD, 2821 /* 67 "C" */ CWORD_CWORD_CWORD_CWORD,
2825 /* 66 -64 */ CWORD_CWORD_CWORD_CWORD, 2822 /* 68 "D" */ CWORD_CWORD_CWORD_CWORD,
2826 /* 67 -63 */ CWORD_CWORD_CWORD_CWORD, 2823 /* 69 "E" */ CWORD_CWORD_CWORD_CWORD,
2827 /* 68 -62 */ CWORD_CWORD_CWORD_CWORD, 2824 /* 70 "F" */ CWORD_CWORD_CWORD_CWORD,
2828 /* 69 -61 */ CWORD_CWORD_CWORD_CWORD, 2825 /* 71 "G" */ CWORD_CWORD_CWORD_CWORD,
2829 /* 70 -60 */ CWORD_CWORD_CWORD_CWORD, 2826 /* 72 "H" */ CWORD_CWORD_CWORD_CWORD,
2830 /* 71 -59 */ CWORD_CWORD_CWORD_CWORD, 2827 /* 73 "I" */ CWORD_CWORD_CWORD_CWORD,
2831 /* 72 -58 */ CWORD_CWORD_CWORD_CWORD, 2828 /* 74 "J" */ CWORD_CWORD_CWORD_CWORD,
2832 /* 73 -57 */ CWORD_CWORD_CWORD_CWORD, 2829 /* 75 "K" */ CWORD_CWORD_CWORD_CWORD,
2833 /* 74 -56 */ CWORD_CWORD_CWORD_CWORD, 2830 /* 76 "L" */ CWORD_CWORD_CWORD_CWORD,
2834 /* 75 -55 */ CWORD_CWORD_CWORD_CWORD, 2831 /* 77 "M" */ CWORD_CWORD_CWORD_CWORD,
2835 /* 76 -54 */ CWORD_CWORD_CWORD_CWORD, 2832 /* 78 "N" */ CWORD_CWORD_CWORD_CWORD,
2836 /* 77 -53 */ CWORD_CWORD_CWORD_CWORD, 2833 /* 79 "O" */ CWORD_CWORD_CWORD_CWORD,
2837 /* 78 -52 */ CWORD_CWORD_CWORD_CWORD, 2834 /* 80 "P" */ CWORD_CWORD_CWORD_CWORD,
2838 /* 79 -51 */ CWORD_CWORD_CWORD_CWORD, 2835 /* 81 "Q" */ CWORD_CWORD_CWORD_CWORD,
2839 /* 80 -50 */ CWORD_CWORD_CWORD_CWORD, 2836 /* 82 "R" */ CWORD_CWORD_CWORD_CWORD,
2840 /* 81 -49 */ CWORD_CWORD_CWORD_CWORD, 2837 /* 83 "S" */ CWORD_CWORD_CWORD_CWORD,
2841 /* 82 -48 */ CWORD_CWORD_CWORD_CWORD, 2838 /* 84 "T" */ CWORD_CWORD_CWORD_CWORD,
2842 /* 83 -47 */ CWORD_CWORD_CWORD_CWORD, 2839 /* 85 "U" */ CWORD_CWORD_CWORD_CWORD,
2843 /* 84 -46 */ CWORD_CWORD_CWORD_CWORD, 2840 /* 86 "V" */ CWORD_CWORD_CWORD_CWORD,
2844 /* 85 -45 */ CWORD_CWORD_CWORD_CWORD, 2841 /* 87 "W" */ CWORD_CWORD_CWORD_CWORD,
2845 /* 86 -44 */ CWORD_CWORD_CWORD_CWORD, 2842 /* 88 "X" */ CWORD_CWORD_CWORD_CWORD,
2846 /* 87 -43 */ CWORD_CWORD_CWORD_CWORD, 2843 /* 89 "Y" */ CWORD_CWORD_CWORD_CWORD,
2847 /* 88 -42 */ CWORD_CWORD_CWORD_CWORD, 2844 /* 90 "Z" */ CWORD_CWORD_CWORD_CWORD,
2848 /* 89 -41 */ CWORD_CWORD_CWORD_CWORD, 2845 /* 91 "[" */ CWORD_CCTL_CCTL_CWORD,
2849 /* 90 -40 */ CWORD_CWORD_CWORD_CWORD, 2846 /* 92 "\" */ CBACK_CBACK_CCTL_CBACK,
2850 /* 91 -39 */ CWORD_CWORD_CWORD_CWORD, 2847 /* 93 "]" */ CWORD_CCTL_CCTL_CWORD,
2851 /* 92 -38 */ CWORD_CWORD_CWORD_CWORD, 2848 /* 94 "^" */ CWORD_CWORD_CWORD_CWORD,
2852 /* 93 -37 */ CWORD_CWORD_CWORD_CWORD, 2849 /* 95 "_" */ CWORD_CWORD_CWORD_CWORD,
2853 /* 94 -36 */ CWORD_CWORD_CWORD_CWORD, 2850 /* 96 "`" */ CBQUOTE_CBQUOTE_CWORD_CBQUOTE,
2854 /* 95 -35 */ CWORD_CWORD_CWORD_CWORD, 2851 /* 97 "a" */ CWORD_CWORD_CWORD_CWORD,
2855 /* 96 -34 */ CWORD_CWORD_CWORD_CWORD, 2852 /* 98 "b" */ CWORD_CWORD_CWORD_CWORD,
2856 /* 97 -33 */ CWORD_CWORD_CWORD_CWORD, 2853 /* 99 "c" */ CWORD_CWORD_CWORD_CWORD,
2857 /* 98 -32 */ CWORD_CWORD_CWORD_CWORD, 2854 /* 100 "d" */ CWORD_CWORD_CWORD_CWORD,
2858 /* 99 -31 */ CWORD_CWORD_CWORD_CWORD, 2855 /* 101 "e" */ CWORD_CWORD_CWORD_CWORD,
2859 /* 100 -30 */ CWORD_CWORD_CWORD_CWORD, 2856 /* 102 "f" */ CWORD_CWORD_CWORD_CWORD,
2860 /* 101 -29 */ CWORD_CWORD_CWORD_CWORD, 2857 /* 103 "g" */ CWORD_CWORD_CWORD_CWORD,
2861 /* 102 -28 */ CWORD_CWORD_CWORD_CWORD, 2858 /* 104 "h" */ CWORD_CWORD_CWORD_CWORD,
2862 /* 103 -27 */ CWORD_CWORD_CWORD_CWORD, 2859 /* 105 "i" */ CWORD_CWORD_CWORD_CWORD,
2863 /* 104 -26 */ CWORD_CWORD_CWORD_CWORD, 2860 /* 106 "j" */ CWORD_CWORD_CWORD_CWORD,
2864 /* 105 -25 */ CWORD_CWORD_CWORD_CWORD, 2861 /* 107 "k" */ CWORD_CWORD_CWORD_CWORD,
2865 /* 106 -24 */ CWORD_CWORD_CWORD_CWORD, 2862 /* 108 "l" */ CWORD_CWORD_CWORD_CWORD,
2866 /* 107 -23 */ CWORD_CWORD_CWORD_CWORD, 2863 /* 109 "m" */ CWORD_CWORD_CWORD_CWORD,
2867 /* 108 -22 */ CWORD_CWORD_CWORD_CWORD, 2864 /* 110 "n" */ CWORD_CWORD_CWORD_CWORD,
2868 /* 109 -21 */ CWORD_CWORD_CWORD_CWORD, 2865 /* 111 "o" */ CWORD_CWORD_CWORD_CWORD,
2869 /* 110 -20 */ CWORD_CWORD_CWORD_CWORD, 2866 /* 112 "p" */ CWORD_CWORD_CWORD_CWORD,
2870 /* 111 -19 */ CWORD_CWORD_CWORD_CWORD, 2867 /* 113 "q" */ CWORD_CWORD_CWORD_CWORD,
2871 /* 112 -18 */ CWORD_CWORD_CWORD_CWORD, 2868 /* 114 "r" */ CWORD_CWORD_CWORD_CWORD,
2872 /* 113 -17 */ CWORD_CWORD_CWORD_CWORD, 2869 /* 115 "s" */ CWORD_CWORD_CWORD_CWORD,
2873 /* 114 -16 */ CWORD_CWORD_CWORD_CWORD, 2870 /* 116 "t" */ CWORD_CWORD_CWORD_CWORD,
2874 /* 115 -15 */ CWORD_CWORD_CWORD_CWORD, 2871 /* 117 "u" */ CWORD_CWORD_CWORD_CWORD,
2875 /* 116 -14 */ CWORD_CWORD_CWORD_CWORD, 2872 /* 118 "v" */ CWORD_CWORD_CWORD_CWORD,
2876 /* 117 -13 */ CWORD_CWORD_CWORD_CWORD, 2873 /* 119 "w" */ CWORD_CWORD_CWORD_CWORD,
2877 /* 118 -12 */ CWORD_CWORD_CWORD_CWORD, 2874 /* 120 "x" */ CWORD_CWORD_CWORD_CWORD,
2878 /* 119 -11 */ CWORD_CWORD_CWORD_CWORD, 2875 /* 121 "y" */ CWORD_CWORD_CWORD_CWORD,
2879 /* 120 -10 */ CWORD_CWORD_CWORD_CWORD, 2876 /* 122 "z" */ CWORD_CWORD_CWORD_CWORD,
2880 /* 121 -9 */ CWORD_CWORD_CWORD_CWORD, 2877 /* 123 "{" */ CWORD_CWORD_CWORD_CWORD,
2881 /* 122 -8 */ CWORD_CWORD_CWORD_CWORD, 2878 /* 124 "|" */ CSPCL_CWORD_CWORD_CWORD,
2882 /* 123 -7 */ CWORD_CWORD_CWORD_CWORD, 2879 /* 125 "}" */ CENDVAR_CENDVAR_CWORD_CENDVAR,
2883 /* 124 -6 */ CWORD_CWORD_CWORD_CWORD, 2880 /* 126 "~" */ CWORD_CCTL_CCTL_CWORD,
2884 /* 125 -5 */ CWORD_CWORD_CWORD_CWORD, 2881 /* 127 del */ CWORD_CWORD_CWORD_CWORD,
2885 /* 126 -4 */ CWORD_CWORD_CWORD_CWORD, 2882 /* 128 0x80 */ CWORD_CWORD_CWORD_CWORD,
2886 /* 127 -3 */ CWORD_CWORD_CWORD_CWORD, 2883 /* 129 CTLESC */ CCTL_CCTL_CCTL_CCTL,
2887 /* 128 -2 */ CWORD_CWORD_CWORD_CWORD, 2884 /* 130 CTLVAR */ CCTL_CCTL_CCTL_CCTL,
2888 /* 129 -1 */ CWORD_CWORD_CWORD_CWORD, 2885 /* 131 CTLENDVAR */ CCTL_CCTL_CCTL_CCTL,
2889 /* 130 0 */ CWORD_CWORD_CWORD_CWORD, 2886 /* 132 CTLBACKQ */ CCTL_CCTL_CCTL_CCTL,
2890 /* 131 1 */ CWORD_CWORD_CWORD_CWORD, 2887 /* 133 CTLQUOTE */ CCTL_CCTL_CCTL_CCTL,
2891 /* 132 2 */ CWORD_CWORD_CWORD_CWORD, 2888 /* 134 CTLARI */ CCTL_CCTL_CCTL_CCTL,
2892 /* 133 3 */ CWORD_CWORD_CWORD_CWORD, 2889 /* 135 CTLENDARI */ CCTL_CCTL_CCTL_CCTL,
2893 /* 134 4 */ CWORD_CWORD_CWORD_CWORD, 2890 /* 136 CTLQUOTEMARK */ CCTL_CCTL_CCTL_CCTL,
2894 /* 135 5 */ CWORD_CWORD_CWORD_CWORD, 2891 /* 137 */ CWORD_CWORD_CWORD_CWORD,
2895 /* 136 6 */ CWORD_CWORD_CWORD_CWORD, 2892 /* 138 */ CWORD_CWORD_CWORD_CWORD,
2896 /* 137 7 */ CWORD_CWORD_CWORD_CWORD, 2893 /* 139 */ CWORD_CWORD_CWORD_CWORD,
2897 /* 138 8 */ CWORD_CWORD_CWORD_CWORD, 2894 /* 140 */ CWORD_CWORD_CWORD_CWORD,
2898 /* 139 9 "\t" */ CSPCL_CWORD_CWORD_CWORD, 2895 /* 141 */ CWORD_CWORD_CWORD_CWORD,
2899 /* 140 10 "\n" */ CNL_CNL_CNL_CNL, 2896 /* 142 */ CWORD_CWORD_CWORD_CWORD,
2900 /* 141 11 */ CWORD_CWORD_CWORD_CWORD, 2897 /* 143 */ CWORD_CWORD_CWORD_CWORD,
2901 /* 142 12 */ CWORD_CWORD_CWORD_CWORD, 2898 /* 144 */ CWORD_CWORD_CWORD_CWORD,
2902 /* 143 13 */ CWORD_CWORD_CWORD_CWORD, 2899 /* 145 */ CWORD_CWORD_CWORD_CWORD,
2903 /* 144 14 */ CWORD_CWORD_CWORD_CWORD, 2900 /* 146 */ CWORD_CWORD_CWORD_CWORD,
2904 /* 145 15 */ CWORD_CWORD_CWORD_CWORD, 2901 /* 147 */ CWORD_CWORD_CWORD_CWORD,
2905 /* 146 16 */ CWORD_CWORD_CWORD_CWORD, 2902 /* 148 */ CWORD_CWORD_CWORD_CWORD,
2906 /* 147 17 */ CWORD_CWORD_CWORD_CWORD, 2903 /* 149 */ CWORD_CWORD_CWORD_CWORD,
2907 /* 148 18 */ CWORD_CWORD_CWORD_CWORD, 2904 /* 150 */ CWORD_CWORD_CWORD_CWORD,
2908 /* 149 19 */ CWORD_CWORD_CWORD_CWORD, 2905 /* 151 */ CWORD_CWORD_CWORD_CWORD,
2909 /* 150 20 */ CWORD_CWORD_CWORD_CWORD, 2906 /* 152 */ CWORD_CWORD_CWORD_CWORD,
2910 /* 151 21 */ CWORD_CWORD_CWORD_CWORD, 2907 /* 153 */ CWORD_CWORD_CWORD_CWORD,
2911 /* 152 22 */ CWORD_CWORD_CWORD_CWORD, 2908 /* 154 */ CWORD_CWORD_CWORD_CWORD,
2912 /* 153 23 */ CWORD_CWORD_CWORD_CWORD, 2909 /* 155 */ CWORD_CWORD_CWORD_CWORD,
2913 /* 154 24 */ CWORD_CWORD_CWORD_CWORD, 2910 /* 156 */ CWORD_CWORD_CWORD_CWORD,
2914 /* 155 25 */ CWORD_CWORD_CWORD_CWORD, 2911 /* 157 */ CWORD_CWORD_CWORD_CWORD,
2915 /* 156 26 */ CWORD_CWORD_CWORD_CWORD, 2912 /* 158 */ CWORD_CWORD_CWORD_CWORD,
2916 /* 157 27 */ CWORD_CWORD_CWORD_CWORD, 2913 /* 159 */ CWORD_CWORD_CWORD_CWORD,
2917 /* 158 28 */ CWORD_CWORD_CWORD_CWORD, 2914 /* 160 */ CWORD_CWORD_CWORD_CWORD,
2918 /* 159 29 */ CWORD_CWORD_CWORD_CWORD, 2915 /* 161 */ CWORD_CWORD_CWORD_CWORD,
2919 /* 160 30 */ CWORD_CWORD_CWORD_CWORD, 2916 /* 162 */ CWORD_CWORD_CWORD_CWORD,
2920 /* 161 31 */ CWORD_CWORD_CWORD_CWORD, 2917 /* 163 */ CWORD_CWORD_CWORD_CWORD,
2921 /* 162 32 " " */ CSPCL_CWORD_CWORD_CWORD, 2918 /* 164 */ CWORD_CWORD_CWORD_CWORD,
2922 /* 163 33 "!" */ CWORD_CCTL_CCTL_CWORD, 2919 /* 165 */ CWORD_CWORD_CWORD_CWORD,
2923 /* 164 34 """ */ CDQUOTE_CENDQUOTE_CWORD_CWORD, 2920 /* 166 */ CWORD_CWORD_CWORD_CWORD,
2924 /* 165 35 "#" */ CWORD_CWORD_CWORD_CWORD, 2921 /* 167 */ CWORD_CWORD_CWORD_CWORD,
2925 /* 166 36 "$" */ CVAR_CVAR_CWORD_CVAR, 2922 /* 168 */ CWORD_CWORD_CWORD_CWORD,
2926 /* 167 37 "%" */ CWORD_CWORD_CWORD_CWORD, 2923 /* 169 */ CWORD_CWORD_CWORD_CWORD,
2927 /* 168 38 "&" */ CSPCL_CWORD_CWORD_CWORD, 2924 /* 170 */ CWORD_CWORD_CWORD_CWORD,
2928 /* 169 39 "'" */ CSQUOTE_CWORD_CENDQUOTE_CWORD, 2925 /* 171 */ CWORD_CWORD_CWORD_CWORD,
2929 /* 170 40 "(" */ CSPCL_CWORD_CWORD_CLP, 2926 /* 172 */ CWORD_CWORD_CWORD_CWORD,
2930 /* 171 41 ")" */ CSPCL_CWORD_CWORD_CRP, 2927 /* 173 */ CWORD_CWORD_CWORD_CWORD,
2931 /* 172 42 "*" */ CWORD_CCTL_CCTL_CWORD, 2928 /* 174 */ CWORD_CWORD_CWORD_CWORD,
2932 /* 173 43 "+" */ CWORD_CWORD_CWORD_CWORD, 2929 /* 175 */ CWORD_CWORD_CWORD_CWORD,
2933 /* 174 44 "," */ CWORD_CWORD_CWORD_CWORD, 2930 /* 176 */ CWORD_CWORD_CWORD_CWORD,
2934 /* 175 45 "-" */ CWORD_CCTL_CCTL_CWORD, 2931 /* 177 */ CWORD_CWORD_CWORD_CWORD,
2935 /* 176 46 "." */ CWORD_CWORD_CWORD_CWORD, 2932 /* 178 */ CWORD_CWORD_CWORD_CWORD,
2936 /* 177 47 "/" */ CWORD_CCTL_CCTL_CWORD, 2933 /* 179 */ CWORD_CWORD_CWORD_CWORD,
2937 /* 178 48 "0" */ CWORD_CWORD_CWORD_CWORD, 2934 /* 180 */ CWORD_CWORD_CWORD_CWORD,
2938 /* 179 49 "1" */ CWORD_CWORD_CWORD_CWORD, 2935 /* 181 */ CWORD_CWORD_CWORD_CWORD,
2939 /* 180 50 "2" */ CWORD_CWORD_CWORD_CWORD, 2936 /* 182 */ CWORD_CWORD_CWORD_CWORD,
2940 /* 181 51 "3" */ CWORD_CWORD_CWORD_CWORD, 2937 /* 183 */ CWORD_CWORD_CWORD_CWORD,
2941 /* 182 52 "4" */ CWORD_CWORD_CWORD_CWORD, 2938 /* 184 */ CWORD_CWORD_CWORD_CWORD,
2942 /* 183 53 "5" */ CWORD_CWORD_CWORD_CWORD, 2939 /* 185 */ CWORD_CWORD_CWORD_CWORD,
2943 /* 184 54 "6" */ CWORD_CWORD_CWORD_CWORD, 2940 /* 186 */ CWORD_CWORD_CWORD_CWORD,
2944 /* 185 55 "7" */ CWORD_CWORD_CWORD_CWORD, 2941 /* 187 */ CWORD_CWORD_CWORD_CWORD,
2945 /* 186 56 "8" */ CWORD_CWORD_CWORD_CWORD, 2942 /* 188 */ CWORD_CWORD_CWORD_CWORD,
2946 /* 187 57 "9" */ CWORD_CWORD_CWORD_CWORD, 2943 /* 189 */ CWORD_CWORD_CWORD_CWORD,
2947 /* 188 58 ":" */ CWORD_CCTL_CCTL_CWORD, 2944 /* 190 */ CWORD_CWORD_CWORD_CWORD,
2948 /* 189 59 ";" */ CSPCL_CWORD_CWORD_CWORD, 2945 /* 191 */ CWORD_CWORD_CWORD_CWORD,
2949 /* 190 60 "<" */ CSPCL_CWORD_CWORD_CWORD, 2946 /* 192 */ CWORD_CWORD_CWORD_CWORD,
2950 /* 191 61 "=" */ CWORD_CCTL_CCTL_CWORD, 2947 /* 193 */ CWORD_CWORD_CWORD_CWORD,
2951 /* 192 62 ">" */ CSPCL_CWORD_CWORD_CWORD, 2948 /* 194 */ CWORD_CWORD_CWORD_CWORD,
2952 /* 193 63 "?" */ CWORD_CCTL_CCTL_CWORD, 2949 /* 195 */ CWORD_CWORD_CWORD_CWORD,
2953 /* 194 64 "@" */ CWORD_CWORD_CWORD_CWORD, 2950 /* 196 */ CWORD_CWORD_CWORD_CWORD,
2954 /* 195 65 "A" */ CWORD_CWORD_CWORD_CWORD, 2951 /* 197 */ CWORD_CWORD_CWORD_CWORD,
2955 /* 196 66 "B" */ CWORD_CWORD_CWORD_CWORD, 2952 /* 198 */ CWORD_CWORD_CWORD_CWORD,
2956 /* 197 67 "C" */ CWORD_CWORD_CWORD_CWORD, 2953 /* 199 */ CWORD_CWORD_CWORD_CWORD,
2957 /* 198 68 "D" */ CWORD_CWORD_CWORD_CWORD, 2954 /* 200 */ CWORD_CWORD_CWORD_CWORD,
2958 /* 199 69 "E" */ CWORD_CWORD_CWORD_CWORD, 2955 /* 201 */ CWORD_CWORD_CWORD_CWORD,
2959 /* 200 70 "F" */ CWORD_CWORD_CWORD_CWORD, 2956 /* 202 */ CWORD_CWORD_CWORD_CWORD,
2960 /* 201 71 "G" */ CWORD_CWORD_CWORD_CWORD, 2957 /* 203 */ CWORD_CWORD_CWORD_CWORD,
2961 /* 202 72 "H" */ CWORD_CWORD_CWORD_CWORD, 2958 /* 204 */ CWORD_CWORD_CWORD_CWORD,
2962 /* 203 73 "I" */ CWORD_CWORD_CWORD_CWORD, 2959 /* 205 */ CWORD_CWORD_CWORD_CWORD,
2963 /* 204 74 "J" */ CWORD_CWORD_CWORD_CWORD, 2960 /* 206 */ CWORD_CWORD_CWORD_CWORD,
2964 /* 205 75 "K" */ CWORD_CWORD_CWORD_CWORD, 2961 /* 207 */ CWORD_CWORD_CWORD_CWORD,
2965 /* 206 76 "L" */ CWORD_CWORD_CWORD_CWORD, 2962 /* 208 */ CWORD_CWORD_CWORD_CWORD,
2966 /* 207 77 "M" */ CWORD_CWORD_CWORD_CWORD, 2963 /* 209 */ CWORD_CWORD_CWORD_CWORD,
2967 /* 208 78 "N" */ CWORD_CWORD_CWORD_CWORD, 2964 /* 210 */ CWORD_CWORD_CWORD_CWORD,
2968 /* 209 79 "O" */ CWORD_CWORD_CWORD_CWORD, 2965 /* 211 */ CWORD_CWORD_CWORD_CWORD,
2969 /* 210 80 "P" */ CWORD_CWORD_CWORD_CWORD, 2966 /* 212 */ CWORD_CWORD_CWORD_CWORD,
2970 /* 211 81 "Q" */ CWORD_CWORD_CWORD_CWORD, 2967 /* 213 */ CWORD_CWORD_CWORD_CWORD,
2971 /* 212 82 "R" */ CWORD_CWORD_CWORD_CWORD, 2968 /* 214 */ CWORD_CWORD_CWORD_CWORD,
2972 /* 213 83 "S" */ CWORD_CWORD_CWORD_CWORD, 2969 /* 215 */ CWORD_CWORD_CWORD_CWORD,
2973 /* 214 84 "T" */ CWORD_CWORD_CWORD_CWORD, 2970 /* 216 */ CWORD_CWORD_CWORD_CWORD,
2974 /* 215 85 "U" */ CWORD_CWORD_CWORD_CWORD, 2971 /* 217 */ CWORD_CWORD_CWORD_CWORD,
2975 /* 216 86 "V" */ CWORD_CWORD_CWORD_CWORD, 2972 /* 218 */ CWORD_CWORD_CWORD_CWORD,
2976 /* 217 87 "W" */ CWORD_CWORD_CWORD_CWORD, 2973 /* 219 */ CWORD_CWORD_CWORD_CWORD,
2977 /* 218 88 "X" */ CWORD_CWORD_CWORD_CWORD, 2974 /* 220 */ CWORD_CWORD_CWORD_CWORD,
2978 /* 219 89 "Y" */ CWORD_CWORD_CWORD_CWORD, 2975 /* 221 */ CWORD_CWORD_CWORD_CWORD,
2979 /* 220 90 "Z" */ CWORD_CWORD_CWORD_CWORD, 2976 /* 222 */ CWORD_CWORD_CWORD_CWORD,
2980 /* 221 91 "[" */ CWORD_CCTL_CCTL_CWORD, 2977 /* 223 */ CWORD_CWORD_CWORD_CWORD,
2981 /* 222 92 "\" */ CBACK_CBACK_CCTL_CBACK, 2978 /* 224 */ CWORD_CWORD_CWORD_CWORD,
2982 /* 223 93 "]" */ CWORD_CCTL_CCTL_CWORD, 2979 /* 225 */ CWORD_CWORD_CWORD_CWORD,
2983 /* 224 94 "^" */ CWORD_CWORD_CWORD_CWORD, 2980 /* 226 */ CWORD_CWORD_CWORD_CWORD,
2984 /* 225 95 "_" */ CWORD_CWORD_CWORD_CWORD, 2981 /* 227 */ CWORD_CWORD_CWORD_CWORD,
2985 /* 226 96 "`" */ CBQUOTE_CBQUOTE_CWORD_CBQUOTE, 2982 /* 228 */ CWORD_CWORD_CWORD_CWORD,
2986 /* 227 97 "a" */ CWORD_CWORD_CWORD_CWORD, 2983 /* 229 */ CWORD_CWORD_CWORD_CWORD,
2987 /* 228 98 "b" */ CWORD_CWORD_CWORD_CWORD, 2984 /* 230 */ CWORD_CWORD_CWORD_CWORD,
2988 /* 229 99 "c" */ CWORD_CWORD_CWORD_CWORD, 2985 /* 231 */ CWORD_CWORD_CWORD_CWORD,
2989 /* 230 100 "d" */ CWORD_CWORD_CWORD_CWORD, 2986 /* 232 */ CWORD_CWORD_CWORD_CWORD,
2990 /* 231 101 "e" */ CWORD_CWORD_CWORD_CWORD, 2987 /* 233 */ CWORD_CWORD_CWORD_CWORD,
2991 /* 232 102 "f" */ CWORD_CWORD_CWORD_CWORD, 2988 /* 234 */ CWORD_CWORD_CWORD_CWORD,
2992 /* 233 103 "g" */ CWORD_CWORD_CWORD_CWORD, 2989 /* 235 */ CWORD_CWORD_CWORD_CWORD,
2993 /* 234 104 "h" */ CWORD_CWORD_CWORD_CWORD, 2990 /* 236 */ CWORD_CWORD_CWORD_CWORD,
2994 /* 235 105 "i" */ CWORD_CWORD_CWORD_CWORD, 2991 /* 237 */ CWORD_CWORD_CWORD_CWORD,
2995 /* 236 106 "j" */ CWORD_CWORD_CWORD_CWORD, 2992 /* 238 */ CWORD_CWORD_CWORD_CWORD,
2996 /* 237 107 "k" */ CWORD_CWORD_CWORD_CWORD, 2993 /* 239 */ CWORD_CWORD_CWORD_CWORD,
2997 /* 238 108 "l" */ CWORD_CWORD_CWORD_CWORD, 2994 /* 230 */ CWORD_CWORD_CWORD_CWORD,
2998 /* 239 109 "m" */ CWORD_CWORD_CWORD_CWORD, 2995 /* 241 */ CWORD_CWORD_CWORD_CWORD,
2999 /* 240 110 "n" */ CWORD_CWORD_CWORD_CWORD, 2996 /* 242 */ CWORD_CWORD_CWORD_CWORD,
3000 /* 241 111 "o" */ CWORD_CWORD_CWORD_CWORD, 2997 /* 243 */ CWORD_CWORD_CWORD_CWORD,
3001 /* 242 112 "p" */ CWORD_CWORD_CWORD_CWORD, 2998 /* 244 */ CWORD_CWORD_CWORD_CWORD,
3002 /* 243 113 "q" */ CWORD_CWORD_CWORD_CWORD, 2999 /* 245 */ CWORD_CWORD_CWORD_CWORD,
3003 /* 244 114 "r" */ CWORD_CWORD_CWORD_CWORD, 3000 /* 246 */ CWORD_CWORD_CWORD_CWORD,
3004 /* 245 115 "s" */ CWORD_CWORD_CWORD_CWORD, 3001 /* 247 */ CWORD_CWORD_CWORD_CWORD,
3005 /* 246 116 "t" */ CWORD_CWORD_CWORD_CWORD, 3002 /* 248 */ CWORD_CWORD_CWORD_CWORD,
3006 /* 247 117 "u" */ CWORD_CWORD_CWORD_CWORD, 3003 /* 249 */ CWORD_CWORD_CWORD_CWORD,
3007 /* 248 118 "v" */ CWORD_CWORD_CWORD_CWORD, 3004 /* 250 */ CWORD_CWORD_CWORD_CWORD,
3008 /* 249 119 "w" */ CWORD_CWORD_CWORD_CWORD, 3005 /* 251 */ CWORD_CWORD_CWORD_CWORD,
3009 /* 250 120 "x" */ CWORD_CWORD_CWORD_CWORD, 3006 /* 252 */ CWORD_CWORD_CWORD_CWORD,
3010 /* 251 121 "y" */ CWORD_CWORD_CWORD_CWORD, 3007 /* 253 */ CWORD_CWORD_CWORD_CWORD,
3011 /* 252 122 "z" */ CWORD_CWORD_CWORD_CWORD, 3008 /* 254 */ CWORD_CWORD_CWORD_CWORD,
3012 /* 253 123 "{" */ CWORD_CWORD_CWORD_CWORD, 3009 /* 255 */ CWORD_CWORD_CWORD_CWORD,
3013 /* 254 124 "|" */ CSPCL_CWORD_CWORD_CWORD, 3010# if ENABLE_ASH_ALIAS
3014 /* 255 125 "}" */ CENDVAR_CENDVAR_CWORD_CENDVAR, 3011 /* PEOA */ CSPCL_CIGN_CIGN_CIGN,
3015 /* 256 126 "~" */ CWORD_CCTL_CCTL_CWORD, 3012# endif
3016 /* 257 127 */ CWORD_CWORD_CWORD_CWORD, 3013 /* PEOF */ CENDFILE_CENDFILE_CENDFILE_CENDFILE,
3017}; 3014};
3018 3015
3019#define SIT(c, syntax) (S_I_T[(int)syntax_index_table[(int)(c) + SYNBASE]][syntax]) 3016# define SIT(c, syntax) (S_I_T[syntax_index_table[c]][syntax])
3020 3017
3021#endif /* USE_SIT_FUNCTION */ 3018#endif /* USE_SIT_FUNCTION */
3022 3019
@@ -4229,9 +4226,10 @@ cmdputs(const char *s)
4229 }; 4226 };
4230 4227
4231 const char *p, *str; 4228 const char *p, *str;
4232 char c, cc[2] = " "; 4229 char cc[2] = " ";
4233 char *nextc; 4230 char *nextc;
4234 int subtype = 0; 4231 unsigned char c;
4232 unsigned char subtype = 0;
4235 int quoted = 0; 4233 int quoted = 0;
4236 4234
4237 nextc = makestrspace((strlen(s) + 1) * 8, cmdnextc); 4235 nextc = makestrspace((strlen(s) + 1) * 8, cmdnextc);
@@ -5454,7 +5452,7 @@ rmescapes(char *str, int flag)
5454 globbing = flag & RMESCAPE_GLOB; 5452 globbing = flag & RMESCAPE_GLOB;
5455 protect_against_glob = globbing; 5453 protect_against_glob = globbing;
5456 while (*p) { 5454 while (*p) {
5457 if (*p == CTLQUOTEMARK) { 5455 if ((unsigned char)*p == CTLQUOTEMARK) {
5458// TODO: if no RMESCAPE_QUOTED in flags, inquotes never becomes 0 5456// TODO: if no RMESCAPE_QUOTED in flags, inquotes never becomes 0
5459// (alternates between RMESCAPE_QUOTED and ~RMESCAPE_QUOTED). Is it ok? 5457// (alternates between RMESCAPE_QUOTED and ~RMESCAPE_QUOTED). Is it ok?
5460// Note: both inquotes and protect_against_glob only affect whether 5458// Note: both inquotes and protect_against_glob only affect whether
@@ -5469,7 +5467,7 @@ rmescapes(char *str, int flag)
5469 protect_against_glob = 0; 5467 protect_against_glob = 0;
5470 goto copy; 5468 goto copy;
5471 } 5469 }
5472 if (*p == CTLESC) { 5470 if ((unsigned char)*p == CTLESC) {
5473 p++; 5471 p++;
5474 if (protect_against_glob && inquotes && *p != '/') { 5472 if (protect_against_glob && inquotes && *p != '/') {
5475 *q++ = '\\'; 5473 *q++ = '\\';
@@ -5514,8 +5512,8 @@ memtodest(const char *p, size_t len, int syntax, int quotes)
5514 q = makestrspace(quotes ? len * 2 : len, q); 5512 q = makestrspace(quotes ? len * 2 : len, q);
5515 5513
5516 while (len--) { 5514 while (len--) {
5517 int c = signed_char2int(*p++); 5515 unsigned char c = *p++;
5518 if (!c) 5516 if (c == '\0')
5519 continue; 5517 continue;
5520 if (quotes) { 5518 if (quotes) {
5521 int n = SIT(c, syntax); 5519 int n = SIT(c, syntax);
@@ -5600,7 +5598,7 @@ removerecordregions(int endoff)
5600static char * 5598static char *
5601exptilde(char *startp, char *p, int flags) 5599exptilde(char *startp, char *p, int flags)
5602{ 5600{
5603 char c; 5601 unsigned char c;
5604 char *name; 5602 char *name;
5605 struct passwd *pw; 5603 struct passwd *pw;
5606 const char *home; 5604 const char *home;
@@ -5795,7 +5793,7 @@ expari(int quotes)
5795 do { 5793 do {
5796 int esc; 5794 int esc;
5797 5795
5798 while (*p != CTLARI) { 5796 while ((unsigned char)*p != CTLARI) {
5799 p--; 5797 p--;
5800#if DEBUG 5798#if DEBUG
5801 if (p < start) { 5799 if (p < start) {
@@ -5857,10 +5855,9 @@ argstr(char *p, int flags, struct strlist *var_str_list)
5857#if ENABLE_SH_MATH_SUPPORT 5855#if ENABLE_SH_MATH_SUPPORT
5858 CTLENDARI, 5856 CTLENDARI,
5859#endif 5857#endif
5860 0 5858 '\0'
5861 }; 5859 };
5862 const char *reject = spclchars; 5860 const char *reject = spclchars;
5863 int c;
5864 int quotes = flags & (EXP_FULL | EXP_CASE | EXP_REDIR); /* do CTLESC */ 5861 int quotes = flags & (EXP_FULL | EXP_CASE | EXP_REDIR); /* do CTLESC */
5865 int breakall = flags & EXP_WORD; 5862 int breakall = flags & EXP_WORD;
5866 int inquotes; 5863 int inquotes;
@@ -5888,8 +5885,10 @@ argstr(char *p, int flags, struct strlist *var_str_list)
5888 start: 5885 start:
5889 startloc = expdest - (char *)stackblock(); 5886 startloc = expdest - (char *)stackblock();
5890 for (;;) { 5887 for (;;) {
5888 unsigned char c;
5889
5891 length += strcspn(p + length, reject); 5890 length += strcspn(p + length, reject);
5892 c = (unsigned char) p[length]; 5891 c = p[length];
5893 if (c) { 5892 if (c) {
5894 if (!(c & 0x80) 5893 if (!(c & 0x80)
5895#if ENABLE_SH_MATH_SUPPORT 5894#if ENABLE_SH_MATH_SUPPORT
@@ -6044,7 +6043,7 @@ scanleft(char *startp, char *rmesc, char *rmescend UNUSED_PARAM, char *str, int
6044 *loc2 = c; 6043 *loc2 = c;
6045 if (match) // if (!match) 6044 if (match) // if (!match)
6046 return loc; 6045 return loc;
6047 if (quotes && *loc == CTLESC) 6046 if (quotes && (unsigned char)*loc == CTLESC)
6048 loc++; 6047 loc++;
6049 loc++; 6048 loc++;
6050 loc2++; 6049 loc2++;
@@ -6096,7 +6095,7 @@ varunset(const char *end, const char *var, const char *umsg, int varflags)
6096 tail = nullstr; 6095 tail = nullstr;
6097 msg = "parameter not set"; 6096 msg = "parameter not set";
6098 if (umsg) { 6097 if (umsg) {
6099 if (*end == CTLENDVAR) { 6098 if ((unsigned char)*end == CTLENDVAR) {
6100 if (varflags & VSNUL) 6099 if (varflags & VSNUL)
6101 tail = " or null"; 6100 tail = " or null";
6102 } else { 6101 } else {
@@ -6180,7 +6179,7 @@ subevalvar(char *p, char *str, int strloc, int subtype,
6180 6179
6181 /* Adjust the length by the number of escapes */ 6180 /* Adjust the length by the number of escapes */
6182 for (ptr = startp; ptr < (str - 1); ptr++) { 6181 for (ptr = startp; ptr < (str - 1); ptr++) {
6183 if (*ptr == CTLESC) { 6182 if ((unsigned char)*ptr == CTLESC) {
6184 len--; 6183 len--;
6185 ptr++; 6184 ptr++;
6186 } 6185 }
@@ -6214,11 +6213,11 @@ subevalvar(char *p, char *str, int strloc, int subtype,
6214 len = orig_len - pos; 6213 len = orig_len - pos;
6215 6214
6216 for (str = startp; pos; str++, pos--) { 6215 for (str = startp; pos; str++, pos--) {
6217 if (quotes && *str == CTLESC) 6216 if (quotes && (unsigned char)*str == CTLESC)
6218 str++; 6217 str++;
6219 } 6218 }
6220 for (loc = startp; len; len--) { 6219 for (loc = startp; len; len--) {
6221 if (quotes && *str == CTLESC) 6220 if (quotes && (unsigned char)*str == CTLESC)
6222 *loc++ = *str++; 6221 *loc++ = *str++;
6223 *loc++ = *str++; 6222 *loc++ = *str++;
6224 } 6223 }
@@ -6282,7 +6281,7 @@ subevalvar(char *p, char *str, int strloc, int subtype,
6282 /* No match, advance */ 6281 /* No match, advance */
6283 restart_detect = stackblock(); 6282 restart_detect = stackblock();
6284 STPUTC(*idx, expdest); 6283 STPUTC(*idx, expdest);
6285 if (quotes && *idx == CTLESC) { 6284 if (quotes && (unsigned char)*idx == CTLESC) {
6286 idx++; 6285 idx++;
6287 len++; 6286 len++;
6288 STPUTC(*idx, expdest); 6287 STPUTC(*idx, expdest);
@@ -6297,7 +6296,7 @@ subevalvar(char *p, char *str, int strloc, int subtype,
6297 6296
6298 if (subtype == VSREPLACEALL) { 6297 if (subtype == VSREPLACEALL) {
6299 while (idx < loc) { 6298 while (idx < loc) {
6300 if (quotes && *idx == CTLESC) 6299 if (quotes && (unsigned char)*idx == CTLESC)
6301 idx++; 6300 idx++;
6302 idx++; 6301 idx++;
6303 rmesc++; 6302 rmesc++;
@@ -6416,7 +6415,7 @@ varvalue(char *name, int varflags, int flags, struct strlist *var_str_list)
6416 goto param; 6415 goto param;
6417 /* fall through */ 6416 /* fall through */
6418 case '*': 6417 case '*':
6419 sep = ifsset() ? signed_char2int(ifsval()[0]) : ' '; 6418 sep = ifsset() ? (unsigned char)(ifsval()[0]) : ' ';
6420 if (quotes && (SIT(sep, syntax) == CCTL || SIT(sep, syntax) == CBACK)) 6419 if (quotes && (SIT(sep, syntax) == CCTL || SIT(sep, syntax) == CBACK))
6421 sepq = 1; 6420 sepq = 1;
6422 param: 6421 param:
@@ -6634,7 +6633,7 @@ evalvar(char *p, int flags, struct strlist *var_str_list)
6634 if (subtype != VSNORMAL) { /* skip to end of alternative */ 6633 if (subtype != VSNORMAL) { /* skip to end of alternative */
6635 int nesting = 1; 6634 int nesting = 1;
6636 for (;;) { 6635 for (;;) {
6637 char c = *p++; 6636 unsigned char c = *p++;
6638 if (c == CTLESC) 6637 if (c == CTLESC)
6639 p++; 6638 p++;
6640 else if (c == CTLBACKQ || c == (CTLBACKQ|CTLQUOTE)) { 6639 else if (c == CTLBACKQ || c == (CTLBACKQ|CTLQUOTE)) {
@@ -6682,7 +6681,7 @@ ifsbreakup(char *string, struct arglist *arglist)
6682 ifsspc = 0; 6681 ifsspc = 0;
6683 while (p < string + ifsp->endoff) { 6682 while (p < string + ifsp->endoff) {
6684 q = p; 6683 q = p;
6685 if (*p == CTLESC) 6684 if ((unsigned char)*p == CTLESC)
6686 p++; 6685 p++;
6687 if (!strchr(ifs, *p)) { 6686 if (!strchr(ifs, *p)) {
6688 p++; 6687 p++;
@@ -6708,7 +6707,7 @@ ifsbreakup(char *string, struct arglist *arglist)
6708 break; 6707 break;
6709 } 6708 }
6710 q = p; 6709 q = p;
6711 if (*p == CTLESC) 6710 if ((unsigned char)*p == CTLESC)
6712 p++; 6711 p++;
6713 if (strchr(ifs, *p) == NULL) { 6712 if (strchr(ifs, *p) == NULL) {
6714 p = q; 6713 p = q;
@@ -9434,12 +9433,6 @@ preadfd(void)
9434 */ 9433 */
9435//#define pgetc_debug(...) bb_error_msg(__VA_ARGS__) 9434//#define pgetc_debug(...) bb_error_msg(__VA_ARGS__)
9436#define pgetc_debug(...) ((void)0) 9435#define pgetc_debug(...) ((void)0)
9437/*
9438 * NB: due to SIT(c) internals (syntax_index_table[] vector),
9439 * pgetc() and related functions must return chars SIGN-EXTENDED into ints,
9440 * not zero-extended. Seems fragile to me. Affects only !USE_SIT_FUNCTION case,
9441 * so we can fix it by ditching !USE_SIT_FUNCTION if Unicode requires that.
9442 */
9443static int 9436static int
9444preadbuffer(void) 9437preadbuffer(void)
9445{ 9438{
@@ -9540,12 +9533,12 @@ preadbuffer(void)
9540 g_parsefile->left_in_line, 9533 g_parsefile->left_in_line,
9541 g_parsefile->next_to_pgetc, 9534 g_parsefile->next_to_pgetc,
9542 g_parsefile->next_to_pgetc); 9535 g_parsefile->next_to_pgetc);
9543 return signed_char2int(*g_parsefile->next_to_pgetc++); 9536 return (unsigned char)*g_parsefile->next_to_pgetc++;
9544} 9537}
9545 9538
9546#define pgetc_as_macro() \ 9539#define pgetc_as_macro() \
9547 (--g_parsefile->left_in_line >= 0 \ 9540 (--g_parsefile->left_in_line >= 0 \
9548 ? signed_char2int(*g_parsefile->next_to_pgetc++) \ 9541 ? (unsigned char)*g_parsefile->next_to_pgetc++ \
9549 : preadbuffer() \ 9542 : preadbuffer() \
9550 ) 9543 )
9551 9544
@@ -10431,16 +10424,14 @@ fixredir(union node *n, const char *text, int err)
10431static int 10424static int
10432noexpand(const char *text) 10425noexpand(const char *text)
10433{ 10426{
10434 const char *p; 10427 unsigned char c;
10435 char c;
10436 10428
10437 p = text; 10429 while ((c = *text++) != '\0') {
10438 while ((c = *p++) != '\0') {
10439 if (c == CTLQUOTEMARK) 10430 if (c == CTLQUOTEMARK)
10440 continue; 10431 continue;
10441 if (c == CTLESC) 10432 if (c == CTLESC)
10442 p++; 10433 text++;
10443 else if (SIT((signed char)c, BASESYNTAX) == CCTL) 10434 else if (SIT(c, BASESYNTAX) == CCTL)
10444 return 0; 10435 return 0;
10445 } 10436 }
10446 return 1; 10437 return 1;
@@ -10825,7 +10816,7 @@ static int decode_dollar_squote(void)
10825 * If eofmark is NULL, read a word or a redirection symbol. If eofmark 10816 * If eofmark is NULL, read a word or a redirection symbol. If eofmark
10826 * is not NULL, read a here document. In the latter case, eofmark is the 10817 * is not NULL, read a here document. In the latter case, eofmark is the
10827 * word which marks the end of the document and striptabs is true if 10818 * word which marks the end of the document and striptabs is true if
10828 * leading tabs should be stripped from the document. The argument firstc 10819 * leading tabs should be stripped from the document. The argument c
10829 * is the first character of the input token or document. 10820 * is the first character of the input token or document.
10830 * 10821 *
10831 * Because C does not have internal subroutines, I have simulated them 10822 * Because C does not have internal subroutines, I have simulated them
@@ -10839,10 +10830,10 @@ static int decode_dollar_squote(void)
10839#define PARSEBACKQNEW() {oldstyle = 0; goto parsebackq; parsebackq_newreturn:;} 10830#define PARSEBACKQNEW() {oldstyle = 0; goto parsebackq; parsebackq_newreturn:;}
10840#define PARSEARITH() {goto parsearith; parsearith_return:;} 10831#define PARSEARITH() {goto parsearith; parsearith_return:;}
10841static int 10832static int
10842readtoken1(int firstc, int syntax, char *eofmark, int striptabs) 10833readtoken1(int c, int syntax, char *eofmark, int striptabs)
10843{ 10834{
10844 /* NB: syntax parameter fits into smallint */ 10835 /* NB: syntax parameter fits into smallint */
10845 int c = firstc; 10836 /* c parameter is an unsigned char or PEOF or PEOA */
10846 char *out; 10837 char *out;
10847 int len; 10838 int len;
10848 char line[EOFMARKLEN + 1]; 10839 char line[EOFMARKLEN + 1];
@@ -11207,14 +11198,14 @@ parseredir: {
11207 (((unsigned)(c) - 33 < 32) \ 11198 (((unsigned)(c) - 33 < 32) \
11208 && ((0xc1ff920dU >> ((unsigned)(c) - 33)) & 1)) 11199 && ((0xc1ff920dU >> ((unsigned)(c) - 33)) & 1))
11209parsesub: { 11200parsesub: {
11210 int subtype; 11201 unsigned char subtype;
11211 int typeloc; 11202 int typeloc;
11212 int flags; 11203 int flags;
11213 char *p; 11204 char *p;
11214 static const char types[] ALIGN1 = "}-+?="; 11205 static const char types[] ALIGN1 = "}-+?=";
11215 11206
11216 c = pgetc(); 11207 c = pgetc();
11217 if (c <= PEOA_OR_PEOF 11208 if (c > 255 /* PEOA or PEOF */
11218 || (c != '(' && c != '{' && !is_name(c) && !is_special(c)) 11209 || (c != '(' && c != '{' && !is_name(c) && !is_special(c))
11219 ) { 11210 ) {
11220#if ENABLE_ASH_BASH_COMPAT 11211#if ENABLE_ASH_BASH_COMPAT
@@ -11251,11 +11242,11 @@ parsesub: {
11251 } else 11242 } else
11252 subtype = 0; 11243 subtype = 0;
11253 } 11244 }
11254 if (c > PEOA_OR_PEOF && is_name(c)) { 11245 if (c <= 255 /* not PEOA or PEOF */ && is_name(c)) {
11255 do { 11246 do {
11256 STPUTC(c, out); 11247 STPUTC(c, out);
11257 c = pgetc(); 11248 c = pgetc();
11258 } while (c > PEOA_OR_PEOF && is_in_name(c)); 11249 } while (c <= 255 /* not PEOA or PEOF */ && is_in_name(c));
11259 } else if (isdigit(c)) { 11250 } else if (isdigit(c)) {
11260 do { 11251 do {
11261 STPUTC(c, out); 11252 STPUTC(c, out);
@@ -11317,7 +11308,7 @@ parsesub: {
11317 } 11308 }
11318 if (dblquote || arinest) 11309 if (dblquote || arinest)
11319 flags |= VSQUOTE; 11310 flags |= VSQUOTE;
11320 *((char *)stackblock() + typeloc) = subtype | flags; 11311 ((unsigned char *)stackblock())[typeloc] = subtype | flags;
11321 if (subtype != VSNORMAL) { 11312 if (subtype != VSNORMAL) {
11322 varnest++; 11313 varnest++;
11323 if (dblquote || arinest) { 11314 if (dblquote || arinest) {
@@ -11401,7 +11392,7 @@ parsebackq: {
11401 if (pc != '\\' && pc != '`' && pc != '$' 11392 if (pc != '\\' && pc != '`' && pc != '$'
11402 && (!dblquote || pc != '"')) 11393 && (!dblquote || pc != '"'))
11403 STPUTC('\\', pout); 11394 STPUTC('\\', pout);
11404 if (pc > PEOA_OR_PEOF) { 11395 if (pc <= 255 /* not PEOA or PEOF */) {
11405 break; 11396 break;
11406 } 11397 }
11407 /* fall through */ 11398 /* fall through */
@@ -13056,6 +13047,10 @@ init(void)
13056 13047
13057 /* from trap.c: */ 13048 /* from trap.c: */
13058 signal(SIGCHLD, SIG_DFL); 13049 signal(SIGCHLD, SIG_DFL);
13050 /* bash re-enables SIGHUP which is SIG_IGNed on entry.
13051 * Try: "trap '' HUP; bash; echo RET" and type "kill -HUP $$"
13052 */
13053 signal(SIGHUP, SIG_DFL);
13059 13054
13060 /* from var.c: */ 13055 /* from var.c: */
13061 { 13056 {
@@ -13311,7 +13306,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
13311 } 13306 }
13312 13307
13313 if (sflag || minusc == NULL) { 13308 if (sflag || minusc == NULL) {
13314#if MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY 13309#if defined MAX_HISTORY && MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY
13315 if (iflag) { 13310 if (iflag) {
13316 const char *hp = lookupvar("HISTFILE"); 13311 const char *hp = lookupvar("HISTFILE");
13317 if (hp) 13312 if (hp)
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
index 0db99ab21..5fb27cf1e 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -47,4 +47,21 @@ testing "awk NF in BEGIN" \
47 ":0::::\n" \ 47 ":0::::\n" \
48 "" "" 48 "" ""
49 49
50prg='
51function b(tmp) {
52 tmp = 0;
53 print "" tmp; #this line causes the bug
54 return tmp;
55}
56function c(tmpc) {
57 tmpc = b(); return tmpc;
58}
59BEGIN {
60 print (c() ? "string" : "number");
61}'
62testing "awk string cast (bug 725)" \
63 "awk '$prg'" \
64 "0\nnumber\n" \
65 "" ""
66
50exit $FAILCOUNT 67exit $FAILCOUNT
diff --git a/testsuite/grep.tests b/testsuite/grep.tests
index 7e3dff0d6..33a237b24 100755
--- a/testsuite/grep.tests
+++ b/testsuite/grep.tests
@@ -90,4 +90,9 @@ testing "grep -E -o prints all matches" \
90 "00:19:3E:00:AA:5E\n00:1D:60:3D:3A:FB\n00:22:43:49:FB:AA\n" \ 90 "00:19:3E:00:AA:5E\n00:1D:60:3D:3A:FB\n00:22:43:49:FB:AA\n" \
91 "" "00:19:3E:00:AA:5E 00:1D:60:3D:3A:FB 00:22:43:49:FB:AA\n" 91 "" "00:19:3E:00:AA:5E 00:1D:60:3D:3A:FB 00:22:43:49:FB:AA\n"
92 92
93testing "grep -o does not loop forever" \
94 'grep -o "[^/]*$"' \
95 "test\n" \
96 "" "/var/test\n"
97
93exit $FAILCOUNT 98exit $FAILCOUNT
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 56c32e126..7784681a0 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1958,6 +1958,7 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
1958 1958
1959 // If we're mounting all 1959 // If we're mounting all
1960 } else { 1960 } else {
1961 struct mntent *mp;
1961 // No, mount -a won't mount anything, 1962 // No, mount -a won't mount anything,
1962 // even user mounts, for mere humans 1963 // even user mounts, for mere humans
1963 if (nonroot) 1964 if (nonroot)
@@ -1985,10 +1986,25 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
1985 // NFS mounts want this to be xrealloc-able 1986 // NFS mounts want this to be xrealloc-able
1986 mtcur->mnt_opts = xstrdup(mtcur->mnt_opts); 1987 mtcur->mnt_opts = xstrdup(mtcur->mnt_opts);
1987 1988
1988 // Mount this thing 1989 // If nothing is mounted on this directory...
1989 if (singlemount(mtcur, 1)) { 1990 // (otherwise repeated "mount -a" mounts everything again)
1990 // Count number of failed mounts 1991 mp = find_mount_point(mtcur->mnt_dir, /*subdir_too:*/ 0);
1991 rc++; 1992 // We do not check fsname match of found mount point -
1993 // "/" may have fsname of "/dev/root" while fstab
1994 // says "/dev/something_else".
1995 if (mp) {
1996 if (verbose) {
1997 bb_error_msg("according to %s, "
1998 "%s is already mounted on %s",
1999 bb_path_mtab_file,
2000 mp->mnt_fsname, mp->mnt_dir);
2001 }
2002 } else {
2003 // ...mount this thing
2004 if (singlemount(mtcur, /*ignore_busy:*/ 1)) {
2005 // Count number of failed mounts
2006 rc++;
2007 }
1992 } 2008 }
1993 free(mtcur->mnt_opts); 2009 free(mtcur->mnt_opts);
1994 } 2010 }