aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2015-01-02 16:44:33 -0500
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2015-01-02 16:44:33 -0500
commite36300be4deb7bbdeff17c8e896ac2f727e1477e (patch)
tree11d328237964358e547acca5dccbdef0763d37c0
parentb97472e2be3aa040e59ac9ca4e54a7639be067ff (diff)
downloadegawk-e36300be4deb7bbdeff17c8e896ac2f727e1477e.tar.gz
egawk-e36300be4deb7bbdeff17c8e896ac2f727e1477e.tar.bz2
egawk-e36300be4deb7bbdeff17c8e896ac2f727e1477e.zip
Remove api_get_file typelen argument.
-rw-r--r--ChangeLog7
-rw-r--r--extension/ChangeLog5
-rw-r--r--extension/testext.c2
-rw-r--r--gawkapi.c28
-rw-r--r--gawkapi.h10
5 files changed, 32 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index c5f29f44..baa7c003 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);
}
diff --git a/gawkapi.c b/gawkapi.c
index e2c0b1a0..a693621e 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -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'"),
diff --git a/gawkapi.h b/gawkapi.h
index 65f1dfc3..22b3be3d 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -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))