From owner-freebsd-hackers@FreeBSD.ORG Sat Apr 30 22:53:56 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D232106564A for ; Sat, 30 Apr 2011 22:53:56 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (unknown [IPv6:2001:44b8:7c07:5581:266:e1ff:fe0c:8f16]) by mx1.freebsd.org (Postfix) with ESMTP id 257A68FC1C for ; Sat, 30 Apr 2011 22:53:54 +0000 (UTC) Received: from ur.dons.net.au (ppp208-121.lns1.adl2.internode.on.net [203.122.208.121] (may be forged)) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id p3UMrpDT087130 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 1 May 2011 08:23:52 +0930 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=iso-8859-1 From: "Daniel O'Connor" In-Reply-To: Date: Sun, 1 May 2011 08:23:50 +0930 Content-Transfer-Encoding: quoted-printable Message-Id: <6ACFC545-73B5-49FA-A97F-BC500F9AFE40@gsoft.com.au> References: To: =?iso-8859-1?Q?Martin_M=F6ller?= X-Mailer: Apple Mail (2.1084) X-Spam-Score: -0.272 () BAYES_00,RDNS_NONE X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: freebsd-hackers@freebsd.org Subject: Re: [LIBC] Modfied Version of sscanf X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2011 22:53:56 -0000 On 01/05/2011, at 2:14, Martin M=F6ller wrote: > outputs total garbage on my FreeBSD-7.0-RELEASE #0 amd64. > Is there already a way to do this or should we release a new version = of > sscanf, e.g. called sscanfWS. >=20 > This modified version would output: Test 2->Test 3. I think it does what it should.. %s is supposed to stop at whitespace. You probably really want.. #include #include #include int main(int argc, char **argv) { char name [20], value [20]; int i; i =3D sscanf("Test 2->Test 3", "%[^-]->%[^-]", name, value); printf("%d %s->%s\n", i, name, value); exit(0); } -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C