summaryrefslogtreecommitdiff
path: root/Src/Modules/zutil.c
diff options
context:
space:
mode:
authorDaniel Shahaf <danielsh@apache.org>2020-03-07 21:50:46 +0000
committerDaniel Shahaf <danielsh@apache.org>2020-03-07 21:50:46 +0000
commitb5f05b29ba3d8884cdcb344fd6e5f62aeaa9a3fc (patch)
tree7142dec586d8f1fb3b9333ff50d6e1083a7b7460 /Src/Modules/zutil.c
parentdd50f125b5eb65896642d2ff664adefd33f1004c (diff)
parent4ce0cff5e91608598adf4a72318fc868681e398d (diff)
downloadzsh-b5f05b29ba3d8884cdcb344fd6e5f62aeaa9a3fc.tar.gz
zsh-b5f05b29ba3d8884cdcb344fd6e5f62aeaa9a3fc.zip
Merge remote-tracking branch 'origin/5.9'
* origin/5.9: unposted: Move a new incompatibility notice. unposted: Fix trailing whitespace in test expectations. 45342: Add tests for interaction between autoloadable parameters and module loading. 45313: _git: Support completion from outside of a worktree when --git-dir/--work-tree are specified on the command line 45304: Do execute the always block even when the try/always block itself is the last command. 45292: D02glob: Add regression test for macOS stat(2) misbehaviour 45291: A glob with a trailing slash will now match unreadable/unexecutable directories. 45288: _git: Complete bisect/new as well as bisect/bad. 45246: Make --disable-multibyte warn, since the test suite fails in that configuration. 45213: Make --enable-gdbm default to false, rather than default to true with an unavoidable warning. unposted (follow-up to 45131): Extra testing by Mikael 45137: zformat: Allow the specifying minimum width and a dot with an empty maximum width. 45138: Add zformat unit tests. 45131: Make a function that redefines itself preserve its tracedness.
Diffstat (limited to 'Src/Modules/zutil.c')
-rw-r--r--Src/Modules/zutil.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c
index 24659cb16..7d9bf05d6 100644
--- a/Src/Modules/zutil.c
+++ b/Src/Modules/zutil.c
@@ -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)) {
@@ -913,13 +912,13 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
switch (opt) {
case 'f':
{
- char **ap, *specs[256], *out;
+ char **ap, *specs[256] = {0}, *out;
int olen, oused = 0;
- memset(specs, 0, 256 * sizeof(char *));
-
specs['%'] = "%";
specs[')'] = ")";
+
+ /* Parse the specs in argv. */
for (ap = args + 2; *ap; ap++) {
if (!ap[0][0] || ap[0][0] == '-' || ap[0][0] == '.' ||
idigit(ap[0][0]) || ap[0][1] != ':') {