[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] Plans to update scanf().
From: |
Dmitry K. |
Subject: |
Re: [avr-libc-dev] Plans to update scanf(). |
Date: |
Mon, 18 Feb 2008 08:31:42 +1000 |
User-agent: |
KMail/1.5 |
On Monday 18 February 2008 04:13, Weddington, Eric wrote:
> Can you make sure the avr-libc bug #19079 gets fixed?:
> https://savannah.nongnu.org/bugs/?19079
>
> Frederic Nadeau was supposed to commit his patch, but hasn't done so yet.
Yes, it is fixed.
I have reproduce the bug example as:
/* bug #19079: sscanf %s eats 1 char too much
$Id$ */
#include <stdio.h>
#include <string.h>
int main ()
{
char wsp_N[10];
char wsp_E[11];
int fixva = 0;
int nr_sat = 0;
char s[] = "$GP,194000.00,5001.4934,N,01954.5390,E,0,02,2.9";
int nrconv;
nrconv = sscanf (s, "$GP,%*u.%*u,%9s,N,%10s,E,%i,%i,%*s",
wsp_N, wsp_E, &fixva, &nr_sat);
if (nrconv != 4) return __LINE__;
if (strcmp (wsp_N, "5001.4934")) return __LINE__;
if (strcmp (wsp_E, "01954.5390")) return __LINE__;
if (fixva != 0) return __LINE__;
if (nr_sat != 2) return __LINE__;
return 0;
}
Dmitry.