aboutsummaryrefslogtreecommitdiffstats
path: root/pc
diff options
context:
space:
mode:
Diffstat (limited to 'pc')
-rw-r--r--pc/ChangeLog49
-rw-r--r--pc/Makefile7
-rw-r--r--pc/Makefile.tst51
-rw-r--r--pc/config.h71
-rw-r--r--pc/config.sed24
-rw-r--r--pc/gawkmisc.pc27
6 files changed, 165 insertions, 64 deletions
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 8d340b45..0a53226e 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,48 @@
+2012-11-22 Eli Zaretskii <eliz@gnu.org>
+
+ * Makefile.tst (jarebug): Update.
+ (GREP_OPTIONS): Add.
+
+2012-11-12 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawkmisc.pc (os_isreadable): Use correct type for first parameter.
+
+2012-11-04 Scott Deifik <scottd.mail@sbcglobal.net>
+
+ * Makefile.tst (jarebug, charasbytes): Update.
+
+2012-10-28 Scott Deifik <scottd.mail@sbcglobal.net>
+
+ * Makefile.tst: Sync with mainline version.
+
+2012-10-28 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.pc (messages): Adjust to use standard failure test for
+ make diffout.
+
+2012-08-08 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawkmisc.pc (os_isreadable): Take IOBUF_PUBLIC instead of fd and
+ use passed in info.
+
+2012-07-29 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawkmisc.pc (os_isreadable): Add isdir pointer parameter to be
+ set to true if fd is for a directory.
+
+2012-07-26 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawkmisc.pc (os_isreadable): New function.
+
+2012-05-14 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile: Remove second mingw32-readline target. Bad
+ result from branch merging.
+
+2012-05-06 Eli Zaretskii <eliz@gnu.org>
+
+ * config.sed: Update DJGPP -> __DJGPP__.
+
2012-04-16 Eli Zaretskii <eliz@gnu.org>
* Makefile.tst (PGAWK): Redefine as "../gawk.exe -p".
@@ -36,6 +81,10 @@
* config.h: Add definition for _Noreturn.
+2012-03-20 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * gawkmisc.pc (deflibpath): New global variable.
+
2012-03-28 Arnold D. Robbins <arnold@skeeve.com>
* 4.0.1: Release tar ball made.
diff --git a/pc/Makefile b/pc/Makefile
index 21fe0bfe..f01849a8 100644
--- a/pc/Makefile
+++ b/pc/Makefile
@@ -178,13 +178,6 @@ mingw32-readline-mpfr:
OBJ=popen.o LNK=LMINGW32 LF="-gdwarf-2 -g3" \
LF2="-lmpfr -lgmp -lreadline -lmsvcp60 -Wl,--enable-auto-import" RSP=
-mingw32-readline:
- $(MAK) all \
- CC=gcc O=.o CF="-DHAVE_LIBREADLINE -O2 -gdwarf-2 -g3" OBJ=popen.o \
- LNK=LMINGW32 PLNK=PLMINGW32 DLNK=DLMINGW32 \
- LF="-gdwarf-2 -g3" \
- LF2="-lreadline -lmsvcp60 -Wl,--enable-auto-import" RSP=
-
# Define BIND for BINDless compiles, otherwise $($(BIND)) may break.
BIND = EMPTY
PBIND = EMPTY
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index ab566531..4f7e06b0 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -114,6 +114,9 @@ DATE = gdate
# MS-DOS and OS/2 use ; as a PATH delimiter
PATH_SEPARATOR = ;
+# Non-default GREP_OPTIONS might fail the badargs test
+export GREP_OPTIONS=
+
# ============================================================================
# You shouldn't need to modify anything below this line.
# ============================================================================
@@ -138,7 +141,7 @@ BASIC_TESTS = \
fcall_exit fcall_exit2 fldchg fldchgnf fnamedat fnarray fnarray2 \
fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsrs fsspcoln \
fstabplus funsemnl funsmnam funstack \
- getline getline2 getline3 getline4 getlnbuf getnr2tb getnr2tm \
+ getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \
gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 \
gsubtst7 gsubtst8 \
hex hsprint \
@@ -148,11 +151,12 @@ BASIC_TESTS = \
nasty nasty2 negexp negrange nested nfldstr nfneg nfset nlfldsep \
nlinstr nlstrina noeffect nofile nofmtch noloop1 noloop2 nonl \
noparms nors nulrsend numindex numsubstr \
- octsub ofmt ofmta ofmtbig ofmtfidl ofmts onlynl opasnidx opasnslf \
+ octsub ofmt ofmta ofmtbig ofmtfidl ofmts ofs1 onlynl opasnidx opasnslf \
paramdup paramres paramtyp parse1 parsefld parseme pcntplus \
posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \
prt1eval prtoeval \
- rand range1 rebt8b1 redfilnm regeq regrange reindops reparse \
+ rand range1 rebt8b1 redfilnm regeq regexprange regrange \
+ reindops reparse \
resplit rri1 rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \
rstest3 rstest4 rstest5 rswhite \
scalar sclforin sclifin sortempty splitargv splitarr splitdef \
@@ -168,7 +172,7 @@ UNIX_TESTS = \
GAWK_EXT_TESTS = \
aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
- backw badargs beginfile1 beginfile2 binmode1 \
+ backw badargs beginfile1 beginfile2 binmode1 charasbytes \
clos1way delsub devfd devfd1 devfd2 dumpvars exit \
fieldwdth fpat1 fpat2 fpat3 fpatnull fsfwfs funlen \
fwtest fwtest2 fwtest3 \
@@ -188,7 +192,7 @@ INET_TESTS = inetdayu inetdayt inetechu inetecht
MACHINE_TESTS = double1 double2 fmtspcl intformat
MPFR_TESTS = mpfrnr mpfrrnd mpfrieee mpfrexprange mpfrsort mpfrbigint
LOCALE_CHARSET_TESTS = \
- asort asorti fmttest fnarydel fnparydl lc_num1 mbfw1 \
+ asort asorti fmttest fnarydel fnparydl jarebug lc_num1 mbfw1 \
mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc
# List of the tests which should be run with --lint option:
@@ -302,8 +306,8 @@ poundbang::
messages::
@echo $@
- @$(AWK) -f $(srcdir)/messages.awk >out2 2>out3
- @-$(CMP) $(srcdir)/out1.ok out1 && $(CMP) $(srcdir)/out2.ok out2 && $(CMP) $(srcdir)/out3.ok out3 && rm -f out1 out2 out3
+ @$(AWK) -f $(srcdir)/messages.awk >_out2 2>_out3
+ @-$(CMP) $(srcdir)/out1.ok _out1 && $(CMP) $(srcdir)/out2.ok _out2 && $(CMP) $(srcdir)/out3.ok _out3 && rm -f _out1 _out2 _out3
argarray::
@echo $@
@@ -838,6 +842,22 @@ rri1::
@[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \
AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
+jarebug::
+ @echo $@
+ @echo Expect jarebug to fail with DJGPP and MinGW.
+ @$(srcdir)/$@.sh "$(AWKPROG)" "$(srcdir)/$@.awk" "$(srcdir)/$@.in" "_$@"
+ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
+charasbytes:
+ @echo $@
+# @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \
+# AWKPATH=$(srcdir) $(AWK) -b -f $@.awk $(srcdir)/$@.in | \
+# od -c -t x1 | sed -e 's/ */ /g' -e 's/ *$$//' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \
+ AWKPATH=$(srcdir) $(AWK) -b -v BINMODE=2 -f $@.awk $(srcdir)/$@.in | \
+ od -c -t x1 | sed -e 's/ */ /g' -e 's/ *$$//' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
Gt-dummy:
# file Maketests, generated from Makefile.am by the Gentests program
addcomma:
@@ -1161,6 +1181,11 @@ getline4:
@AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+getline5:
+ @echo getline5
+ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
getnr2tb:
@echo getnr2tb
@AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -1398,6 +1423,11 @@ ofmts:
@AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+ofs1:
+ @echo ofs1
+ @AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
onlynl:
@echo onlynl
@AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -1503,6 +1533,11 @@ regeq:
@AWKPATH=$(srcdir) $(AWK) -f $@.awk < $(srcdir)/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+regexprange:
+ @echo regexprange
+ @AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@
+
regrange:
@echo regrange
@AWKPATH=$(srcdir) $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -2057,7 +2092,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests
$(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests
clean:
- rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~
+ rm -fr _* core core.* fmtspcl.ok junk strftime.ok test1 test2 seq *~
# An attempt to print something that can be grepped for in build logs
pass-fail:
diff --git a/pc/config.h b/pc/config.h
index bc22a30a..0dbf1701 100644
--- a/pc/config.h
+++ b/pc/config.h
@@ -74,7 +74,7 @@
/* Define if you have the iconv() function and it works. */
#undef HAVE_ICONV
-/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */
+/* Define to 1 if the system has the type `intmax_t'. */
#ifdef __MINGW32__
#define HAVE_INTMAX_T 1
#endif
@@ -84,12 +84,6 @@
#define HAVE_INTTYPES_H 1
#endif
-/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
- declares uintmax_t. */
-#ifdef __MINGW32__
-#define HAVE_INTTYPES_H_WITH_UINTMAX 1
-#endif
-
/* Define to 1 if you have the `isascii' function. */
#ifdef __MINGW32__
#define HAVE_ISASCII 1
@@ -136,11 +130,6 @@
#define HAVE_LOCALE_H 1
#endif
-/* Define if you have the 'long long' type. */
-#ifdef __MINGW32__
-#define HAVE_LONG_LONG 1
-#endif
-
/* Define to 1 if the system has the type `long long int'. */
#undef HAVE_LONG_LONG_INT
@@ -181,13 +170,16 @@
#undef HAVE_MEMSET_ULONG
/* Define to 1 if you have the `mkstemp' function. */
-#ifdef DJGPP
+#ifdef __DJGPP__
#define HAVE_MKSTEMP 1
#endif
/* we have the mktime function */
#define HAVE_MKTIME 1
+/* Define to 1 if you have fully functional mpfr and gmp libraries. */
+#undef HAVE_MPFR
+
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
@@ -221,6 +213,9 @@
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
/* Define to 1 if you have the <stddef.h> header file. */
#ifdef __GNUC__
#define HAVE_STDDEF_H 1
@@ -231,10 +226,6 @@
#define HAVE_STDINT_H 1
#endif
-/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
- uintmax_t. */
-#undef HAVE_STDINT_H_WITH_UINTMAX
-
/* Define to 1 if you have the <stdlib.h> header file. */
#ifdef __MINGW32__
#define HAVE_STDLIB_H 1
@@ -313,7 +304,7 @@
#endif
/* Define to 1 if you have the <sys/time.h> header file. */
-#if defined(DJGPP) || defined(__MINGW32__)
+#if defined(__DJGPP__) || defined(__MINGW32__)
#define HAVE_SYS_TIME_H 1
#endif
@@ -350,27 +341,24 @@
/* Define to 1 if you have the `tzset' function. */
#define HAVE_TZSET 1
-/* Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>. */
-#if defined(DJGPP) || defined(__MINGW32__)
+/* Define to 1 if the system has the type `uintmax_t'. */
+#if defined(__DJGPP__) || defined(__MINGW32__)
#define HAVE_UINTMAX_T 1
-#ifdef DJGPP
+#ifdef __DJGPP__
#define uintmax_t unsigned long long
#endif
#endif
/* Define to 1 if you have the <unistd.h> header file. */
-#if defined(DJGPP) || defined(__MINGW32__)
+#if defined(__DJGPP__) || defined(__MINGW32__)
#define HAVE_UNISTD_H 1
#endif
-/* Define if you have the 'unsigned long long' type. */
-#define HAVE_UNSIGNED_LONG_LONG 1
-
/* Define to 1 if the system has the type `unsigned long long int'. */
#undef HAVE_UNSIGNED_LONG_LONG_INT
/* Define to 1 if you have the `usleep' function. */
-#if defined(DJGPP) || defined(__MINGW32__)
+#if defined(__DJGPP__) || defined(__MINGW32__)
#define HAVE_USLEEP 1
#endif
@@ -412,6 +400,9 @@
#define HAVE_WINT_T 1
#endif
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
/* disable lint checks */
#undef NO_LINT
@@ -425,7 +416,7 @@
#define PACKAGE_NAME "GNU Awk"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "GNU Awk 4.0.70"
+#define PACKAGE_STRING "GNU Awk 4.0.71"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "gawk"
@@ -434,7 +425,7 @@
#define PACKAGE_URL "http://www.gnu.org/software/gawk/"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "4.0.70"
+#define PACKAGE_VERSION "4.0.71"
/* Define to 1 if *printf supports %F format */
#undef PRINTF_HAS_F_FORMAT
@@ -442,7 +433,7 @@
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
-#if defined(DJGPP) || defined(__MINGW32__)
+#if defined(__DJGPP__) || defined(__MINGW32__)
#include <limits.h>
#endif
@@ -496,7 +487,12 @@
/* Version number of package */
-#define VERSION "4.0.70"
+#define VERSION "4.0.71"
+
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
@@ -546,8 +542,9 @@
#endif
#endif
-/* Define to long or long long if <inttypes.h> and <stdint.h> don't define. */
-#ifdef DJGPP
+/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
+ not define. */
+#ifdef __DJGPP__
#define intmax_t long long
#endif
@@ -557,7 +554,7 @@
/* Define to the equivalent of the C99 'restrict' keyword, or to
nothing if this is not supported. Do not define if restrict is
supported directly. */
-#ifdef DJGPP
+#ifdef __DJGPP__
#define restrict
#endif
/* Work around a bug in Sun C++: it does not support _Restrict or
@@ -582,9 +579,9 @@
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
-/* Define to unsigned long or unsigned long long if <stdint.h> and
- <inttypes.h> don't define. */
-#ifdef DJGPP
+/* Define to the widest unsigned integer type if <stdint.h> and <inttypes.h>
+ do not define. */
+#ifdef __DJGPP__
#define uintmax_t unsigned long long
#endif
@@ -596,7 +593,7 @@
# define DEFPATH ".;c:/lib/awk;c:/gnu/lib/awk"
#endif
-#ifndef DJGPP
+#ifndef __DJGPP__
#define HAVE_POPEN_H 1
#endif
diff --git a/pc/config.sed b/pc/config.sed
index 96b2c2d7..5e57e82b 100644
--- a/pc/config.sed
+++ b/pc/config.sed
@@ -29,7 +29,7 @@
s/^#undef GETPGRP_VOID *$/#define GETPGRP_VOID 1/
s/^#undef GETGROUPS_T *$/#define GETGROUPS_T gid_t/
/^#undef GETPGRP_VOID$/c\
-#ifdef DJGPP\
+#ifdef __DJGPP__\
#define GETPGRP_VOID 1\
#endif
s/^#undef HAVE_ALARM *$/#define HAVE_ALARM 1/
@@ -100,7 +100,7 @@ s/^#undef HAVE_MEMCPY *$/#define HAVE_MEMCPY 1/
#endif
s/^#undef HAVE_MEMSET *$/#define HAVE_MEMSET 1/
/^#undef HAVE_MKSTEMP *$/c\
-#ifdef DJGPP\
+#ifdef __DJGPP__\
#define HAVE_MKSTEMP 1\
#endif
s/^#undef HAVE_MKTIME *$/#define HAVE_MKTIME 1/
@@ -160,7 +160,7 @@ s/^#undef HAVE_SYSTEM *$/#define HAVE_SYSTEM 1/
#define HAVE_SYS_STAT_H 1\
#endif
/^#undef HAVE_SYS_TIME_H *$/c\
-#if defined(DJGPP) || defined(__MINGW32__)\
+#if defined(__DJGPP__) || defined(__MINGW32__)\
#define HAVE_SYS_TIME_H 1\
#endif
s/^#undef HAVE_SYS_TYPES_H *$/#define HAVE_SYS_TYPES_H 1/
@@ -175,19 +175,19 @@ s/^#undef HAVE_SYS_TYPES_H *$/#define HAVE_SYS_TYPES_H 1/
s/^#undef HAVE_TZNAME *$/#define HAVE_TZNAME 1/
s/^#undef HAVE_TZSET *$/#define HAVE_TZSET 1/
/^#undef HAVE_UINTMAX_T *$/c\
-#if defined(DJGPP) || defined(__MINGW32__)\
+#if defined(__DJGPP__) || defined(__MINGW32__)\
#define HAVE_UINTMAX_T 1\
-#ifdef DJGPP\
+#ifdef __DJGPP__\
#define uintmax_t unsigned long long\
#endif\
#endif
/^#undef HAVE_UNISTD_H *$/c\
-#if defined(DJGPP) || defined(__MINGW32__)\
+#if defined(__DJGPP__) || defined(__MINGW32__)\
#define HAVE_UNISTD_H 1\
#endif
s/^#undef HAVE_UNSIGNED_LONG_LONG *$/#define HAVE_UNSIGNED_LONG_LONG 1/
/^#undef HAVE_USLEEP *$/c\
-#if defined(DJGPP) || defined(__MINGW32__)\
+#if defined(__DJGPP__) || defined(__MINGW32__)\
#define HAVE_USLEEP 1\
#endif
s/^#undef HAVE_VPRINTF *$/#define HAVE_VPRINTF 1/
@@ -223,7 +223,7 @@ s/^#undef PROTOTYPES *$/#define PROTOTYPES 1/
s/^#undef RETSIGTYPE *$/#define RETSIGTYPE void/
/^#.*RETSIGTYPE /a\
\
-#if defined(DJGPP) || defined(__MINGW32__)\
+#if defined(__DJGPP__) || defined(__MINGW32__)\
#include <limits.h>\
#endif
/^#undef SIZEOF_UNSIGNED_INT *$/c\
@@ -243,15 +243,15 @@ s/^#undef TIME_WITH_SYS_TIME *$/#define TIME_WITH_SYS_TIME 1/
#define inline __inline__\
#endif
/^#undef intmax_t *$/c\
-#ifdef DJGPP\
+#ifdef __DJGPP__\
#define intmax_t long long\
#endif
/^#undef restrict *$/c\
-#ifdef DJGPP\
+#ifdef __DJGPP__\
#define restrict\
#endif
/^#undef uintmax_t *$/c\
-#ifdef DJGPP\
+#ifdef __DJGPP__\
#define uintmax_t unsigned long long\
#endif
@@ -265,7 +265,7 @@ $a\
# define DEFPATH ".;c:/lib/awk;c:/gnu/lib/awk"\
#endif\
\
-#ifndef DJGPP\
+#ifndef __DJGPP__\
#define HAVE_POPEN_H 1\
#endif\
\
diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc
index b2a67a50..e44191cd 100644
--- a/pc/gawkmisc.pc
+++ b/pc/gawkmisc.pc
@@ -31,6 +31,8 @@ char *defpath = DEFPATH;
# else
char *defpath = ".;c:\\lib\\awk;c:\\gnu\\lib\\awk";
# endif
+/* the Makefile should define DEFLIBPATH */
+char *deflibpath = DEFLIBPATH;
#ifdef __EMX__
#include<io.h>
@@ -230,6 +232,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