Re: Many error msgs for all user-documents in lout 3.38 (MS Vista + Cygwin)

KHMan <[email protected]>
Newsgroups gmane.comp.type-setting.lout
Message-ID <[email protected]>
Jeff Kingston wrote:
> Could you explain what the issue is?  What is wrong, or ambiguous,
> about %f in a scanf format?  It seems totally normal and unambiguous.

It appears that in Cygwin, the sscanf works in a slightly 
different manner. Possibly, it's a Cygwin newlib bug -- but I'll 
study the newlib sources etc first before risking being flamed on 
the Cygwin list...

When Lout sees "0i":

(1) On gnulibc, since 'i' is not a valid %f character, only '0' is 
converted because conversion stops before the 'i'. "man scanf" 
gives this interpretation.
(2) On newlib (Cygwin), sscanf grabs in a greedy manner, I think, 
and sees '0i', and conversion fails.

Behaviour (2) seems likely wrong versus the man page. I'll look at 
the newlib sources and the POSIX specifications later...

> On Mon, Jan 26, 2009 at 09:17:01PM +0800, KHMan wrote:
>> I'm not really sure if newlib's sscanf is really at fault, because 
>> its behaviour sounds wrong if we use "man scanf", but sounds right 
>> if we use the ISO C draft standard n1256. So it seems all very 
>> ambiguous...
>>
>> -  if( sscanf((char *) str, "%f", &num) != 1 )
>> +  if( sscanf((char *) str, "%31[0-9.]", &conv) != 1)

-- 
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.