diff options
Diffstat (limited to 'vms/gawkmisc.vms')
-rw-r--r-- | vms/gawkmisc.vms | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vms/gawkmisc.vms b/vms/gawkmisc.vms index 346a1e88..08c8fb5e 100644 --- a/vms/gawkmisc.vms +++ b/vms/gawkmisc.vms @@ -25,6 +25,7 @@ char quote = '\''; char *defpath = DEFPATH; +char *deflibpath = DEFLIBPATH; char envsep = ','; /* gawk_name --- pull out the "gawk" part from how the OS called us */ @@ -143,6 +144,31 @@ int fd; return (fstat(fd, &sbuf) == 0 && S_ISDIR(sbuf.st_mode)); } +/* os_isreadable --- fd can be read from */ + +int +os_isreadable(const awk_input_buf_t *iobuf, bool *isdir) +{ + *isdir = false; + + switch (iobuf->sbuf.st_mode & S_IFMT) { + case S_IFREG: + case S_IFCHR: /* ttys, /dev/null, .. */ +#ifdef S_IFSOCK + case S_IFSOCK: +#endif +#ifdef S_IFIFO + case S_IFIFO: +#endif + return true; + case S_IFDIR: + *isdir = true; + /* fall through */ + default: + return false; + } +} + /* os_is_setuid --- true if running setuid root */ int |