aboutsummaryrefslogtreecommitdiffstats
path: root/test/readdir0.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2013-11-07 22:25:44 +0200
committerArnold D. Robbins <arnold@skeeve.com>2013-11-07 22:25:44 +0200
commitee3d8ab30d9508aa6a626fa46959d6093b4f451c (patch)
tree4a873256234f20af3a4f73838b7fcdd4240dd0a6 /test/readdir0.awk
parent29fffed7a9937a77de42d4391c9d961c63e47bf7 (diff)
parentdb78c6a3ccd2bfde092124eca1d3174ac3902f55 (diff)
downloadegawk-ee3d8ab30d9508aa6a626fa46959d6093b4f451c.tar.gz
egawk-ee3d8ab30d9508aa6a626fa46959d6093b4f451c.tar.bz2
egawk-ee3d8ab30d9508aa6a626fa46959d6093b4f451c.zip
Merge branch 'gawk-4.1-stable'
Diffstat (limited to 'test/readdir0.awk')
-rw-r--r--test/readdir0.awk37
1 files changed, 30 insertions, 7 deletions
diff --git a/test/readdir0.awk b/test/readdir0.awk
index c98ac674..3a114fcd 100644
--- a/test/readdir0.awk
+++ b/test/readdir0.awk
@@ -11,12 +11,35 @@ BEGIN {
}
}
-{
- ino = $1
- name = $NF
- type = substr($2, 1, 1)
- if (type == "-")
- type = "f"
+BEGIN {
+ ls_afi = "ls -afi .."
+ ls_al = "ls -la .. | sed 1d"
+
+ for (i = 1; (ls_afi | getline) > 0; i++) {
+ # inode number is $1, filename is read of record
+ inode = $1
+ $1 = ""
+ $0 = $0
+ sub(/^ */, "")
+ names[i] = $0
+ ino[names[i]] = inode
+ }
+ close(ls_afi)
+
+ for (j = 1; (ls_al | getline) > 0; j++) {
+ type_let = substr($0, 1, 1)
+ if (type_let == "-")
+ type_let = "f"
+ $1 = $2 = $3 = $4 = $5 = $6 = $7 = $8 = ""
+ $0 = $0
+ sub(/^ */, "")
+ type[$0] = type_let
+ }
+ close(ls_al)
- printf "%s/%s/%s\n", ino, name, (ftype_unknown ? "u" : type)
+ if (i != j)
+ printf("mismatch: %d from `ls -afi' and %d from `ls -l'\n", i, j) > "/dev/stderr"
+
+ for (i = 1; i in names; i++)
+ printf("%s/%s/%s\n", ino[names[i]], names[i], type[names[i]])
}