about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-03-11 22:38:58 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-03-11 22:38:58 +0000
commit43df0a21c0dfa9536b0c8ce816685a6002451f54 (patch)
treebe233c453735348ed7d30f01823317ab1f03b7a2
parentff22b24f1b413cb0f17fa49459b65b5539b666cc (diff)
downloadzsh-43df0a21c0dfa9536b0c8ce816685a6002451f54.tar.gz
zsh-43df0a21c0dfa9536b0c8ce816685a6002451f54.tar.xz
zsh-43df0a21c0dfa9536b0c8ce816685a6002451f54.zip
27785: IFS doesn't have a null in it in POSIX
unposted: note & needs quoting in :s in glob qualifier
-rw-r--r--ChangeLog10
-rw-r--r--Doc/Zsh/expn.yo3
-rw-r--r--Src/init.c3
-rw-r--r--Src/utils.c6
-rw-r--r--Src/zsh.h4
5 files changed, 22 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index d85c25f8e..572a4e826 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-11  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* unposted: Doc/Zsh/expn.yo: note that & needs quoting in :s in
+	glob qualifier.
+
+	* 27785: Src/init.c, Src/utils.c, Src/zsh.h: default IFS in sh
+	and ksh mode doesn't have '\0'.
+
 2010-03-11  Frank Terbeck  <ft@bewatermyfriend.org>
 
 	* Simon Ruderich: 27779: Functions/VCS_Info/vcs_info_printsys,
@@ -12882,5 +12890,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4927 $
+* $Revision: 1.4928 $
 *****************************************************
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index 7e55ff419..52d4cac9e 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -308,6 +308,9 @@ the rightmost `tt(?)' in a context scan can similarly be omitted.  Note
 the same record of the last var(l) and var(r) is maintained across all
 forms of expansion.
 
+Note that if a `tt(&)' is used within glob qualifers an extra backslash
+is needed as a tt(&) is a special character in this case.
+
 If the option tt(HIST_SUBST_PATTERN) is set, var(l) is treated as
 a pattern of the usual form described in
 ifzman(the section FILENAME GENERATION below)\
diff --git a/Src/init.c b/Src/init.c
index aa0dffd6f..c65c4aaad 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -815,7 +815,8 @@ setupvals(void)
 	? ztrdup("+ ") : ztrdup("+%N:%i> ");
     sprompt = ztrdup("zsh: correct '%R' to '%r' [nyae]? ");
 
-    ifs         = ztrdup(DEFAULT_IFS);
+    ifs         = EMULATION(EMULATE_KSH|EMULATE_SH) ?
+	ztrdup(DEFAULT_IFS_SH) : ztrdup(DEFAULT_IFS);
     wordchars   = ztrdup(DEFAULT_WORDCHARS);
     postedit    = ztrdup("");
     zunderscore  = (char *) zalloc(underscorelen = 32);
diff --git a/Src/utils.c b/Src/utils.c
index b5cdc4613..38c820f29 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -3271,7 +3271,8 @@ inittyptab(void)
 	typtab[t0] |= ITOK | IMETA;
     for (t0 = (int)STOUC(Snull); t0 <= (int)STOUC(Nularg); t0++)
 	typtab[t0] |= ITOK | IMETA | INULL;
-    for (s = ifs ? ifs : DEFAULT_IFS; *s; s++) {
+    for (s = ifs ? ifs : EMULATION(EMULATE_KSH|EMULATE_SH) ?
+	ztrdup(DEFAULT_IFS_SH) : ztrdup(DEFAULT_IFS); *s; s++) {
 	int c = STOUC(*s == Meta ? *++s ^ 32 : *s);
 #ifdef MULTIBYTE_SUPPORT
 	if (!isascii(c)) {
@@ -3305,7 +3306,8 @@ inittyptab(void)
     }
 #ifdef MULTIBYTE_SUPPORT
     set_widearray(wordchars, &wordchars_wide);
-    set_widearray(ifs ? ifs : DEFAULT_IFS, &ifs_wide);
+    set_widearray(ifs ? ifs : EMULATION(EMULATE_KSH|EMULATE_SH) ?
+	ztrdup(DEFAULT_IFS_SH) : ztrdup(DEFAULT_IFS), &ifs_wide);
 #endif
     for (s = SPECCHARS; *s; s++)
 	typtab[STOUC(*s)] |= ISPECIAL;
diff --git a/Src/zsh.h b/Src/zsh.h
index c918f7863..df7e251b9 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -127,6 +127,10 @@ struct mathfunc {
 
 #define DEFAULT_IFS	" \t\n\203 "
 
+/* As specified in the standard (POSIX 2008) */
+
+#define DEFAULT_IFS_SH	" \t\n"
+
 /*
  * Character tokens.
  * These should match the characters in ztokens, defined in lex.c