1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-22 16:20:23 +02:00

45137: zformat: Allow the specifying minimum width and a dot with an empty maximum width.

Before this commit, format specs such as '%5.s' would be printed
literally.  Now, they are treated as equivalent to '%5s'.

The '.' character is not allowed to be used in specs, so there is no
incompatibility.
This commit is contained in:
Daniel Shahaf 2019-12-24 18:25:09 +00:00
parent 8e0253af02
commit 525faae549
3 changed files with 7 additions and 2 deletions

View file

@ -797,8 +797,7 @@ static char *zformat_substring(char* instr, char **specs, char **outp,
if ((*s == '.' || testit) && idigit(s[1])) {
for (max = 0, s++; idigit(*s); s++)
max = (max * 10) + (int) STOUC(*s) - '0';
}
else if (testit)
} else if (*s == '.' || testit)
s++;
if (testit && STOUC(*s)) {