www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2004/03/31/09:15:31

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Sybari-Trust: a9fcc20e 2c4885b5 e7b6ff2a 00000138
From: Martin Stromberg <Martin DOT Stromberg AT epl DOT ericsson DOT se>
Message-Id: <200403311413.i2VEDwM09515@lws256.emw.erisoft.se>
Subject: Re: sscanf's return value
To: djgpp-workers AT delorie DOT com
Date: Wed, 31 Mar 2004 16:13:58 +0200 (MEST)
In-Reply-To: <027a01c413ec$f093e390$0600000a@broadpark.no> from "Gisle Vanem" at Mar 27, 2004 12:16:24 PM
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
X-OriginalArrivalTime: 31 Mar 2004 14:14:00.0155 (UTC) FILETIME=[69A2AAB0:01C4172A]
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Some time since I heared anything on this thread. So I'll assume it's
> fixed in the latest snapshot.

Not to my knowledge.

> Otherwise I have this sscanf() bug (?) that's causing me trouble.
> Example:
> 
> #include <stdio.h>
> #include <stdlib.h>
> int main (int argc, char **argv)
> {
>   int  rc;
>   char *url = argc > 1 ? argv[1] : "";
>   char proto[64] = "";
>   char host[512] = "";
>   char path[512] = "";
> 
>   rc = sscanf (url, "%64[^:]://%512[^/?]%512s",
>                proto, host, path);
>   printf ("sscanf(): %d, proto `%s', host `%s', path `%s'\n",
>           rc, proto, host, path);
>   return (0);
> }
> ----------------------
> 
> For "scanf.exe http://host", this prints
> sscanf(): -1, proto `http', host `host', path `'
> 
> I'd expected rc == 2. As djgpp 2.03, HighC and Watcom returns.

Yes, that looks like the same thing that I found. I'll try it with my
patch if/when I find time.

> My doscanf.c is dated 23 Nov 2003 (from 2.04 beta 1 I believe)
> Is there a fixed newer version somewhere?

Apply my patch and verify...

> http://www.ludd.luth.se/~ams/djgpp/cvs/djgpp/src/libc/ansi/stdio/doscan.c
> has a date of 24 Nov 2003.

And as the TIMESTAMP (at the top level) gives a recent date that is
when it was last updated so my correction has not been commited
yet. I'll do that soon (my time permitting).


Right,

						MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019