diff --git a/Nasal/io.nas b/Nasal/io.nas index 1dec0a599..cea2f75f9 100644 --- a/Nasal/io.nas +++ b/Nasal/io.nas @@ -9,27 +9,6 @@ var readfile = func(file) { } -# Generates a stat() test routine that is passed the "mode" field -# (stat(...)[2]) from a stat() call (index 2), extracts the IFMT -# subfield and compares it with the given type, assumes S_IFMT == -# 0xf000. -var _gen_ifmt_test = func(fmt, ifmt) { - func(stat_mode) { - debug.warn("use of deprecated function is" ~ fmt ~ "()"); - var i = int(stat_mode / 0x1000); - return ifmt == i - int(i / 0x10) * 0x10; - } -} - - -# Generate file type test predicates isdir(), isreg(), islnk(), etc. -# Usage: var s = io.stat(filename); # nil -> doesn't exist, broken link -# if (s != nil and io.isdir(s[2])) { ... } -var ifmts = { dir:4, reg:8, lnk:10, sock:12, fifo:1, blk:6, chr:2 }; -foreach (var fmt; keys(ifmts)) - caller(0)[0]["is" ~ fmt] = _gen_ifmt_test(fmt, ifmts[fmt]); - - # Loads Nasal file into namespace and executes it. The namespace # (module name) is taken from the optional second argument, or # derived from the Nasal file's name.