Re: [PHP-DEV] sprintf and strings with NULL byte

2001-04-25 Thread Stig Sæther Bakken
[<[EMAIL PROTECTED]>] > > On Wed, 25 Apr 2001, [EMAIL PROTECTED] wrote: > > > Oh, and I went and fixed this anyway. > > > > That's cool. > > > > > I'd just split that php_formatted_print() function into two parts. One > > > that does the argument handling and one that just does the work like we >

Re: [PHP-DEV] sprintf and strings with NULL byte

2001-04-25 Thread Andrei Zmievski
On Wed, 25 Apr 2001, [EMAIL PROTECTED] wrote: > Well, no, because it is now binary-clean! ;) > > Do you need exact 1:1 parity? It does most of the things that glibc > printf() does. I don't need it right now, just venting it out as a thought for the future.. -Andrei * If Bill Gates had a nick

Re: [PHP-DEV] sprintf and strings with NULL byte

2001-04-25 Thread rasmus
> On Wed, 25 Apr 2001, [EMAIL PROTECTED] wrote: > > Oh, and I went and fixed this anyway. > > That's cool. > > > I'd just split that php_formatted_print() function into two parts. One > > that does the argument handling and one that just does the work like we > > have done with so many other func

Re: [PHP-DEV] sprintf and strings with NULL byte

2001-04-25 Thread Andrei Zmievski
On Wed, 25 Apr 2001, [EMAIL PROTECTED] wrote: > Oh, and I went and fixed this anyway. That's cool. > I'd just split that php_formatted_print() function into two parts. One > that does the argument handling and one that just does the work like we > have done with so many other functions. Yes, w

Re: [PHP-DEV] sprintf and strings with NULL byte

2001-04-25 Thread rasmus
> > As for the %*s issue. We are passing in the length of the string arg in > > the call: > > > > php_sprintf_appendstring(&result, &outpos, &size, > > (*args[argnum])->value.str.val, > > width, precision, padding, > >

Re: [PHP-DEV] sprintf and strings with NULL byte

2001-04-25 Thread Andrei Zmievski
On Wed, 25 Apr 2001, Rasmus Lerdorf wrote: > Don't think so. And it also doesn't work if the format string contains a > null byte because the parsing loop does: > >while (format[inpos]) { ... > > I don't see any reason to not change this to loop over > (*args[0])->value.str.len instead here

Re: [PHP-DEV] sprintf and strings with NULL byte

2001-04-25 Thread rasmus
> Do we have any facilities (in C) for sprintf'ing the strings that may > have NULL byte inside? For example, if name is "foo\0bar", and name_len > is 7, > > sprintf(buf, "name: %*s", name_len, name); > > Does not give the correct result - stops at the first null byte. Don't think so. And

[PHP-DEV] sprintf and strings with NULL byte

2001-04-25 Thread Andrei Zmievski
Do we have any facilities (in C) for sprintf'ing the strings that may have NULL byte inside? For example, if name is "foo\0bar", and name_len is 7, sprintf(buf, "name: %*s", name_len, name); Does not give the correct result - stops at the first null byte. -Andrei "The secret of flying