From: Jay Soffian Date: Mon, 09 Mar 2009 02:22:07 GMT Subject: Re: [PATCH] grep: make show_line more portable Message-ID: <76718490903081922p105ebf79vb0bf06989413887c@mail.gmail.com> In-Reply-To: <1236561326-1231-1-git-send-email-benji@silverinsanity.com> On Sun, Mar 8, 2009 at 9:15 PM, Brian Gernhardt wrote: > On OS X the printf specifier "%.0s" outputs the entire string instead > of 0 characters as POSIX states. Does not reproduce for me: $ cat foo.c && gcc -m64 foo.c -o foo32 && gcc foo.c -o foo64 && file foo32 foo64 && ./foo32 && ./foo64 #include "stdio.h" #include "stdlib.h" main() { printf("1 '%.0s'\n", "foobar"); printf("2 '%.*s'\n", 0, "foobar"); exit(0); } foo32: Mach-O 64-bit executable x86_64 foo64: Mach-O executable i386 1 '' 2 '' 1 '' 2 '' OS X 10.5.6 (Darwin 9.6.0). i686-apple-darwin9-gcc-4.0.1. Same linkage for both: /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3) j.