Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [bug] Incorrect output from printf '{%-5.s}' 123456789
- X-seq: zsh-workers 38306
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Ryan Wilson <ryan@xxxxxxxxxx>, "zsh-workers@xxxxxxx " <zsh-workers@xxxxxxx>
- Subject: Re: [bug] Incorrect output from printf '{%-5.s}' 123456789
- Date: Thu, 21 Apr 2016 18:16:03 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=8gj9Toh9CLSv8nHhrpRI05PW7vnLE1X/LCtJmjuycR8=; b=Hm+49HKQcobg/NdDzhaj/gpSBKk1wvk2weuvqnl5HvMkZKUZHK0FAyOD/iLuytNDx4 nlg7sIYVDinAXFNOfJO4ma+DmqwotBaD6epFzspdGiwQl7U7Axxx3xTu5w+WCdCEISjk SS8QkWak8ZbRgjUhc+HGvREN8BWV9B8THKaiWYIlQe2aDV7W7kI/nhy8pN9jzL7D9JzF /05w4ilzPQuEAF9H51atxhek4lBHOx3DdHSnNq0NN8jHZJnEFifFbcv25VdiyKbI9VHk HJ/nIb/iPy0xZ+0p/s7Q8P0gRGHUUcYln4DEY4jVlAqK/R0EP9OU9iy4ootVV+xwr4qj l1Ow==
- In-reply-to: <1543ae755d4.11b1ff5d018786.3657412396897406270@enosys.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1543ae755d4.11b1ff5d018786.3657412396897406270@enosys.org>
On Apr 21, 5:21pm, Ryan Wilson wrote:
} Subject: [bug] Incorrect output from printf '{%-5.s}' 123456789
}
} It appears that zsh doesn't handle the precision specifier for %s
} correctly in the printf builtin:
}
} % builtin printf '{%-5.s}' 123456789
} {123456789}
Well, hrm.
diff --git a/Src/builtin.c b/Src/builtin.c
index 4c8fbcd..ad01ad4 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4736,7 +4736,8 @@ bin_print(char *name, char **args, Options ops, int func)
} else if (idigit(*c)) {
prec = strtoul(c, &endptr, 0);
c = endptr;
- }
+ } else
+ prec = 0;
if (prec >= 0) *d++ = '.', *d++ = '*';
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author