mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-09-28 06:49:49 +02:00
zero %n value when reusing printf format (16122)
This commit is contained in:
parent
acd69a7ba3
commit
c1441714b5
@ -1,3 +1,8 @@
|
||||
2001-10-23 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* 16122: Src/builtin.c, Test/B03print.ztst: only count value
|
||||
returned by %n in printf since last format reuse
|
||||
|
||||
2001-10-22 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 16033: Pavel Roskin <proski@gnu.org>:
|
||||
|
@ -2897,7 +2897,7 @@ bin_print(char *name, char **args, char *ops, int func)
|
||||
int flags[5], *len;
|
||||
char *start, *endptr, *c, *d, *flag, spec[11], *fmt = NULL;
|
||||
char **first, *curarg, *flagch = "0+- #", save, nullstr = '\0';
|
||||
zlong count = 0;
|
||||
zlong count;
|
||||
FILE *fout = stdout;
|
||||
|
||||
mnumber mnumval;
|
||||
@ -3096,6 +3096,7 @@ bin_print(char *name, char **args, char *ops, int func)
|
||||
/* printf style output */
|
||||
*spec='%';
|
||||
do {
|
||||
count = 0;
|
||||
if (maxarg) {
|
||||
first += maxarg;
|
||||
argc -= maxarg;
|
||||
|
@ -144,6 +144,11 @@
|
||||
>two b:0x2%
|
||||
>three c:0x3%
|
||||
|
||||
printf '%d%n' 123 val val val > /dev/null
|
||||
printf '%d\n' val
|
||||
0:%n count zeroed on format reuse
|
||||
>1
|
||||
|
||||
# this should fill spec string with '%0+- #*.*d\0' - 11 characters
|
||||
printf '%1$0+- #-08.5dx\n' 123
|
||||
0:maximal length format specification
|
||||
|
Loading…
Reference in New Issue
Block a user