source: trunk/essentials/sys-apps/gawk/test/ofmt.awk

Last change on this file was 3076, checked in by bird, 18 years ago

gawk 3.1.5

File size: 1.2 KB
Line 
1# From dragon!knorke.saar.de!florian Wed Jul 16 10:47:27 1997
2# Return-Path: <dragon!knorke.saar.de!florian>
3# Message-ID: <19970716164451.63610@knorke.saar.de>
4# Date: Wed, 16 Jul 1997 16:44:51 +0200
5# From: Florian La Roche <florian@knorke.saar.de>
6# To: bug-gnu-utils@prep.ai.mit.edu
7# CC: arnold@gnu.ai.mit.edu
8# Subject: bug in gawk 3.0.3
9# MIME-Version: 1.0
10# Content-Type: text/plain; charset=us-ascii
11# X-Mailer: Mutt 0.76
12# Status: R
13# Content-Length: 1725
14# X-Lines: 177
15# X-Display-Position: 0
16#
17# I have a problem with gawk 3.0.3 on linux with libc 5.4.33.
18# The memory is corrupted, if I use OFMT = "%.12g".
19# With OFMT = "%.6g" evrything works fine, but I don't have enough
20# digits for the computation.
21#
22# Thanks a lot,
23# Florian La Roche
24#
25# Here is the sample awk-Script together with sample data:
26#
27BEGIN {
28 OFMT = "%.12g"
29 big = 99999999999
30 lowest = big
31 small = 0
32 highest = small
33 dir = ""
34 }
35$0 ~ /^[0-9]+$/ {
36 # some old awks do not think $0 is numeric, so use $1
37 if ($1 < lowest)
38 lowest = $1
39 if ($1 > highest)
40 highest = $1
41 next
42}
43$0 ~ /\/\.:$/ {
44 if (dir != "") {
45 if (highest != small)
46 print dir, highest, lowest
47 else
48 print dir, "-", "-"
49 }
50 dir = substr($0, 1, length($0)-3) # trim off /.:
51 lowest = big
52 highest = small
53}
Note: See TracBrowser for help on using the repository browser.