git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] grep: make show_line more portable

From
Jay Soffian <jaysoffian@gmail.com>
Date
Mar 9, 2009, 02:22 UTC
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 <benji@silverinsanity.com> 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.
Previous: Junio C HamanoNext: Jay Soffian
Message 3 of 8 in “grep: make show_line more portable”
  1. grep: make show_line more portableBrian Gernhardt, Mar 9, 2009
  2. Junio C HamanoMar 9, 2009
  3. Jay SoffianMar 9, 2009
  4. Jay SoffianMar 9, 2009
  5. Brian GernhardtMar 9, 2009
  6. Junio C HamanoMar 9, 2009
  7. Johannes SchindelinMar 9, 2009
  8. René ScharfeMar 9, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.