TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Paul Edwards
from: Mike Bilow
date: 1995-03-28 10:21:30
subject: 32-bit bink hack

Paul Edwards wrote in a message to Phil Crown:

PC> What's the bug in EMX?  I might run across it and not even notice it,
PC> thinking its in *my* code. :-)

 PE> /* According to my interpretation of ISO/IEC 9899:1990, this
 PE>    program should print "2".  It prints "-1"
instead, under
 PE>    EMX 0.9a. */

 PE> #include 

 PE> int main(void)
 PE> {
 PE>     char buf[50] = "5 6";
 PE>     int x, y;
 PE>     int ret;
 PE>     
 PE>     ret = sscanf(buf, "%d %d p", &x, &y);
 PE>     printf("ret is %d\n", ret);
 PE>     return (0);
 PE> }

I think that EMX is behaving correctly.  If 'p' is not matched exactly,
that is a failure of the input stream, and sscanf() should return EOF.

I checked using Borland C and Watcom C, and both return 2.  Reading the
spec document, however, suggests that the proper return is, in fact, EOF.
 
-- Mike


---
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)
SEEN-BY: 105/42 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407
SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809
@PATH: 323/107 150 3615/50 396/1 270/101 105/103 42 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.