Date: Thu, 03 Feb 2000 09:34:37 -0600 From: Weiqi Gao Subject: Re: Gawk 3.0.3 print error? To: djgpp AT delorie DOT com Message-id: <3899A00D.1F816639@edwardjones.com> Organization: Edward Jones MIME-version: 1.0 X-Mailer: Mozilla 4.51 [en]C-CCK-MCD (WinNT; U) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT X-Accept-Language: en References: Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > On 2 Feb 2000, Giacomo Cau wrote: > > > > > >gawk "BEGIN{OFMT=\"%012.0f\";print OFMT,1,sprintf(OFMT,1)}" > > > > > > > > %012.0f 1 000000000001 > > > > > > What seems to be the problem, exactly? I don't see anything wrong > > > with this result; that's what I'd expect "%012.0f" to produce. > > > The leading zero > says to pad with zeros, and .0 says no > > > fractional digits. > > > > the problem is not in the "sprintf" but is in the "print 1". > > In fact it seems that OFMT in not used to format numbers. > > No, OFMT *is* used to format numbers: try 1.1 instead of 1, and you > will see it. > > It seems like `print' only uses OFMT for floating point numbers, not > for integers. I don't know if that's a bug, but I don't think there's > anything DJGPP-specific in this behavior. So please post this report > to gnu.utils.bug, where Gawk maintainer(s) will give you a definitive > answer. Please mention there that you are using the DJGPP port, in > case it's important. It might not be GNU awk only either, but there is comp.lang.awk. -- Weiqi Gao weiqigao AT a DOT crl DOT com