aboutsummaryrefslogtreecommitdiffstats
path: root/test/readdir0.awk
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2013-01-15 09:55:30 -0500
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2013-01-15 09:55:30 -0500
commitedce216d276505437c9cc156f0db4fa586639d76 (patch)
tree15bd7d95fbd258eb5d580d966c5270367c0dd12d /test/readdir0.awk
parent74f4ac827622e938bb43d079dcaa87f1db749c63 (diff)
downloadegawk-edce216d276505437c9cc156f0db4fa586639d76.tar.gz
egawk-edce216d276505437c9cc156f0db4fa586639d76.tar.bz2
egawk-edce216d276505437c9cc156f0db4fa586639d76.zip
Patch readdir test to protect against failure on filesystems lacking type info.
Diffstat (limited to 'test/readdir0.awk')
-rw-r--r--test/readdir0.awk15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/readdir0.awk b/test/readdir0.awk
index 54306f10..c98ac674 100644
--- a/test/readdir0.awk
+++ b/test/readdir0.awk
@@ -1,3 +1,16 @@
+BEGIN {
+ while ((getline x < extout) > 0) {
+ numrec++
+ if ((split(x, f, "/") == 3) && (f[3] == "u"))
+ num_unknown++
+ }
+ close(extout)
+ if ((numrec > 0) && (num_unknown == numrec)) {
+ print "Notice: this filesystem does not appear to support file type information" > "/dev/stderr"
+ ftype_unknown = 1
+ }
+}
+
{
ino = $1
name = $NF
@@ -5,5 +18,5 @@
if (type == "-")
type = "f"
- printf "%s/%s/%s\n", ino, name, type
+ printf "%s/%s/%s\n", ino, name, (ftype_unknown ? "u" : type)
}