gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-792


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-792-g1d6a3c7
Date: Wed, 20 Jan 2016 20:11:21 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-4.1-stable has been updated
       via  1d6a3c76050a14364b49ec8db05464b0cf003921 (commit)
       via  30d665adea53e84ee232e04450c91e59a0b3d90c (commit)
      from  07795bbecb05b4d2d52bd8808c713b0c5ece7b3b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=1d6a3c76050a14364b49ec8db05464b0cf003921

commit 1d6a3c76050a14364b49ec8db05464b0cf003921
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Jan 20 22:10:55 2016 +0200

    Add (undocumented) statvfs extension function.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index 11db148..0821077 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,9 @@
+2016-01-20         Arnold D. Robbins     <address@hidden>
+
+       * filefuncs.c: Add statvfs function. Undocumented for now.
+       * configure.ac: Add appropriate stuff to check for statvfs.
+       * configure, configh.in: Regenerated.
+
 2015-12-16         Arnold D. Robbins     <address@hidden>
 
        * Makefile.am (EXTRA_DIST): Add ext_custom.h so that it will be
diff --git a/extension/configh.in b/extension/configh.in
index 82cbb8f..d3a226a 100644
--- a/extension/configh.in
+++ b/extension/configh.in
@@ -60,6 +60,9 @@
 /* Define to 1 if you have the `select' function. */
 #undef HAVE_SELECT
 
+/* Define to 1 if you have the `statvfs' function. */
+#undef HAVE_STATVFS
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
@@ -89,6 +92,9 @@
 /* Define to 1 if you have the <sys/select.h> header file. */
 #undef HAVE_SYS_SELECT_H
 
+/* Define to 1 if you have the <sys/statvfs.h> header file. */
+#undef HAVE_SYS_STATVFS_H
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
diff --git a/extension/configure b/extension/configure
index e42ceb6..8b72f9f 100755
--- a/extension/configure
+++ b/extension/configure
@@ -12602,7 +12602,7 @@ else
 $as_echo "no" >&6; }
 fi
 
-for ac_header in fnmatch.h limits.h sys/time.h sys/select.h sys/param.h
+for ac_header in fnmatch.h limits.h sys/time.h sys/select.h sys/param.h 
sys/statvfs.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"
@@ -12860,7 +12860,7 @@ fi
 
 
 for ac_func in fdopendir fnmatch gettimeofday \
-               getdtablesize nanosleep select GetSystemTimeAsFileTime
+               getdtablesize nanosleep select statvfs GetSystemTimeAsFileTime
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/extension/configure.ac b/extension/configure.ac
index a0f78d7..2bdaab6 100644
--- a/extension/configure.ac
+++ b/extension/configure.ac
@@ -64,13 +64,13 @@ else
        AC_MSG_RESULT([no])
 fi
 
-AC_CHECK_HEADERS(fnmatch.h limits.h sys/time.h sys/select.h sys/param.h)
+AC_CHECK_HEADERS(fnmatch.h limits.h sys/time.h sys/select.h sys/param.h 
sys/statvfs.h)
 AC_HEADER_DIRENT
 AC_HEADER_MAJOR
 AC_HEADER_TIME
 
 AC_CHECK_FUNCS(fdopendir fnmatch gettimeofday \
-               getdtablesize nanosleep select GetSystemTimeAsFileTime)
+               getdtablesize nanosleep select statvfs GetSystemTimeAsFileTime)
 
 GAWK_FUNC_DIRFD
 GAWK_PREREQ_DIRFD
diff --git a/extension/filefuncs.c b/extension/filefuncs.c
index 1441cb3..ae4f7c3 100644
--- a/extension/filefuncs.c
+++ b/extension/filefuncs.c
@@ -6,6 +6,7 @@
  * Arnold Robbins and John Haque, update for 3.1.4, applied Mon Jun 14 
13:55:30 IDT 2004
  * Arnold Robbins and Andrew Schorr, revised for new extension API, May 2012.
  * Arnold Robbins, add fts(), August 2012
