about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c2
-rw-r--r--Test/B03print.ztst8
3 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 680b43184..e4b3ed77b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-07  Oliver Kiddle  <opk@zsh.org>
+
+	* 35412: Src/builtin.c, Test/B03print.ztst: fix for - flag
+	when formating strings with printf that was broken in 34841
+
 2015-06-06  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* 35350: Completion/Zsh/Command/_fc, Doc/Zsh/builtins.yo,
diff --git a/Src/builtin.c b/Src/builtin.c
index 643b8c61a..a3d847f41 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4518,7 +4518,7 @@ bin_print(char *name, char **args, Options ops, int func)
 			lleft -= chars;
 			ptr += chars;
 		    }
-		    if (width > 0 && flags[2]) width = -width;
+		    if (width > 0 && flags[3]) width = -width;
 		    if (width > 0 && lchars < width)
 		    	count += fprintf(fout, "%*c", width - lchars, ' ');
 		    count += fwrite(b, 1, lbytes, fout);
diff --git a/Test/B03print.ztst b/Test/B03print.ztst
index 54d6350cf..eb79c4ddb 100644
--- a/Test/B03print.ztst
+++ b/Test/B03print.ztst
@@ -169,11 +169,15 @@
 0:%n count zeroed on format reuse
 >1
 
-# this may fill spec string with '%0+- #*.*lld\0' - 13 characters
- printf '%1$0+- #-08.5dx\n' 123
+# this may fill spec string with '%0'+- #*.*lld\0' - 14 characters
+ printf '%1$0'"'+- #-08.5dx\n" 123
 0:maximal length format specification
 >+00123  x
 
+ printf "x:%-20s:y\n" fubar
+0:left-justification of string
+>x:fubar               :y
+
  printf '%*smorning\n' -5 good
 0:negative width specified
 >good morning