[uClibc]Unexpected behaviour of sscanf

Marko Ebert Marko.Ebert at email.si
Fri May 10 00:06:01 UTC 2002


> If there are scanf problems, I'm not surprised.  When the new stdio
> implementation went in, I did just enough to get scanf working as I
> was/am planning a complete rewrite.


:o)


> I will have very limitted access to the internet until Tuesday.  I'll
> be happy to look into the scanf issues then.
> 
> Manuel


actually, I learned something new today: while (something) {} actually 
checks the 'something' twice and not just once (beats me why)... I 
always thought it did it only once, but since I couldn't find anything 
else that could've caused the prob I came up with this:

--- CVSuClibc/libc/stdio/scanf.c	Mon Apr  1 17:16:54 2002
+++ myuClibc/libc/stdio/scanf.c	Fri May 10 01:52:09 2002
@@ -346,9 +346,11 @@
  	 
			goto nextfmt;
  	 
		}
  	 
		if (p-spec > 3) { /* skip white space if not c or [ */
- 
				while (isspace(scan_getc_nw(&sc)))
- 
					{}
+ 
				do {
+ 
				   cc=scan_getc_nw(&sc);
+ 
				} while (isspace(cc));
  	 
			scan_ungetc(&sc);
+ 
	                        cc=0;
  	 
		}
  	 
		if (p-spec < 5) { /* [,c,s - string conversions */
  	 
			invert = 0;

please do check it, 'cause I'm not sure I didn't break something else 
(though I think not) by using the cc variable.

Cheers

/M




More information about the uClibc mailing list