userland: add archive tools and pinned GoAWK, esbuild, and QuickJS

This commit is contained in:
2026-11-07 10:56:29 +00:00
parent 7e7e49bfa2
commit d79b2bc2e1
1798 changed files with 562969 additions and 1 deletions
+15
View File
@@ -0,0 +1,15 @@
# addcomma - put commas in numbers
# input: a number per line
# output: the input number followed by
# the number with commas and two decimal places
{ printf("%-12s %20s\n", $0, addcomma($0)) }
function addcomma(x, num) {
if (x < 0)
return "-" addcomma(-x)
num = sprintf("%.2f", x) # num is dddddd.dd
while (num ~ /[0-9][0-9][0-9][0-9]/)
sub(/[0-9][0-9][0-9][,.]/, ",&", num)
return num
}
+7
View File
@@ -0,0 +1,7 @@
0
-1
-12.34
12345
-1234567.89
-123.
-123456
+7
View File
@@ -0,0 +1,7 @@
0 0.00
-1 -1.00
-12.34 -12.34
12345 12,345.00
-1234567.89 -1,234,567.89
-123. -123.00
-123456 -123,456.00
+1
View File
@@ -0,0 +1 @@
{ gsub(/^[ ]*/, "", $0) ; print }
+1
View File
@@ -0,0 +1 @@
This is a test, this is only a test.
+1
View File
@@ -0,0 +1 @@
This is a test, this is only a test.
+33
View File
@@ -0,0 +1,33 @@
BEGIN { RS = "" }
{
if (/^A/)
print "ok"
else
print "not ok"
if (/B$/)
print "not ok"
else
print "ok"
if (/^C/)
print "not ok"
else
print "ok"
if (/D$/)
print "not ok"
else
print "ok"
if (/^E/)
print "not ok"
else
print "ok"
if (/F$/)
print "ok"
else
print "not ok"
}
+3
View File
@@ -0,0 +1,3 @@
A line1 B
C line2 D
E line3 F
+6
View File
@@ -0,0 +1,6 @@
ok
ok
ok
ok
ok
ok
+14
View File
@@ -0,0 +1,14 @@
BEGIN {
argn = " argument" (ARGC > 1 ? "s" : "")
are = ARGC > 1 ? "are" : "is"
print "here we have " ARGC argn
print "which " are
for (x = 0; x < ARGC; x++)
print "\t", ARGV[x]
print "Environment variable TEST=" ENVIRON["TEST"]
print "and the current input file is called \"" FILENAME "\""
}
FNR == 1 {
print "in main loop, this input file is known as \"" FILENAME "\""
}
+1
View File
@@ -0,0 +1 @@
this is a simple test file
+6
View File
@@ -0,0 +1,6 @@
here we have 1 argument
which is
Environment variable TEST=
and the current input file is called ""
in main loop, this input file is known as "-"
+19
View File
@@ -0,0 +1,19 @@
BEGIN {
# initialize cint arrays
pos[0] = 0
posout[0] = 0
split("00000779770060", f) # f[1] is a strnum
pos[f[1]] = 1 # subscripts must be strings!
for (x in pos) {
# if x is a strnum, then the
# x != 0 test may convert it to an integral NUMBER,
# and we might lose the unusual string representation
# if the cint code is not careful to recognize that this is
# actually a string
if (x != 0)
posout[x] = pos[x]
}
# which array element is populated?
print posout[779770060]
print posout["00000779770060"]
}
+2
View File
@@ -0,0 +1,2 @@
1
+21
View File
@@ -0,0 +1,21 @@
#
# Test program from:
#
# Date: Tue, 21 Feb 95 16:09:29 EST
# From: emory!blackhawk.com!aaron (Aaron Sosnick)
#
BEGIN {
foo[1]=1;
foo[2]=2;
bug1(foo);
}
function bug1(i) {
for (i in foo) {
bug2(i);
delete foo[i];
print i,1,bot[1];
}
}
function bug2(arg) {
bot[arg]=arg;
}
+1
View File
@@ -0,0 +1 @@
parse error at 10:10: can't pass array "foo" as scalar param
+67
View File
@@ -0,0 +1,67 @@
# From spcecdt@armory.com Wed Apr 30 11:08:48 2003
# Return-Path: <spcecdt@armory.com>
# Received: from localhost (skeeve [127.0.0.1])
# by skeeve.com (8.12.5/8.12.5) with ESMTP id h3U7uZWr015489
# for <arnold@localhost>; Wed, 30 Apr 2003 11:08:48 +0300
# Received: from actcom.co.il [192.114.47.1]
# by localhost with POP3 (fetchmail-5.9.0)
# for arnold@localhost (single-drop); Wed, 30 Apr 2003 11:08:48 +0300 (IDT)
# Received: by actcom.co.il (mbox arobbins)
# (with Cubic Circle's cucipop (v1.31 1998/05/13) Wed Apr 30 11:05:01 2003)
# X-From_: spcecdt@armory.com Wed Apr 30 04:06:46 2003
# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP
# (8.11.6/actcom-0.2) id h3U16iv04111 for <arobbins@actcom.co.il>;
# Wed, 30 Apr 2003 04:06:45 +0300 (EET DST)
# (rfc931-sender: mail.actcom.co.il [192.114.47.13])
# Received: from f7.net (consort.superb.net [209.61.216.22])
# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h3U16nEv009589
# for <arobbins@actcom.co.il>; Wed, 30 Apr 2003 04:06:50 +0300
# Received: from fencepost.gnu.org (fencepost.gnu.org [199.232.76.164])
# by f7.net (8.11.7/8.11.6) with ESMTP id h3U16gj29182
# for <arnold@skeeve.com>; Tue, 29 Apr 2003 21:06:42 -0400
# Received: from monty-python.gnu.org ([199.232.76.173])
# by fencepost.gnu.org with esmtp (Exim 4.10)
# id 19Ag3W-00029w-00
# for bug-gawk@gnu.org; Tue, 29 Apr 2003 21:06:42 -0400
# Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13)
# id 19Ag1V-0001AN-00
# for bug-gawk@gnu.org; Tue, 29 Apr 2003 21:04:39 -0400
# Received: from deepthought.armory.com ([192.122.209.42] helo=armory.com)
# by monty-python.gnu.org with smtp (Exim 4.10.13)
# id 19Ag1V-0001A3-00
# for bug-gawk@gnu.org; Tue, 29 Apr 2003 21:04:37 -0400
# Date: Tue, 29 Apr 2003 18:04:35 -0700
# From: "John H. DuBois III" <spcecdt@armory.com>
# To: bug-gawk@gnu.org
# Subject: gawk 3.1.2a bug
# Message-ID: <20030430010434.GA4278@armory.com>
# Mime-Version: 1.0
# Content-Type: text/plain; charset=us-ascii
# Content-Disposition: inline
# User-Agent: Mutt/1.3.28i
# X-Www: http://www.armory.com./~spcecdt/
# Sender: spcecdt@armory.com
# X-Spam-Status: No, hits=-7.2 required=5.0
# tests=SIGNATURE_SHORT_DENSE,SPAM_PHRASE_00_01,USER_AGENT,
# USER_AGENT_MUTT
# version=2.41
# X-Spam-Level:
# X-SpamBouncer: 1.4 (10/07/01)
# X-SBClass: OK
# Status: RO
#
# gawk-3.1.2a 'BEGIN {foo(bar)};function foo(baz){split("x",baz)}'
# gawk-3.1.2a: cmd. line:1: fatal: split: second argument is not an array
#
# John
# --
# John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/
#
BEGIN {
foo(bar)
}
function foo(baz)
{
split("x", baz)
}
View File
+56
View File
@@ -0,0 +1,56 @@
# From spcecdt@armory.com Fri May 2 13:24:46 2003
# Return-Path: <spcecdt@armory.com>
# Received: from localhost (skeeve [127.0.0.1])
# by skeeve.com (8.12.5/8.12.5) with ESMTP id h42AChum021950
# for <arnold@localhost>; Fri, 2 May 2003 13:24:46 +0300
# Received: from actcom.co.il [192.114.47.1]
# by localhost with POP3 (fetchmail-5.9.0)
# for arnold@localhost (single-drop); Fri, 02 May 2003 13:24:46 +0300 (IDT)
# Received: by actcom.co.il (mbox arobbins)
# (with Cubic Circle's cucipop (v1.31 1998/05/13) Fri May 2 13:23:37 2003)
# X-From_: spcecdt@armory.com Fri May 2 00:43:51 2003
# Received: from smtp1.actcom.net.il by actcom.co.il with ESMTP
# (8.11.6/actcom-0.2) id h41Lhm500217 for <arobbins@actcom.co.il>;
# Fri, 2 May 2003 00:43:49 +0300 (EET DST)
# (rfc931-sender: lmail.actcom.co.il [192.114.47.13])
# Received: from f7.net (consort.superb.net [209.61.216.22])
# by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h41LiGcO022817
# for <arobbins@actcom.co.il>; Fri, 2 May 2003 00:44:18 +0300
# Received: from armory.com (deepthought.armory.com [192.122.209.42])
# by f7.net (8.11.7/8.11.6) with SMTP id h41Lhj106516
# for <arnold@skeeve.com>; Thu, 1 May 2003 17:43:46 -0400
# Date: Thu, 1 May 2003 14:43:45 -0700
# From: "John H. DuBois III" <spcecdt@armory.com>
# To: Aharon Robbins <arnold@skeeve.com>
# Subject: Re: gawk 3.1.2a bug
# Message-ID: <20030501214345.GA24615@armory.com>
# References: <200305011738.h41Hcg76017565@localhost.localdomain>
# Mime-Version: 1.0
# Content-Type: text/plain; charset=us-ascii
# Content-Disposition: inline
# In-Reply-To: <200305011738.h41Hcg76017565@localhost.localdomain>
# User-Agent: Mutt/1.3.28i
# X-Www: http://www.armory.com./~spcecdt/
# Sender: spcecdt@armory.com
# X-SpamBouncer: 1.4 (10/07/01)
# X-SBClass: OK
# Status: RO
#
# On Thu, May 01, 2003 at 08:38:42PM +0300, Aharon Robbins wrote:
# > > That worked, thanks.
# >
# > Great. Your report motivated me to find everywhere such additional
# > code ought to be needed. I think I did so. --Arnold
#
# Here's another one (perhaps fixed by your additional work):
#
BEGIN { foo(a) }
function foo(a) { bar(a); print "" in a }
function bar(a) { a[""]; }
#
# Prints 1 with gawk-3.1.1; 0 with 3.1.2a.
#
# John
# --
# John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/
#
+1
View File
@@ -0,0 +1 @@
1
+13
View File
@@ -0,0 +1,13 @@
BEGIN { # foo[10] = 0 # put this line in and it will work
test(foo); print foo[1]
test2(foo2); print foo2[1]
}
function test(foo)
{
test2(foo)
}
function test2(bar)
{
bar[1] = 1
}
+2
View File
@@ -0,0 +1,2 @@
1
1
+81
View File
@@ -0,0 +1,81 @@
# From spcecdt@armory.com Thu Jun 14 13:24:32 2001
# Received: from mail.actcom.co.il [192.114.47.13]
# by localhost with POP3 (fetchmail-5.5.0)
# for arnold@localhost (single-drop); Thu, 14 Jun 2001 13:24:32 +0300 (IDT)
# Received: by actcom.co.il (mbox arobbins)
# (with Cubic Circle's cucipop (v1.31 1998/05/13) Thu Jun 14 13:25:13 2001)
# X-From_: spcecdt@armory.com Thu Jun 14 06:34:47 2001
# Received: from lmail.actcom.co.il by actcom.co.il with ESMTP
# (8.9.1a/actcom-0.2) id GAA29661 for <arobbins@actcom.co.il>;
# Thu, 14 Jun 2001 06:34:46 +0300 (EET DST)
# (rfc931-sender: lmail.actcom.co.il [192.114.47.13])
# Received: from billohost.com (www.billohost.com [209.196.35.10])
# by lmail.actcom.co.il (8.11.2/8.11.2) with ESMTP id f5E3YiO27337
# for <arobbins@actcom.co.il>; Thu, 14 Jun 2001 06:34:45 +0300
# Received: from fencepost.gnu.org (we-refuse-to-spy-on-our-users@fencepost.gnu.org [199.232.76.164])
# by billohost.com (8.9.3/8.9.3) with ESMTP id XAA02681
# for <arnold@skeeve.com>; Wed, 13 Jun 2001 23:33:57 -0400
# Received: from deepthought.armory.com ([192.122.209.42])
# by fencepost.gnu.org with smtp (Exim 3.16 #1 (Debian))
# id 15ANu2-00005C-00
# for <bug-gawk@gnu.org>; Wed, 13 Jun 2001 23:34:38 -0400
# Date: Wed, 13 Jun 2001 20:32:42 -0700
# From: "John H. DuBois III" <spcecdt@armory.com>
# To: bug-gawk@gnu.org
# Subject: gawk 3.1.0 bug
# Message-ID: <20010613203242.A29975@armory.com>
# Mime-Version: 1.0
# Content-Type: text/plain; charset=us-ascii
# X-Mailer: Mutt 1.0.1i
# X-Www: http://www.armory.com./~spcecdt/
# Sender: spcecdt@armory.com
# Status: RO
#
# Under SCO OpenServer 5.0.6a using gawk 3.1.0 compiled with gcc 2.95.2, this
# program:
BEGIN {
f1(Procs,b)
print "test"
}
function f1(Procs,a) {
# a[""]
a[""] = "a" # ADR: Give it a value so can trace it
f2()
}
function f2() {
# b[""]
b[""] = "b" # ADR: Give it a value so can trace it
}
# ADR: 1/28/2003: Added this:
BEGIN { for (i in b) printf("b[\"%s\"] = \"%s\"\n", i, b[i]) }
# END ADR added.
# gives:
#
# gawk: ./gtest:5: fatal error: internal error
#
# and dumps core.
#
# gdb gives me this stack backtrace:
#
# #0 0x80019943 in kill () from /usr/lib/libc.so.1
# #1 0x8003e754 in abort () from /usr/lib/libc.so.1
# #2 0x8062a87 in catchsig (sig=0, code=0) at main.c:947
# #3 0x80053a0c in _sigreturn () from /usr/lib/libc.so.1
# #4 0x80023d36 in cleanfree () from /usr/lib/libc.so.1
# #5 0x80023156 in _real_malloc () from /usr/lib/libc.so.1
# #6 0x80023019 in malloc () from /usr/lib/libc.so.1
# #7 0x8053b95 in do_print (tree=0x0) at builtin.c:1336
# #8 0x806b47c in interpret (tree=0x8084ee4) at eval.c:606
# #9 0x806ad8d in interpret (tree=0x8084f0c) at eval.c:384
# #10 0x806ad21 in interpret (tree=0x8084f5c) at eval.c:367
# #11 0x8061d5b in main (argc=4, argv=0x80478ac) at main.c:506
#
# John
# --
# John DuBois spcecdt@armory.com. KC6QKZ/AE http://www.armory.com./~spcecdt/
#
+2
View File
@@ -0,0 +1,2 @@
test
b[""] = "b"
+18
View File
@@ -0,0 +1,18 @@
BEGIN {
foo(a)
for (i in a)
print i, a[i]
}
function foo(b)
{
bar(b)
b[2] = "local"
}
function bar(c)
{
a[3] = "global"
c[1] = "local2"
}
+3
View File
@@ -0,0 +1,3 @@
1 local2
2 local
3 global
+18
View File
@@ -0,0 +1,18 @@
BEGIN {
foo(a)
for (i in a)
print i, a[i]
}
function foo(b)
{
a[1] = "global"
b[2] = "local"
bar(b)
}
function bar(c)
{
c = 12
}
+1
View File
@@ -0,0 +1 @@
parse error at 12:6: can't pass array "b" as scalar param
+17
View File
@@ -0,0 +1,17 @@
BEGIN {
foo(a)
print a
}
function foo(b)
{
a = "global"
b[2] = "local"
# bar(b)
}
function bar(c)
{
c = 12
}
+1
View File
@@ -0,0 +1 @@
parse error at 2:6: can't pass scalar "a" as array param
+17
View File
@@ -0,0 +1,17 @@
BEGIN {
foo(a)
print a
}
function foo(b)
{
b[2] = "local"
a = "global"
# bar(b)
}
function bar(c)
{
c = 12
}
+1
View File
@@ -0,0 +1 @@
parse error at 2:6: can't pass scalar "a" as array param
+16
View File
@@ -0,0 +1,16 @@
BEGIN {
a = 12.153
#print "-- stroring test[a]" > "/dev/stderr" ; fflush("/dev/stderr")
test[a] = "hi"
#print "-- setting CONVFMT" > "/dev/stderr" ; fflush("/dev/stderr")
CONVFMT = "%.0f"
#print "-- setting a" > "/dev/stderr" ; fflush("/dev/stderr")
a = 5
#stopme()
#print "-- starting loop" > "/dev/stderr" ; fflush("/dev/stderr")
for (i in test) {
#print("-- i =", i) > "/dev/stderr" ; fflush("/dev/stderr");
#printf("-- i = <%s>\n", i) > "/dev/stderr" ; fflush("/dev/stderr");
printf ("test[%s] = %s\n", i, test[i])
}
}
+1
View File
@@ -0,0 +1 @@
test[12.153] = hi
+9
View File
@@ -0,0 +1,9 @@
function f(a) {
if (3 in a)
print 7
a = 5
}
BEGIN {
f(arr)
}
+1
View File
@@ -0,0 +1 @@
parse error at 4:2: can't use array "a" as scalar
+10
View File
@@ -0,0 +1,10 @@
function f(a, i) {
for (i in a)
delete a[i]
if (a == 0)
print 7
}
BEGIN {
f(arr)
}
+1
View File
@@ -0,0 +1 @@
parse error at 4:6: can't use array "a" as scalar
+7
View File
@@ -0,0 +1,7 @@
function f(x){
x = 1
}
BEGIN {
f(a)
a[1]
}
+1
View File
@@ -0,0 +1 @@
parse error at 6:2: can't use scalar "a" as array
+6
View File
@@ -0,0 +1,6 @@
function f(x){
x[1] = x
}
BEGIN {
f(a)
}
+1
View File
@@ -0,0 +1 @@
parse error at 2:9: can't use array "x" as scalar
+7
View File
@@ -0,0 +1,7 @@
function f(x){
a
x[1] = 3
}
BEGIN {
f(a)
}
+1
View File
@@ -0,0 +1 @@
parse error at 6:4: can't pass scalar "a" as array param
+6
View File
@@ -0,0 +1,6 @@
function f(x, y){
y[1] = x
}
BEGIN {
f(a, a)
}
+1
View File
@@ -0,0 +1 @@
parse error at 5:7: can't pass scalar "a" as array param
+22
View File
@@ -0,0 +1,22 @@
BEGIN {
f(0, a) # nothing
f(1, a)
}
function f(i, a) {
if (i == 0) return
g(a, a)
pr(a)
}
function g(x, y) {
h(y, x, y)
}
function h(b, c, d) {
b[1] = 1
c[1] = 2 # rewrite
print b[1], d[1]
c[2] = 1
b[2] = 2 # should rewrite
}
function pr(x) {
print x[1], x[2]
}
+2
View File
@@ -0,0 +1,2 @@
2 2
2 2
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/gawk -f
BEGIN {
for (i = 0; i < 100; i++)
func_exec()
}
function func_exec(opaque)
{
func_a(1, opaque) #set additional argument, not expected by fname
}
function func_a(a, b, loc1, loc2)
{
b = 0 #unref Nnull_string
}
View File
+1
View File
@@ -0,0 +1 @@
BEGIN { n = 11 ; foo[n] = n; print (2 <= n) }
+1
View File
@@ -0,0 +1 @@
1
+17
View File
@@ -0,0 +1,17 @@
BEGIN {
a[i] = "null" # i is initially undefined
for (i in a) { # i is null string
print length(i), a[i] # , typeof(i) # 0 null
print (i==0), (i=="") # 1 1 should be 0 1
}
print a[""] # null
print a[0] #
b[$2] = "null also" # $2 is also undefined
for (j in b) {
print length(j), a[j] # , typeof(i) # 0 null
print (j==0), (j=="") # 1 1 should be 0 1
}
print b[""] # null
print b[0] #
}
+8
View File
@@ -0,0 +1,8 @@
0 null
0 1
null
0 null
0 1
null also
+1
View File
@@ -0,0 +1 @@
{ print $3; $4 = "a"; print }
+3
View File
@@ -0,0 +1,3 @@
1 2 3
1
1 2 3 4
+6
View File
@@ -0,0 +1,6 @@
3
1 2 3 a
1 a
3
1 2 3 a
@@ -0,0 +1 @@
{$0 = ++i} 1
+5
View File
@@ -0,0 +1,5 @@
a b c
a b c
a b c
a b c
a b c
+5
View File
@@ -0,0 +1,5 @@
1
2
3
4
5
+1
View File
@@ -0,0 +1 @@
/a\8b/
+1
View File
@@ -0,0 +1 @@
parse error at 1:1: error parsing regexp: invalid escape sequence: `\8`
+4
View File
@@ -0,0 +1,4 @@
{
gsub( "\\\\", "\\\\")
print
}
+1
View File
@@ -0,0 +1 @@
\x\y\z
+1
View File
@@ -0,0 +1 @@
\x\y\z
+1
View File
@@ -0,0 +1 @@
BEGIN { $i++ = 3 ; print i }
+1
View File
@@ -0,0 +1 @@
parse error at 1:9: expected lvalue before =
+6
View File
@@ -0,0 +1,6 @@
$1 == $2 == $3 {
print "Gawk was built incorrectly."
print "Use bison, not byacc or something else!"
print "(Really, why aren't you using the awkgram.c in the distribution?)"
exit 42
}
+1
View File
@@ -0,0 +1 @@
a a 1
+1
View File
@@ -0,0 +1 @@
parse error at 1:10: expected , instead of ==
+6
View File
@@ -0,0 +1,6 @@
BEGIN { f() }
function f( a, b)
{
a = b()
}
+1
View File
@@ -0,0 +1 @@
parse error at 5:6: can't call local variable "b" as function
+1
View File
@@ -0,0 +1 @@
BEGIN { "cat" | getline; print; close("cat") }
+1
View File
@@ -0,0 +1 @@
hi
+1
View File
@@ -0,0 +1 @@
hi
+98
View File
@@ -0,0 +1,98 @@
BEGIN {
print "000800" > "seq"
close("seq")
ARGV[1] = "seq"
ARGC = 2
}
{ printf "%06d", $1 + 1 >"seq";
printf "%06d", $1 + 1 }
# Date: Mon, 20 Jan 1997 15:14:06 -0600 (CST)
# From: Dave Bodenstab <emory!synet.net!imdave>
# To: bug-gnu-utils@prep.ai.mit.edu
# Subject: GNU awk 3.0.2 core dump
# Cc: arnold@gnu.ai.mit.edu
#
# The following program produces a core file on my FreeBSD system:
#
# bash$ echo 000800 >/tmp/seq
# bash$ gawk '{ printf "%06d", $1 + 1 >"/tmp/seq";
# printf "%06d", $1 + 1 }' /tmp/seq
#
# This fragment comes from mgetty+sendfax.
#
# Here is the trace:
#
# Script started on Mon Jan 20 15:09:04 1997
# bash$ gawk --version
# GNU Awk 3.0.2
# Copyright (C) 1989, 1991-1996 Free Software Foundation.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# bash$ gdb gawk
# GDB is free software and you are welcome to distribute copies of it
# under certain conditions; type "show copying" to see the conditions.
# There is absolutely no warranty for GDB; type "show warranty" for details.
# GDB 4.13 (i386-unknown-freebsd),
# Copyright 1994 Free Software Foundation, Inc...
# (gdb) shell echo 000800 >/tmp/seq
# (gdb) r '{ printf "%06d", $1 + 1 >"/tmp/seq"; printf "%06d", $1 + 1 }(gdb) r '{ printf "%06d", $1 + 1 >"/tmp/seq"; printf "%06d", $1 + 1 }' /tmp/seq
# Starting program: /scratch/archive/src/cmd/gnuawk-3.0.2/gawk '{ printf "%06d", $1 + 1 >"/tmp/seq"; printf "%06d", $1 + 1 }' /tmp/seq
#
# Program received signal SIGBUS, Bus error.
# 0xd86f in def_parse_field (up_to=1, buf=0x37704, len=6, fs=0x3b240, rp=0x0,
# set=0xce6c <set_field>, n=0x0) at field.c:391
# 391 sav = *end;
# (gdb) bt
# #0 0xd86f in def_parse_field (up_to=1, buf=0x37704, len=6, fs=0x3b240,
# rp=0x0, set=0xce6c <set_field>, n=0x0) at field.c:391
# #1 0xddb1 in get_field (requested=1, assign=0x0) at field.c:669
# #2 0xc25d in r_get_lhs (ptr=0x3b9b4, assign=0x0) at eval.c:1339
# #3 0x9ab0 in r_tree_eval (tree=0x3b9b4, iscond=0) at eval.c:604
# #4 0xa5f1 in r_tree_eval (tree=0x3b9fc, iscond=0) at eval.c:745
# #5 0x4661 in format_tree (fmt_string=0x3e040 "%06d", n0=0, carg=0x3ba20)
# at builtin.c:620
# #6 0x5beb in do_sprintf (tree=0x3b96c) at builtin.c:809
# #7 0x5cd5 in do_printf (tree=0x3ba8c) at builtin.c:844
# #8 0x9271 in interpret (tree=0x3ba8c) at eval.c:465
# #9 0x8ca3 in interpret (tree=0x3bbd0) at eval.c:308
# #10 0x8c34 in interpret (tree=0x3bc18) at eval.c:292
# #11 0xf069 in do_input () at io.c:312
# #12 0x12ba9 in main (argc=3, argv=0xefbfd538) at main.c:393
# (gdb) l
# 386 *buf += len;
# 387 return nf;
# 388 }
# 389
# 390 /* before doing anything save the char at *end */
# 391 sav = *end;
# 392 /* because it will be destroyed now: */
# 393
# 394 *end = ' '; /* sentinel character */
# 395 for (; nf < up_to; scan++) {
# (gdb) print end
# $1 = 0x804d006 <Error reading address 0x804d006: No such file or directory>
# (gdb) print buf
# $2 = (char **) 0x37704
# (gdb) print *buf
# $3 = 0x804d000 <Error reading address 0x804d000: No such file or directory>
# (gdb) q
# The program is running. Quit anyway (and kill it)? (y or n) y
# bash$ exit
#
# Script done on Mon Jan 20 15:11:07 1997
#
# Dave Bodenstab
# imdave@synet.net
+1
View File
@@ -0,0 +1 @@
000801
+7
View File
@@ -0,0 +1,7 @@
BEGIN {
f = "/no/such/file/1"
print (getline junk < f)
print close(f)
f = "/no/such/file/2"
print close(f)
}
+3
View File
@@ -0,0 +1,3 @@
-1
-1
-1
+9
View File
@@ -0,0 +1,9 @@
BEGIN {
if ("0") print "zero"
if ("") print "null"
if (0) print 0
}
{
if ($0) print $0
if ($1) print $1
}
+4
View File
@@ -0,0 +1,4 @@
0
1
0 1
+4
View File
@@ -0,0 +1,4 @@
zero
1
1
0 1
+165
View File
@@ -0,0 +1,165 @@
# From beebe@math.utah.edu Thu Aug 2 15:35:07 2001
# Received: from mail.actcom.co.il [192.114.47.13]
# by localhost with POP3 (fetchmail-5.7.4)
# for arnold@localhost (single-drop); Thu, 02 Aug 2001 15:35:07 +0300 (IDT)
# Received: by actcom.co.il (mbox arobbins)
# (with Cubic Circle's cucipop (v1.31 1998/05/13) Thu Aug 2 16:02:36 2001)
# X-From_: beebe@sunshine.math.utah.edu Thu Aug 2 15:41:13 2001
# Received: from lmail.actcom.co.il by actcom.co.il with ESMTP
# (8.9.1a/actcom-0.2) id PAA01349 for <arobbins@actcom.co.il>;
# Thu, 2 Aug 2001 15:41:06 +0300 (EET DST)
# (rfc931-sender: mail.actcom.co.il [192.114.47.13])
# Received: from billohost.com (www.billohost.com [209.196.35.10])
# by lmail.actcom.co.il (8.11.2/8.11.2) with ESMTP id f72Cf3I21032
# for <arobbins@actcom.co.il>; Thu, 2 Aug 2001 15:41:05 +0300
# Received: from fencepost.gnu.org (we-refuse-to-spy-on-our-users@fencepost.gnu.org [199.232.76.164])
# by billohost.com (8.9.3/8.9.3) with ESMTP id IAA28585
# for <arnold@skeeve.com>; Thu, 2 Aug 2001 08:34:38 -0400
# Received: from sunshine.math.utah.edu ([128.110.198.2])
# by fencepost.gnu.org with esmtp (Exim 3.22 #1 (Debian))
# id 15SHjG-00036x-00
# for <arnold@gnu.org>; Thu, 02 Aug 2001 08:37:30 -0400
# Received: from suncore.math.utah.edu (IDENT:GsUbUdUYCtFLRE4HvnnvhN4JsjooYcfR@suncore0.math.utah.edu [128.110.198.5])
# by sunshine.math.utah.edu (8.9.3/8.9.3) with ESMTP id GAA00190;
# Thu, 2 Aug 2001 06:37:04 -0600 (MDT)
# Received: (from beebe@localhost)
# by suncore.math.utah.edu (8.9.3/8.9.3) id GAA20469;
# Thu, 2 Aug 2001 06:37:03 -0600 (MDT)
# Date: Thu, 2 Aug 2001 06:37:03 -0600 (MDT)
# From: "Nelson H. F. Beebe" <beebe@math.utah.edu>
# To: arnold@gnu.org
# Cc: beebe@math.utah.edu
# X-US-Mail: "Center for Scientific Computing, Department of Mathematics, 322
# INSCC, University of Utah, 155 S 1400 E RM 233, Salt Lake City, UT
# 84112-0090, USA"
# X-Telephone: +1 801 581 5254
# X-FAX: +1 801 585 1640, +1 801 581 4148
# X-URL: http://www.math.utah.edu/~beebe
# Subject: awk implementations: a bug, or new dark corner?
# Message-ID: <CMM.0.92.0.996755823.beebe@suncore.math.utah.edu>
# Status: RO
#
# Consider the following program:
#
# % cat bug.awk
BEGIN {
split("00/00/00",mdy,"/")
if ((mdy[1] == 0) && (mdy[2] == 0) && (mdy[3] == 0))
{
print "OK: zero strings compare equal to number zero"
exit(0)
}
else
{
print "ERROR: zero strings compare unequal to number zero"
exit(1)
}
}
#
# Here are the awk implementation versions (on Sun Solaris 2.7):
#
# % awk -V
# awk version 19990416
#
# % mawk -W version
# mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
#
# % nawk -V
# awk version 20001115
#
# % gawk --version
# GNU Awk 3.1.10
# ...
#
# Here's what they say about the test program:
#
# foreach f (awk mawk nawk gawk gawk-*)
# echo ======== $f
# $f -f ~/bug.awk
# end
#
# ======== awk
# OK: zero strings compare equal to number zero
# ======== mawk
# OK: zero strings compare equal to number zero
# ======== nawk
# OK: zero strings compare equal to number zero
# ======== gawk
# ERROR: zero strings compare unequal to number zero
# ======== gawk-3.0.0
# OK: zero strings compare equal to number zero
# ======== gawk-3.0.1
# OK: zero strings compare equal to number zero
# ======== gawk-3.0.3
# OK: zero strings compare equal to number zero
# ======== gawk-3.0.4
# OK: zero strings compare equal to number zero
# ======== gawk-3.0.5
# OK: zero strings compare equal to number zero
# ======== gawk-3.0.6
# OK: zero strings compare equal to number zero
# ======== gawk-3.0.60
# OK: zero strings compare equal to number zero
# ======== gawk-3.0.90
# ERROR: zero strings compare unequal to number zero
# ======== gawk-3.0.91
# ERROR: zero strings compare unequal to number zero
# ======== gawk-3.0.92
# ERROR: zero strings compare unequal to number zero
# ======== gawk-3.0.93
# ERROR: zero strings compare unequal to number zero
# ======== gawk-3.0.94
# ERROR: zero strings compare unequal to number zero
# ======== gawk-3.0.95
# ERROR: zero strings compare unequal to number zero
# ======== gawk-3.0.96
# ERROR: zero strings compare unequal to number zero
# ======== gawk-3.0.97
# ERROR: zero strings compare unequal to number zero
# ======== gawk-3.1.0
# ERROR: zero strings compare unequal to number zero
# ======== gawk-3.1.10
# ERROR: zero strings compare unequal to number zero
#
# Identical results were obtained on Apple Rhapsody, Apple Darwin,
# Compaq/DEC Alpha OSF/1, Intel x86 GNU/Linux, SGI IRIX 6.5, DEC Alpha
# GNU/Linux, and Sun SPARC GNU/Linux, so it definitely is not a C
# compiler problem.
#
# However, the gray awk book, p. 44, says:
#
# In a comparison expression like:
# x == y
# if both operands have a numeric type, the comparison is numeric;
# otherwise, any numeric operand is converted to a string and the
# comparison is made on the string values.
#
# and the new green gawk book, p. 95, says:
#
# When comparing operands of mixed types, numeric operands are
# converted to strings using the value of `CONVFMT'
#
# This suggests that the OK response in bug.awk is wrong, and the ERROR
# response is correct. Only recent gawk releases do the right thing,
# and it is awk, mawk, and nawk that have a bug.
#
# If I change the test program from "00/00/00" to "0/0/0", all versions
# tested produce the OK response.
#
# Comments?
#
# After reading the two book excerpts, I changed my code to read
#
# if (((0 + mdy[1]) == 0) && ((0 + mdy[2]) == 0) && ((0 + mdy[3]) == 0))
#
# and output from all implementations now agrees.
#
# -------------------------------------------------------------------------------
# - Nelson H. F. Beebe Tel: +1 801 581 5254 -
# - Center for Scientific Computing FAX: +1 801 585 1640, +1 801 581 4148 -
# - University of Utah Internet e-mail: beebe@math.utah.edu -
# - Department of Mathematics, 322 INSCC beebe@acm.org beebe@computer.org -
# - 155 S 1400 E RM 233 beebe@ieee.org -
# - Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe -
# -------------------------------------------------------------------------------
#
+1
View File
@@ -0,0 +1 @@
OK: zero strings compare equal to number zero
+78
View File
@@ -0,0 +1,78 @@
#From deep@cicada-semi.com Wed Jan 23 13:15:52 2002
#X-From_: deep@cicada-semi.com Wed Jan 23 01:24:54 2002
#From: "Mandeep Chadha" <deep@cicada-semi.com>
#To: <bug-gawk@gnu.org>
#Subject: gawk version 3.1.0 will not print a ";"
#Date: Tue, 22 Jan 2002 17:23:57 -0600
#Message-ID: <NCBBLGONGLINHCDGFCPNOENHCOAA.deep@cicada-semi.com>
#MIME-Version: 1.0
#Content-Type: text/plain;
# charset="iso-8859-1"
#Content-Transfer-Encoding: 7bit
#X-Priority: 3 (Normal)
#X-MSMail-Priority: Normal
#X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)
#Importance: Normal
#X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
#
#
#The file "tmp" contains the following lines:
#
#A
#B
#C
#D
#
#and when I run the command:
#
# gawk '{print "Input = "$_" ; "}' tmp
{print "Input = "$_" ; "}
#
#I get the following output:
#
#Input = A
#Input = B
#Input = C
#Input = D
#
#while I expect the following output:
#
#Input = A ;
#Input = B ;
#Input = C ;
#Input = D ;
#
#Running gawk --version produces the following output:
#
#GNU Awk 3.1.0
#Copyright (C) 1989, 1991-2001 Free Software Foundation.
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#I am running this on a i686 machine that is running RedHat 7.2 (out of the box).
#
#Thanks,
#
#Mandeep Chadha
#
#----------------------------------------
#Mandeep Chadha
#Cicada Semiconductor Corp.
#811 Barton Springs Road, Suite 550
#Austin, TX 78704
#Ph: (512) 327-3500 x111
#E-mail: deep@cicada-semi.com
#URL: http://www.cicada-semi.com
#----------------------------------------
+4
View File
@@ -0,0 +1,4 @@
A
B
C
D
+4
View File
@@ -0,0 +1,4 @@
Input = A ;
Input = B ;
Input = C ;
Input = D ;
+8
View File
@@ -0,0 +1,8 @@
function f(s, x) {
x = 1
s = 3
s = s x
print s
}
BEGIN { for (i = 1; i <=12; i++) f() }
+12
View File
@@ -0,0 +1,12 @@
31
31
31
31
31
31
31
31
31
31
31
31
+1
View File
@@ -0,0 +1 @@
BEGIN { a; a = a (b "c"); print a; print b }
+2
View File
@@ -0,0 +1,2 @@
c
+9
View File
@@ -0,0 +1,9 @@
{
a = $0
print a
print index(a,"b")
getline
a = a $0
print a
print index(a,"b")
}
+2
View File
@@ -0,0 +1,2 @@
foo
bar
+4
View File
@@ -0,0 +1,4 @@
foo
0
foobar
4
+7
View File
@@ -0,0 +1,7 @@
BEGIN {
OFMT = "%.8g"
x = 1
x += .1
x = (x "a")
print x
}
+1
View File
@@ -0,0 +1 @@
1.1a
+10
View File
@@ -0,0 +1,10 @@
BEGIN {
CONVFMT = "%2.2f"
a = 123.456
b = a "" # give `a' string value also
printf "a = %s\n", a
CONVFMT = "%.6g"
printf "a = %s\n", a
a += 0 # make `a' numeric only again
printf "a = %s\n", a # use `a' as string
}
+3
View File
@@ -0,0 +1,3 @@
a = 123.46
a = 123.456
a = 123.456
+3
View File
@@ -0,0 +1,3 @@
# example program from alex@bofh.torun.pl
BEGIN { IGNORECASE=1 }
/\w+@([[:alnum:]]+\.)+[[:alnum:]]+[[:blank:]]+/ {print $0}
+1
View File
@@ -0,0 +1 @@
bleble@foo1.bh.pl deny

Some files were not shown because too many files have changed in this diff Show More