+ * Arnold Robbins, add statvfs(), November 2015
  */
 
 /*
@@ -84,6 +85,10 @@
 #include <sys/sysmacros.h>
 #endif
 
+#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
+#include <sys/statvfs.h>
+#endif
+
 #include "gawkapi.h"
 
 #include "gettext.h"
@@ -502,6 +507,64 @@ do_stat(int nargs, awk_value_t *result)
        return make_number(ret, result);
 }
 
+#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
+
+/* do_statvfs --- provide a statvfs() function for gawk */
+
+static awk_value_t *
+do_statvfs(int nargs, awk_value_t *result)
+{
+       awk_value_t file_param, array_param;
+       char *name;
+       awk_array_t array;
+       int ret;
+       struct statvfs vfsbuf;
+
+       assert(result != NULL);
+
+       if (nargs != 2) {
+               if (do_lint)
+                       lintwarn(ext_id, _("statvfs: called with wrong number 
of arguments"));
+               return make_number(-1, result);
+       }
+
+       /* file is first arg, array to hold results is second */
+       if (   ! get_argument(0, AWK_STRING, & file_param)
+           || ! get_argument(1, AWK_ARRAY, & array_param)) {
+               warning(ext_id, _("stat: bad parameters"));
+               return make_number(-1, result);
+       }
+
+       name = file_param.str_value.str;
+       array = array_param.array_cookie;
+
+       /* always empty out the array */
+       clear_array(array);
+
+       /* stat the file; if error, set ERRNO and return */
+       ret = statvfs(name, & vfsbuf);
+       if (ret < 0) {
+               update_ERRNO_int(errno);
+               return make_number(ret, result);
+       }
+
+       array_set_numeric(array, "bsize", vfsbuf.f_bsize);      /* filesystem 
block size */
+       array_set_numeric(array, "frsize", vfsbuf.f_frsize);    /* fragment 
size */
+       array_set_numeric(array, "blocks", vfsbuf.f_blocks);    /* size of fs 
in f_frsize units */
+       array_set_numeric(array, "bfree", vfsbuf.f_bfree);      /* # free 
blocks */
+       array_set_numeric(array, "bavail", vfsbuf.f_bavail);    /* # free 
blocks for unprivileged users */
+       array_set_numeric(array, "files", vfsbuf.f_files);      /* # inodes */
+       array_set_numeric(array, "ffree", vfsbuf.f_ffree);      /* # free 
inodes */
+       array_set_numeric(array, "favail", vfsbuf.f_favail);    /* # free 
inodes for unprivileged users */
+       array_set_numeric(array, "fsid", vfsbuf.f_fsid);        /* filesystem 
ID */
+       array_set_numeric(array, "flag", vfsbuf.f_flag);        /* mount flags 
*/
+       array_set_numeric(array, "namemax", vfsbuf.f_namemax);  /* maximum 
filename length */
+       
+
+       return make_number(ret, result);
+}
+#endif
+
 /* init_filefuncs --- initialization routine */
 
 static awk_bool_t
@@ -868,6 +931,9 @@ static awk_ext_func_t func_table[] = {
 #ifndef __MINGW32__
        { "fts",        do_fts, 3 },
 #endif
+#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
+       { "statvfs",    do_statvfs, 2 },
+#endif
 };
 
 

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=30d665adea53e84ee232e04450c91e59a0b3d90c

commit 30d665adea53e84ee232e04450c91e59a0b3d90c
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Jan 20 22:10:38 2016 +0200

    Minor regex code cleanup.

diff --git a/ChangeLog b/ChangeLog
index 09d5732..b298db9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-01-20         Arnold D. Robbins     <address@hidden>
+
+       * regex_internal.h [attribute_hidden]: Remove definition.
+       * regcomp.c [attribute_hidden]: Remove uses. Not needed since
+       the variables are static. Thanks to Paul Eggert for pointing
+       this out.
+
 2016-01-18         Paul Eggert  <address@hidden>
 
        Diagnose ERE '()|\1'
diff --git a/regcomp.c b/regcomp.c
index 35a6c21..4ddbade 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -137,7 +137,7 @@ static reg_errcode_t mark_opt_subexp (void *extra, 
bin_tree_t *node);
    POSIX doesn't require that we do anything for REG_NOERROR,
    but why not be nice?  */
 
-static const char __re_error_msgid[] attribute_hidden =
+static const char __re_error_msgid[] =
   {
 #define REG_NOERROR_IDX        0
     gettext_noop ("Success")   /* REG_NOERROR */
@@ -191,7 +191,7 @@ static const char __re_error_msgid[] attribute_hidden =
     gettext_noop ("Unmatched ) or \\)") /* REG_ERPAREN */
   };
 
-static const size_t __re_error_msgid_idx[] attribute_hidden =
+static const size_t __re_error_msgid_idx[] =
   {
     REG_NOERROR_IDX,
     REG_NOMATCH_IDX,
diff --git a/regex_internal.h b/regex_internal.h
index 6cc84a7..ff26be7 100644
--- a/regex_internal.h
+++ b/regex_internal.h
@@ -143,7 +143,6 @@ is_blank (int c)
 # define __mempcpy mempcpy
 # define __wcrtomb wcrtomb
 # define __regfree regfree
-# define attribute_hidden
 #endif /* not _LIBC */
 
 #if __GNUC__ < 3 + (__GNUC_MINOR__ < 1)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog              |    7 +++++
 extension/ChangeLog    |    6 ++++
 extension/configh.in   |    6 ++++
 extension/configure    |    4 +-
 extension/configure.ac |    4 +-
 extension/filefuncs.c  |   66 ++++++++++++++++++++++++++++++++++++++++++++++++
 regcomp.c              |    4 +-
 regex_internal.h       |    1 -
 8 files changed, 91 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]