gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, master, updated. 68698dede294f3690dc0e51


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. 68698dede294f3690dc0e51eeb76f18f420f8b8a
Date: Fri, 07 Sep 2012 10:35:59 +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, master has been updated
       via  68698dede294f3690dc0e51eeb76f18f420f8b8a (commit)
       via  000380108735d54f472a7825a865d0308ed357cb (commit)
      from  472dc41713ee71609b2ddc8c77c00adb34354154 (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=68698dede294f3690dc0e51eeb76f18f420f8b8a

commit 68698dede294f3690dc0e51eeb76f18f420f8b8a
Author: Arnold D. Robbins <address@hidden>
Date:   Fri Sep 7 13:35:39 2012 +0300

    Add some comments in extension/gawkfts.h.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index 350ac97..70008f5 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -2,6 +2,8 @@
 
        * readdir.c, readdir.3am: Change argument to readdir_do_ftype()
        to be a string. Update the doc accordingly.
+       * gawkfts.h: Add explanatory comment before defines of API
+       names towards the end. Thanks to Eli Zaretskii for the suggestion.
 
 2012-08-28         Andrew J. Schorr     <address@hidden>
 
diff --git a/extension/gawkfts.h b/extension/gawkfts.h
index 755ef98..7773b77 100644
--- a/extension/gawkfts.h
+++ b/extension/gawkfts.h
@@ -113,6 +113,14 @@ typedef struct _ftsent {
        char fts_name[1];               /* file name */
 } FTSENT;
 
+/*
+ * Due to the wonders of modern linkers, shared libraries,
+ * compilers and other deep, dark, black magic voodoo, we
+ * redefined the identifiers so our code will use our version
+ * of these routines. See README.fts for a little bit more
+ * information and a lot more ranting.
+ */
+
 #define fts_children gawk_fts_children
 #define fts_close gawk_fts_close
 #define fts_open gawk_fts_open

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=000380108735d54f472a7825a865d0308ed357cb

commit 000380108735d54f472a7825a865d0308ed357cb
Author: Arnold D. Robbins <address@hidden>
Date:   Fri Sep 7 13:34:26 2012 +0300

    Revise readdir_do_ftype() argument.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index 9b5affc..350ac97 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2012-09-07         Arnold D. Robbins     <address@hidden>
+
+       * readdir.c, readdir.3am: Change argument to readdir_do_ftype()
+       to be a string. Update the doc accordingly.
+
 2012-08-28         Andrew J. Schorr     <address@hidden>
 
        * readdir.c: Have three states, 0, 1, 2 for never, fallback, and
diff --git a/extension/readdir.3am b/extension/readdir.3am
index e7c6ee4..4479c61 100644
--- a/extension/readdir.3am
+++ b/extension/readdir.3am
@@ -1,11 +1,11 @@
-.TH READDIR 3am "Aug 23 2012" "Free Software Foundation" "GNU Awk Extension 
Modules"
+.TH READDIR 3am "Aug 31 2012" "Free Software Foundation" "GNU Awk Extension 
Modules"
 .SH NAME
 readdir \- directory input parser for gawk
 .SH SYNOPSIS
 .ft CW
 @load "readdir"
 .sp
-readdir_do_ftype(2)    # or 0 or 1
+readdir_do_ftype("stat")       # or "dirent" or "never"
 .ft R
 .SH DESCRIPTION
 The
@@ -43,16 +43,21 @@ for a socket, and
 (unknown) for anything else.
 .PP
 On systems without the file type information, calling
-.B readdir_do_ftype(2)
+.B readdir_do_ftype("stat")
 causes the extension to use
 .IR stat (2)
 to retrieve the appropriate information. This is not the default, since
 .IR stat (2)
 is a potentially expensive operation.  By calling
-.B readdir_do_ftype(0)
+.B readdir_do_ftype("never")
 one can ensure that the file type
 information is never displayed, even when readily available in the
 directory entry.
+.PP
+The third option,
+.B readdir_do_ftype("dirent") ,
+takes file type information from the directory entry, if it is available.
+This is the default on systems that supply this information.
 .SH NOTES
 On GNU/Linux systems, there are filesystems that don't support the
 .B d_type
@@ -61,7 +66,7 @@ entry (see
 and so the file type is always
 .BR u .
 Therefore, using
-.B readdir_do_ftype(2)
+.B readdir_do_ftype("stat")
 is advisable even on GNU/Linux systems. In this case, the
 .I readdir
 extension will fall back to using
diff --git a/extension/readdir.c b/extension/readdir.c
index 14039c8..49a6bf6 100644
--- a/extension/readdir.c
+++ b/extension/readdir.c
@@ -4,6 +4,8 @@
  * Arnold Robbins
  * address@hidden
  * Written 7/2012
+ *
+ * Andrew Schorr and Arnold Robbins: further fixes 8/2012.
  */
 
 /*
@@ -62,16 +64,15 @@ static awk_bool_t (*init_func)(void) = init_readdir;
 
 int plugin_is_GPL_compatible;
 
-/*
- * ftype <= 0: never return file type info
- * ftype == 1: return file type info only if it is available in dirent
- * ftype >= 2: always return file type info, calling fstat if necessary
- */
-static int do_ftype =
+enum {
+       NEVER_DO_INFO,
+       USE_DIRENT_INFO,
+       USE_STAT_INFO
+} do_ftype =
 #ifdef DT_BLK
-       1
+       USE_DIRENT_INFO
 #else
-       0
+       NEVER_DO_INFO
 #endif
        ;
 
@@ -102,7 +103,7 @@ ftype(struct dirent *entry)
        }
 #endif
 
-       if (do_ftype < 2)
+       if (do_ftype < USE_STAT_INFO)
                /*
                 * Avoid "/u" since user did not insist on file type info,
                 * and it does not seem to be supported by dirent on this
@@ -176,7 +177,8 @@ dir_get_record(char **out, struct iobuf_public *iobuf, int 
*errcode,
        len = sprintf(the_dir->buf, "%llu/%s",
                        (unsigned long long) dirent->d_ino,
                        dirent->d_name);
-       if (do_ftype > 0) {
+
+       if (do_ftype != NEVER_DO_INFO) {
                const char *ftstr = ftype(dirent);
                if (ftstr)
                        len += sprintf(the_dir->buf + len, "/%s", ftstr);
@@ -302,13 +304,20 @@ do_readdir_do_ftype(int nargs, awk_value_t *result)
        } else if (do_lint && nargs > 3)
                lintwarn(ext_id, _("readdir_do_ftype: called with more than one 
argument"));
 
-       if (! get_argument(0, AWK_NUMBER, & flag)) {
+       if (! get_argument(0, AWK_STRING, & flag)) {
                warning(ext_id, _("readdir_do_ftype: could not get argument"));
                make_number(0.0, result);
                goto out;
        }
 
-       do_ftype = flag.num_value;
+       if (strcmp(flag.str_value.str, "never") == 0)
+               do_ftype = NEVER_DO_INFO;
+       else if (strcmp(flag.str_value.str, "dirent") == 0)
+               do_ftype = USE_DIRENT_INFO;
+       else if (strcmp(flag.str_value.str, "stat") == 0)
+               do_ftype = USE_STAT_INFO;
+       else
+               make_number(0.0, result);
 
 out:
        return result;
diff --git a/test/ChangeLog b/test/ChangeLog
index 6b02c6a..135251a 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-07         Arnold D. Robbins     <address@hidden>
+
+       * readdir.awk: Change argument to readdir_do_ftype().
+
 2012-08-28         Andrew J. Schorr     <address@hidden>
 
        * Makefile.am (EXTRA_DIST): Add jarebug.sh.
diff --git a/test/readdir.awk b/test/readdir.awk
index 3ec664d..2e3df45 100644
--- a/test/readdir.awk
+++ b/test/readdir.awk
@@ -1,7 +1,7 @@
 @load "readdir"
 
 BEGIN {
-       readdir_do_ftype(2)
+       readdir_do_ftype("stat")
 }
 
 { print }

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

Summary of changes:
 extension/ChangeLog   |    7 +++++++
 extension/gawkfts.h   |    8 ++++++++
 extension/readdir.3am |   15 ++++++++++-----
 extension/readdir.c   |   33 +++++++++++++++++++++------------
 test/ChangeLog        |    4 ++++
 test/readdir.awk      |    2 +-
 6 files changed, 51 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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