aboutsummaryrefslogtreecommitdiffstats
path: root/extension/rwarray.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 14:52:31 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 14:52:31 +0300
commit3ba50a15ebd976f7a88393e2e45dc14b6478b9a9 (patch)
tree6a6bbe6bed1141051fefe94b2d39eacd4854235a /extension/rwarray.awk
parent6a2caf2157d87b4b582b2494bdd7d6a688dd0b1f (diff)
downloadegawk-3ba50a15ebd976f7a88393e2e45dc14b6478b9a9.tar.gz
egawk-3ba50a15ebd976f7a88393e2e45dc14b6478b9a9.tar.bz2
egawk-3ba50a15ebd976f7a88393e2e45dc14b6478b9a9.zip
Move to gawk-3.1.7.
Diffstat (limited to 'extension/rwarray.awk')
-rw-r--r--extension/rwarray.awk28
1 files changed, 28 insertions, 0 deletions
diff --git a/extension/rwarray.awk b/extension/rwarray.awk
new file mode 100644
index 00000000..1057b396
--- /dev/null
+++ b/extension/rwarray.awk
@@ -0,0 +1,28 @@
+BEGIN {
+ extension("./rwarray.so","dlload")
+
+ while ((getline word < "/usr/share/dict/words") > 0)
+ dict[word] = word word
+
+ for (i in dict)
+ printf("dict[%s] = %s\n", i, dict[i]) > "orig.out"
+ close("orig.out");
+
+ writea("orig.bin", dict)
+
+ reada("orig.bin", dict)
+
+ for (i in dict)
+ printf("dict[%s] = %s\n", i, dict[i]) > "new.out"
+ close("new.out");
+
+ ret = system("cmp orig.out new.out")
+
+ if (ret == 0)
+ print "old and new are equal - GOOD"
+ else
+ print "old and new are not equal - BAD"
+
+ if (ret == 0 && !("keepit" in ENVIRON))
+ system("rm orig.bin orig.out new.out")
+}