about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-01-04 15:41:21 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-01-04 15:41:21 +0000
commitcfbcd2dbe0ddcb18d8011e20058d1081d33f697a (patch)
treee9507c1f6961816df9ff3ae46b11a2961a3c4015
parentf7476178bc3d0080c1c0fff3f88fe12886f471a1 (diff)
downloadzsh-cfbcd2dbe0ddcb18d8011e20058d1081d33f697a.tar.gz
zsh-cfbcd2dbe0ddcb18d8011e20058d1081d33f697a.tar.xz
zsh-cfbcd2dbe0ddcb18d8011e20058d1081d33f697a.zip
23086: printf should handle octal escapes in the \0NNN form
-rw-r--r--ChangeLog5
-rw-r--r--Src/zsh.h5
-rw-r--r--Test/B03print.ztst4
3 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 600ef77da..1ae2b45c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-04  Peter Stephenson  <pws@csr.com>
+
+	* 20386: Src/zsh.h, Test/B03print.ztst: printf should handle
+	octal escapes in the '\0NNN' form.
+
 2007-01-02  Clint Adams  <clint@zsh.org>
 
 	* 22817: Frank Terbeck: Completion/Debian/Command/_aptitude:
diff --git a/Src/zsh.h b/Src/zsh.h
index 89482e514..48f50e6a1 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1955,7 +1955,8 @@ enum {
 enum {
     /*
      * Handle octal where the first digit is non-zero e.g. \3, \33, \333
-     * \0333 etc. is always handled.
+     * Otherwise \0333 etc. is handled, i.e. one of \0123 or \123 will
+     * work, but not both.
      */
     GETKEY_OCTAL_ESC = (1 << 0),
     /*
@@ -1990,7 +1991,7 @@ enum {
 /* echo builtin */
 #define GETKEYS_ECHO	(GETKEY_BACKSLASH_C)
 /* printf format string */
-#define GETKEYS_PRINTF	(GETKEY_OCTAL_ESC|GETKEY_BACKSLASH_C)
+#define GETKEYS_PRINTF	(GETKEY_BACKSLASH_C)
 /* Full print without -e */
 #define GETKEYS_PRINT	(GETKEY_OCTAL_ESC|GETKEY_BACKSLASH_C|GETKEY_EMACS)
 /* bindkey */
diff --git a/Test/B03print.ztst b/Test/B03print.ztst
index d6dea5a3d..e36e55caa 100644
--- a/Test/B03print.ztst
+++ b/Test/B03print.ztst
@@ -259,3 +259,7 @@
  printf $'%\0'
 1:explicit null after % in format specifier
 ?(eval):printf:1: %: invalid directive
+
+ printf '%b\n' '\0123'
+0:printf handles \0... octal escapes in replacement text
+>S