aboutsummaryrefslogtreecommitdiffstats
path: root/awklib/eg
diff options
context:
space:
mode:
Diffstat (limited to 'awklib/eg')
-rw-r--r--awklib/eg/data/BBS-list11
-rw-r--r--awklib/eg/data/mail-list11
-rw-r--r--awklib/eg/lib/getopt.awk2
-rw-r--r--awklib/eg/lib/quicksort.awk3
-rw-r--r--awklib/eg/lib/readfile.awk15
-rw-r--r--awklib/eg/prog/cut.awk2
6 files changed, 30 insertions, 14 deletions
diff --git a/awklib/eg/data/BBS-list b/awklib/eg/data/BBS-list
deleted file mode 100644
index 1007417f..00000000
--- a/awklib/eg/data/BBS-list
+++ /dev/null
@@ -1,11 +0,0 @@
-aardvark 555-5553 1200/300 B
-alpo-net 555-3412 2400/1200/300 A
-barfly 555-7685 1200/300 A
-bites 555-1675 2400/1200/300 A
-camelot 555-0542 300 C
-core 555-2912 1200/300 C
-fooey 555-1234 2400/1200/300 B
-foot 555-6699 1200/300 B
-macfoo 555-6480 1200/300 A
-sdace 555-3430 2400/1200/300 A
-sabafoo 555-2127 1200/300 C
diff --git a/awklib/eg/data/mail-list b/awklib/eg/data/mail-list
new file mode 100644
index 00000000..37ff350a
--- /dev/null
+++ b/awklib/eg/data/mail-list
@@ -0,0 +1,11 @@
+Amelia 555-5553 amelia.zodiacusque@gmail.com F
+Anthony 555-3412 anthony.asserturo@hotmail.com A
+Becky 555-7685 becky.algebrarum@gmail.com A
+Bill 555-1675 bill.drowning@hotmail.com A
+Broderick 555-0542 broderick.aliquotiens@yahoo.com R
+Camilla 555-2912 camilla.infusarum@skynet.be R
+Fabius 555-1234 fabius.undevicesimus@ucb.edu F
+Julie 555-6699 julie.perscrutabor@skeeve.com F
+Martin 555-6480 martin.codicibus@hotmail.com A
+Samuel 555-3430 samuel.lanceolis@shu.edu A
+Jean-Paul 555-2127 jeanpaul.campanorum@nyu.edu R
diff --git a/awklib/eg/lib/getopt.awk b/awklib/eg/lib/getopt.awk
index 0b81aa09..4283a7e1 100644
--- a/awklib/eg/lib/getopt.awk
+++ b/awklib/eg/lib/getopt.awk
@@ -17,7 +17,7 @@
# <c> a character representing the current option
# Private Data:
-# _opti -- index in multi-flag option, e.g., -abc
+# _opti -- index in multiflag option, e.g., -abc
function getopt(argc, argv, options, thisopt, i)
{
if (length(options) == 0) # no options given
diff --git a/awklib/eg/lib/quicksort.awk b/awklib/eg/lib/quicksort.awk
index 7a635d6f..43357ac6 100644
--- a/awklib/eg/lib/quicksort.awk
+++ b/awklib/eg/lib/quicksort.awk
@@ -1,8 +1,9 @@
# quicksort.awk --- Quicksort algorithm, with user-supplied
# comparison function
#
-# Arnold Robbins, arnoldskeeve.com, Public Domain
+# Arnold Robbins, arnold@skeeve.com, Public Domain
# January 2009
+
# quicksort --- C.A.R. Hoare's quick sort algorithm. See Wikipedia
# or almost any algorithms or computer science text
#
diff --git a/awklib/eg/lib/readfile.awk b/awklib/eg/lib/readfile.awk
new file mode 100644
index 00000000..9137b26d
--- /dev/null
+++ b/awklib/eg/lib/readfile.awk
@@ -0,0 +1,15 @@
+# readfile.awk --- read an entire file at once
+#
+# Original idea by Denis Shirokov, cosmogen@gmail.com, April 2013
+#
+
+function readfile(file, tmp, save_rs)
+{
+ save_rs = RS
+ RS = "^$"
+ getline tmp < file
+ close(file)
+ RS = save_rs
+
+ return tmp
+}
diff --git a/awklib/eg/prog/cut.awk b/awklib/eg/prog/cut.awk
index 16b4bdaa..1399411e 100644
--- a/awklib/eg/prog/cut.awk
+++ b/awklib/eg/prog/cut.awk
@@ -86,7 +86,7 @@ function set_fieldlist( n, m, i, j, k, f, g)
}
nfields = j - 1
}
-function set_charlist( field, i, j, f, g, t,
+function set_charlist( field, i, j, f, g, n, m, t,
filler, last, len)
{
field = 1 # count total fields