diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | extension/ChangeLog | 5 | ||||
-rw-r--r-- | extension/testext.c | 2 | ||||
-rw-r--r-- | gawkapi.c | 28 | ||||
-rw-r--r-- | gawkapi.h | 10 |
5 files changed, 32 insertions, 20 deletions
@@ -1,3 +1,10 @@ +2015-01-02 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (gawk_api): Modify api_get_file to remove the typelen + argument. + (get_file): Remove typelen argument from the macro. + * gawkapi.c (api_get_file): Remove typelen argument. + 2014-12-24 Arnold D. Robbins <arnold@skeeve.com> * profile.c (pprint): Be sure to set ip2 in all paths diff --git a/extension/ChangeLog b/extension/ChangeLog index e8fa12fd..55438800 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,5 +1,10 @@ 2015-01-02 Andrew J. Schorr <aschorr@telemetry-investments.com> + * testext.c (test_get_file): The get_file hook no longer takes a + typelen argument. + +2015-01-02 Andrew J. Schorr <aschorr@telemetry-investments.com> + Remove the select extension, since it will be part of gawkextlib. * select.c, siglist.h: Deleted. * Makefile.am (pkgextension_LTLIBRARIES): Remove select.la. diff --git a/extension/testext.c b/extension/testext.c index f00ced7d..a10c9255 100644 --- a/extension/testext.c +++ b/extension/testext.c @@ -790,7 +790,7 @@ test_get_file(int nargs, awk_value_t *result) printf("%s: open(%s) failed\n", "test_get_file", filename.str_value.str); return make_number(-1.0, result); } - if (! get_file(alias.str_value.str, strlen(alias.str_value.str), "<", 1, fd, &ibuf, &obuf)) { + if (! get_file(alias.str_value.str, strlen(alias.str_value.str), "<", fd, &ibuf, &obuf)) { printf("%s: get_file(%s) failed\n", "test_get_file", alias.str_value.str); return make_number(-1.0, result); } @@ -1043,7 +1043,7 @@ api_release_value(awk_ext_id_t id, awk_value_cookie_t value) /* api_get_file --- return a handle to an existing or newly opened file */ static awk_bool_t -api_get_file(awk_ext_id_t id, const char *name, size_t namelen, const char *filetype, size_t typelen, int fd, const awk_input_buf_t **ibufp, const awk_output_buf_t **obufp) +api_get_file(awk_ext_id_t id, const char *name, size_t namelen, const char *filetype, int fd, const awk_input_buf_t **ibufp, const awk_output_buf_t **obufp) { const struct redirect *f; int flag; /* not used, sigh */ @@ -1080,24 +1080,24 @@ api_get_file(awk_ext_id_t id, const char *name, size_t namelen, const char *file return awk_true; } redirtype = redirect_none; - switch (typelen) { - case 1: - switch (*filetype) { - case '<': + switch (filetype[0]) { + case '<': + if (filetype[1] == '\0') redirtype = redirect_input; - break; - case '>': + break; + case '>': + switch (filetype[1]) { + case '\0': redirtype = redirect_output; break; - } - break; - case 2: - switch (*filetype) { case '>': - if (filetype[1] == '>') + if (filetype[2] == '\0') redirtype = redirect_append; break; - case '|': + } + break; + case '|': + if (filetype[2] == '\0') { switch (filetype[1]) { case '>': redirtype = redirect_pipe; @@ -1109,8 +1109,8 @@ api_get_file(awk_ext_id_t id, const char *name, size_t namelen, const char *file redirtype = redirect_twoway; break; } - break; } + break; } if (redirtype == redirect_none) { warning(_("cannot open unrecognized file type `%s' for `%s'"), @@ -678,8 +678,8 @@ typedef struct gawk_api { /* * Look up a file. If the name is NULL or name_len is 0, it returns * data for the currently open input file corresponding to FILENAME - * (and it will not access the filetype or typelen arguments, so those - * may be undefined). + * (and it will not access the filetype argument, so that may be + * undefined). * If the file is not already open, it tries to open it. * The "filetype" argument should be one of: * ">", ">>", "<", "|>", "|<", and "|&" @@ -700,7 +700,7 @@ typedef struct gawk_api { const char *name, size_t name_len, const char *filetype, - size_t typelen, int fd, + int fd, /* * Return values (on success, one or both should * be non-NULL): @@ -789,8 +789,8 @@ typedef struct gawk_api { #define release_value(value) \ (api->api_release_value(ext_id, value)) -#define get_file(name, namelen, filetype, typelen, fd, ibuf, obuf) \ - (api->api_get_file(ext_id, name, namelen, filetype, typelen, fd, ibuf, obuf)) +#define get_file(name, namelen, filetype, fd, ibuf, obuf) \ + (api->api_get_file(ext_id, name, namelen, filetype, fd, ibuf, obuf)) #define register_ext_version(version) \ (api->api_register_ext_version(ext_id, version)) |