diff options
author | Juergen Kahrs <Juergen.Kahrs@googlemail.com> | 2013-06-01 18:12:23 +0200 |
---|---|---|
committer | Juergen Kahrs <Juergen.Kahrs@googlemail.com> | 2013-06-01 18:12:23 +0200 |
commit | 37be8a17ee9e955dec8bbddb8cd2b31487e44a0c (patch) | |
tree | af9323636c991634144ddb5532d975f08ac56282 /extension | |
parent | 1a4fe61b7ad390740a0c70a0175b82301c083704 (diff) | |
parent | 5482bf19246965d6839fe9df1aec0785f0b1a329 (diff) | |
download | egawk-37be8a17ee9e955dec8bbddb8cd2b31487e44a0c.tar.gz egawk-37be8a17ee9e955dec8bbddb8cd2b31487e44a0c.tar.bz2 egawk-37be8a17ee9e955dec8bbddb8cd2b31487e44a0c.zip |
Merge remote-tracking branch 'origin/master' into cmake
Diffstat (limited to 'extension')
-rw-r--r-- | extension/ChangeLog | 29 | ||||
-rw-r--r-- | extension/configh.in | 5 | ||||
-rwxr-xr-x | extension/configure | 5 | ||||
-rw-r--r-- | extension/configure.ac | 4 | ||||
-rw-r--r-- | extension/filefuncs.c | 36 | ||||
-rw-r--r-- | extension/gawkdirfd.h | 4 | ||||
-rw-r--r-- | extension/readdir.c | 1 | ||||
-rw-r--r-- | extension/time.c | 1 |
8 files changed, 74 insertions, 11 deletions
diff --git a/extension/ChangeLog b/extension/ChangeLog index 66f7d355..2bffccf8 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,32 @@ +2013-06-01 Eli Zaretskii <eliz@gnu.org> + + * filefuncs.c [_WIN32]: Define WIN32_LEAN_AND_MEAN before + including windows.h. + + * readdir.c [__MINGW32__]: Define WIN32_LEAN_AND_MEAN before + including windows.h. + + * filefuncs.c [HAVE_GETSYSTEMTIMEASFILETIME]: Define + WIN32_LEAN_AND_MEAN before including windows.h. + +2013-05-29 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Add <sys/param.h> header check. + * filefuncs.c: Include <sys/param.h> if there. + (device_blocksize): New function. + (fill_stat_array): Call it. + +2013-05-27 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac (AC_STRUCT_ST_BLKSIZE): Replaced with call to + AC_CHECK_MEMBERS. + * filefuncs.c (fill_stat_array): Change test from ifdef + HAVE_ST_BLKSIZE to HAVE_STRUCT_STAT_ST_BLKSIZE. + +2013-05-20 Arnold D. Robbins <arnold@skeeve.com> + + * gawkdirfd.h [FAKE_FD_VALUE]: Copied here from ../gawkapi.h. + 2013-05-16 Andrew J. Schorr <aschorr@telemetry-investments.com> * Makefile.am (install-data-hook): Remove .la files installed by diff --git a/extension/configh.in b/extension/configh.in index cc84f4d0..8da69306 100644 --- a/extension/configh.in +++ b/extension/configh.in @@ -90,9 +90,8 @@ /* Define to 1 if `st_blksize' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE -/* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use - `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */ -#undef HAVE_ST_BLKSIZE +/* Define to 1 if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H /* Define to 1 if you have the <sys/select.h> header file. */ #undef HAVE_SYS_SELECT_H diff --git a/extension/configure b/extension/configure index 23b050d3..1adb8dd5 100755 --- a/extension/configure +++ b/extension/configure @@ -6447,12 +6447,9 @@ cat >>confdefs.h <<_ACEOF _ACEOF -$as_echo "#define HAVE_ST_BLKSIZE 1" >>confdefs.h - fi - if test -n "$ac_tool_prefix"; then for ac_prog in ar lib "link -lib" do @@ -13955,7 +13952,7 @@ else $as_echo "no" >&6; } fi -for ac_header in dirent.h fnmatch.h time.h sys/time.h sys/select.h +for ac_header in dirent.h fnmatch.h time.h sys/time.h sys/select.h sys/param.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" diff --git a/extension/configure.ac b/extension/configure.ac index 40f29681..f5b03e06 100644 --- a/extension/configure.ac +++ b/extension/configure.ac @@ -39,7 +39,7 @@ AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION([0.18.1]) dnl checks for structure members -AC_STRUCT_ST_BLKSIZE +AC_CHECK_MEMBERS([struct stat.st_blksize]) AM_PROG_AR AC_SYS_LARGEFILE @@ -66,7 +66,7 @@ else AC_MSG_RESULT([no]) fi -AC_CHECK_HEADERS(dirent.h fnmatch.h time.h sys/time.h sys/select.h) +AC_CHECK_HEADERS(dirent.h fnmatch.h time.h sys/time.h sys/select.h sys/param.h) AC_CHECK_FUNCS(fdopendir fnmatch gettimeofday \ getdtablesize nanosleep select GetSystemTimeAsFileTime) diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 5117b32f..5ef0e61b 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -45,6 +45,9 @@ #include <sys/types.h> #include <sys/stat.h> +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif /* HAVE_SYS_PARAM_H */ #include "gawkapi.h" @@ -74,6 +77,7 @@ #define major(s) (s) #define minor(s) (0) +#define WIN32_LEAN_AND_MEAN #include <windows.h> /* get_inode --- get the inode of a file */ @@ -265,6 +269,31 @@ read_symlink(const char *fname, size_t bufsize, ssize_t *linksize) return NULL; } + +/* device_blocksize --- try to figure out units of st_blocks */ + +static int +device_blocksize() +{ + /* some of this derived from GNULIB stat-size.h */ +#if defined(DEV_BSIZE) + /* <sys/param.h>, most systems */ + return DEV_BSIZE; +#elif defined(S_BLKSIZE) + /* <sys/stat.h>, BSD systems */ + return S_BLKSIZE; +#elif defined hpux || defined __hpux__ || defined __hpux + return 1024; +#elif defined _AIX && defined _I386 + /* AIX PS/2 counts st_blocks in 4K units. */ + return 4 * 1024; +#elif defined __MINGW32__ + return 1024; +#else + return 512; +#endif +} + /* array_set --- set an array element */ static void @@ -351,11 +380,14 @@ fill_stat_array(const char *name, awk_array_t array, struct stat *sbuf) array_set_numeric(array, "minor", minor(sbuf->st_rdev)); } -#ifdef HAVE_ST_BLKSIZE +#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE array_set_numeric(array, "blksize", sbuf->st_blksize); #elif defined(_WIN32) array_set_numeric(array, "blksize", 4096); -#endif /* HAVE_ST_BLKSIZE */ +#endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */ + + /* the size of a block for st_blocks */ + array_set_numeric(array, "devbsize", device_blocksize()); pmode = format_mode(sbuf->st_mode); array_set(array, "pmode", make_const_string(pmode, strlen(pmode), & tmp)); diff --git a/extension/gawkdirfd.h b/extension/gawkdirfd.h index e75f9bce..52b91804 100644 --- a/extension/gawkdirfd.h +++ b/extension/gawkdirfd.h @@ -39,3 +39,7 @@ dirfd (DIR *dir_p) return fd; } #endif /* HAVE_DIRFD */ + +/* This is for fake directory file descriptors on systems that don't + allow to open() a directory. */ +#define FAKE_FD_VALUE 42 diff --git a/extension/readdir.c b/extension/readdir.c index 9d53ad9a..ed770faa 100644 --- a/extension/readdir.c +++ b/extension/readdir.c @@ -51,6 +51,7 @@ #endif #ifdef __MINGW32__ +#define WIN32_LEAN_AND_MEAN #include <windows.h> #endif diff --git a/extension/time.c b/extension/time.c index cf39ccc2..9fadfe54 100644 --- a/extension/time.c +++ b/extension/time.c @@ -62,6 +62,7 @@ int plugin_is_GPL_compatible; #include <time.h> #endif #if defined(HAVE_GETSYSTEMTIMEASFILETIME) +#define WIN32_LEAN_AND_MEAN #include <windows.h> #endif |