Mail Archives: djgpp-workers/2004/03/27/06:45:38
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-workers-bounces using -f
|
Message-ID: | <027a01c413ec$f093e390$0600000a@broadpark.no>
|
From: | "Gisle Vanem" <giva AT bgnett DOT no>
|
To: | "djgpp workers" <djgpp-workers AT delorie DOT com>
|
Subject: | Re: sscanf's return value
|
Date: | Sat, 27 Mar 2004 12:16:24 +0100
|
MIME-Version: | 1.0
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Mailer: | Microsoft Outlook Express 6.00.2800.1158
|
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1165
|
Reply-To: | djgpp-workers AT delorie DOT com
|
Some time since I heared anything on this thread. So I'll assume it's
fixed in the latest snapshot.
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.
My doscanf.c is dated 23 Nov 2003 (from 2.04 beta 1 I believe)
Is there a fixed newer version somewhere?
http://www.ludd.luth.se/~ams/djgpp/cvs/djgpp/src/libc/ansi/stdio/doscan.c
has a date of 24 Nov 2003.
--gv
- Raw text -