Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jun 2002 11:11:39 +0400
From:      Igor Roboul <igorr@sysadm.stc>
To:        freebsd-current@FreeBSD.ORG
Subject:   Re: error in ncurses in 'make buildworld'
Message-ID:  <20020621071139.GA20615@sysadm.stc>
In-Reply-To: <20020620101611.B55653@dragon.nuxi.com>
References:  <20020619163321.A48809@dragon.nuxi.com> <20020620074657.11859.qmail@web14108.mail.yahoo.com> <20020620092649.GA10310@sysadm.stc> <20020620101611.B55653@dragon.nuxi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 20, 2002 at 10:16:11AM -0700, David O'Brien wrote:
> > I have posted info about awk (which is nawk) incorrectly printing 
> > numbers between 10 and 15. It adds ascii '0' to value. 
> 
> This is *NOT* a fix.  nawk builds world just fine on my systems.
> Of course this leads one to wonder what is different about my systems and
> yours.
I'm trying to figure this too. Look at following program and it's output,
and please tell me what's wrong. It works as expected on -STABLE
and Linux.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int
main(int argc,char**argv)
{
        double a;
        int b;
        char bb[100];

        strcpy(bb,argv[1]);
        printf("%lf\n",strtod(bb,NULL));
        sscanf(bb,"%lf",&a);
        printf("%lf\n",a);
        sscanf(bb,"%f",&a);
        printf("%f\n",a);
        sscanf(bb,"%d",&b);
        printf("%d\n",b);

        return 0;
}

igorr@sysadm~> gcc -Wall qq.c
qq.c: In function `main':
qq.c:16: warning: float format, double arg (arg 3) <--- I have expected this
igorr@sysadm~> ./a.out 123
123.000000
0.124861
0.0<4861	<--- Pay attention 
123

IIRC this worked fine in preGCC3.1 world.

-- 
Igor Roboul, System administrator at Speech Technology Center
http://www.speechpro.com http://www.speechpro.ru


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020621071139.GA20615>