diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-12-22 17:35:08 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-12-22 17:35:08 +0200 |
commit | cd820dc4359b8dc1a40fedc0c5d3924ed8f88df0 (patch) | |
tree | 17ce84a9a1907783c7839b2dd6fd9afefe303815 /extension | |
parent | 0eb15bcef4ca13a329c9bf3d5e608e29bbce42ad (diff) | |
parent | 0f15f82e19b32823fe3fdf51052389ca3b60e92e (diff) | |
download | egawk-cd820dc4359b8dc1a40fedc0c5d3924ed8f88df0.tar.gz egawk-cd820dc4359b8dc1a40fedc0c5d3924ed8f88df0.tar.bz2 egawk-cd820dc4359b8dc1a40fedc0c5d3924ed8f88df0.zip |
Merge branch 'master' into feature/regex-to-api
Diffstat (limited to 'extension')
-rw-r--r-- | extension/ChangeLog | 43 | ||||
-rw-r--r-- | extension/filefuncs.c | 35 | ||||
-rw-r--r-- | extension/fnmatch.c | 11 | ||||
-rw-r--r-- | extension/fork.c | 24 | ||||
-rw-r--r-- | extension/inplace.c | 8 | ||||
-rw-r--r-- | extension/ordchr.c | 30 | ||||
-rw-r--r-- | extension/readdir.c | 2 | ||||
-rw-r--r-- | extension/readfile.c | 9 | ||||
-rw-r--r-- | extension/revoutput.c | 2 | ||||
-rw-r--r-- | extension/revtwoway.c | 2 | ||||
-rw-r--r-- | extension/rwarray.c | 14 | ||||
-rw-r--r-- | extension/rwarray0.c | 14 | ||||
-rw-r--r-- | extension/testext.c | 56 | ||||
-rw-r--r-- | extension/time.c | 14 |
14 files changed, 121 insertions, 143 deletions
diff --git a/extension/ChangeLog b/extension/ChangeLog index dc0373f4..bf7d3fa4 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,46 @@ +2016-12-16 Arnold D. Robbins <arnold@skeeve.com> + + * filefuncs.c: Update func_table again. + +2016-12-14 Arnold D. Robbins <arnold@skeeve.com> + + * filefuncs.c: Update do_xxx to match new API. Update func_table. + * fnmatch.c: Ditto. + * fork.c: Ditto. + * inplace.c: Ditto. + * ordchr.c: Ditto. + * readdir.c: Ditto. + * readfile.c: Ditto. + * revoutput.c: Ditto. + * revtwoway.c: Ditto. + * rwarray.c: Ditto. + * rwarray0.c: Ditto. + * testext.c: Ditto. + * time.c: Ditto. + +2016-12-12 Arnold D. Robbins <arnold@skeeve.com> + + * filefuncs.c (func_table): Adjust ordering of min and max + for stat. + +2016-12-06 Arnold D. Robbins <arnold@skeeve.com> + + Add minimum required and maximum expected number of arguments + to the API. + + * filefuncs.c: Update with max expected value. Remove lint + checks since that's now done by gawk. + * fnmatch.c: Ditto. + * fork.c: Ditto. + * inplace.c: Ditto. + * ordchr.c: Ditto. + * readdir.c: Ditto. + * readfile.c: Ditto. + * rwarray.c: Ditto. + * rwarray0.c: Ditto. + * testext.c: Ditto. + * time.c: Ditto. + 2016-11-30 Arnold D. Robbins <arnold@skeeve.com> * rwarray.c: Restore read comparion of major and minor versions diff --git a/extension/filefuncs.c b/extension/filefuncs.c index a074de53..394de504 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -153,16 +153,13 @@ int plugin_is_GPL_compatible; /* do_chdir --- provide dynamically loaded chdir() function for gawk */ static awk_value_t * -do_chdir(int nargs, awk_value_t *result) +do_chdir(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t newdir; int ret = -1; assert(result != NULL); - if (do_lint && nargs != 1) - lintwarn(ext_id, _("chdir: called with incorrect number of arguments, expecting 1")); - if (get_argument(0, AWK_STRING, & newdir)) { ret = chdir(newdir.str_value.str); if (ret < 0) @@ -461,7 +458,7 @@ fill_stat_array(const char *name, awk_array_t array, struct stat *sbuf) /* do_stat --- provide a stat() function for gawk */ static awk_value_t * -do_stat(int nargs, awk_value_t *result) +do_stat(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t file_param, array_param; char *name; @@ -472,12 +469,6 @@ do_stat(int nargs, awk_value_t *result) assert(result != NULL); - if (nargs != 2 && nargs != 3) { - if (do_lint) - lintwarn(ext_id, _("stat: 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)) { @@ -512,7 +503,7 @@ do_stat(int nargs, awk_value_t *result) /* do_statvfs --- provide a statvfs() function for gawk */ static awk_value_t * -do_statvfs(int nargs, awk_value_t *result) +do_statvfs(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t file_param, array_param; char *name; @@ -522,12 +513,6 @@ do_statvfs(int nargs, awk_value_t *result) 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)) { @@ -614,7 +599,7 @@ init_filefuncs(void) */ static awk_value_t * -do_fts(int nargs, awk_value_t *result) +do_fts(int nargs, awk_value_t *result, struct awk_ext_func *unused) { fatal(ext_id, _("fts is not supported on this system")); @@ -829,7 +814,7 @@ process(FTS *heirarchy, awk_array_t destarray, int seedot) */ static awk_value_t * -do_fts(int nargs, awk_value_t *result) +do_fts(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t pathlist, flagval, dest; awk_flat_array_t *path_array = NULL; @@ -845,7 +830,7 @@ do_fts(int nargs, awk_value_t *result) assert(result != NULL); fts_errors = 0; /* ensure a fresh start */ - if (do_lint && nargs != 3) + if (nargs > 3) lintwarn(ext_id, _("fts: called with incorrect number of arguments, expecting 3")); if (! get_argument(0, AWK_ARRAY, & pathlist)) { @@ -928,13 +913,13 @@ out: #endif /* ! __MINGW32__ */ static awk_ext_func_t func_table[] = { - { "chdir", do_chdir, 1 }, - { "stat", do_stat, 3 }, + { "chdir", do_chdir, 1, 1, awk_false, NULL }, + { "stat", do_stat, 3, 2, awk_false, NULL }, #ifndef __MINGW32__ - { "fts", do_fts, 3 }, + { "fts", do_fts, 3, 3, awk_false, NULL }, #endif #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) - { "statvfs", do_statvfs, 2 }, + { "statvfs", do_statvfs, 2, 2, awk_false, NULL }, #endif }; diff --git a/extension/fnmatch.c b/extension/fnmatch.c index f5fb02c6..5382e4bc 100644 --- a/extension/fnmatch.c +++ b/extension/fnmatch.c @@ -95,7 +95,7 @@ int plugin_is_GPL_compatible; /* do_fnmatch --- implement the fnmatch interface */ static awk_value_t * -do_fnmatch(int nargs, awk_value_t *result) +do_fnmatch(int nargs, awk_value_t *result, struct awk_ext_func *unused) { #ifdef HAVE_FNMATCH_H static int flags_mask = @@ -107,13 +107,8 @@ do_fnmatch(int nargs, awk_value_t *result) int int_flags, retval; make_number(-1.0, result); /* default return */ -#ifdef HAVE_FNMATCH - if (nargs < 3) { - warning(ext_id, _("fnmatch: called with less than three arguments")); - goto out; - } else if (do_lint && nargs > 3) - lintwarn(ext_id, _("fnmatch: called with more than three arguments")); +#ifdef HAVE_FNMATCH if (! get_argument(0, AWK_STRING, & pattern)) { warning(ext_id, _("fnmatch: could not get first argument")); goto out; @@ -199,7 +194,7 @@ init_fnmatch(void) } static awk_ext_func_t func_table[] = { - { "fnmatch", do_fnmatch, 3 }, + { "fnmatch", do_fnmatch, 3, 3, awk_false, NULL }, }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/fork.c b/extension/fork.c index 82593b7f..823506dd 100644 --- a/extension/fork.c +++ b/extension/fork.c @@ -71,15 +71,12 @@ array_set_numeric(awk_array_t array, const char *sub, double num) /* do_fork --- provide dynamically loaded fork() builtin for gawk */ static awk_value_t * -do_fork(int nargs, awk_value_t *result) +do_fork(int nargs, awk_value_t *result, struct awk_ext_func *unused) { int ret = -1; assert(result != NULL); - if (do_lint && nargs > 0) - lintwarn(ext_id, _("fork: called with too many arguments")); - ret = fork(); if (ret < 0) @@ -106,7 +103,7 @@ do_fork(int nargs, awk_value_t *result) /* do_waitpid --- provide dynamically loaded waitpid() builtin for gawk */ static awk_value_t * -do_waitpid(int nargs, awk_value_t *result) +do_waitpid(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t pid; int ret = -1; @@ -114,16 +111,12 @@ do_waitpid(int nargs, awk_value_t *result) assert(result != NULL); - if (do_lint && nargs > 1) - lintwarn(ext_id, _("waitpid: called with too many arguments")); - if (get_argument(0, AWK_NUMBER, &pid)) { options = WNOHANG|WUNTRACED; ret = waitpid(pid.num_value, NULL, options); if (ret < 0) update_ERRNO_int(errno); - } else if (do_lint) - lintwarn(ext_id, _("wait: called with no arguments")); + } /* Set the return value */ return make_number(ret, result); @@ -133,15 +126,12 @@ do_waitpid(int nargs, awk_value_t *result) /* do_wait --- provide dynamically loaded wait() builtin for gawk */ static awk_value_t * -do_wait(int nargs, awk_value_t *result) +do_wait(int nargs, awk_value_t *result, struct awk_ext_func *unused) { int ret; assert(result != NULL); - if (do_lint && nargs > 0) - lintwarn(ext_id, _("wait: called with too many arguments")); - ret = wait(NULL); if (ret < 0) update_ERRNO_int(errno); @@ -151,9 +141,9 @@ do_wait(int nargs, awk_value_t *result) } static awk_ext_func_t func_table[] = { - { "fork", do_fork, 0 }, - { "waitpid", do_waitpid, 1 }, - { "wait", do_wait, 0 }, + { "fork", do_fork, 0, 0, awk_false, NULL }, + { "waitpid", do_waitpid, 1, 1, awk_false, NULL }, + { "wait", do_wait, 0, 0, awk_false, NULL }, }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/inplace.c b/extension/inplace.c index 26c37922..5457287f 100644 --- a/extension/inplace.c +++ b/extension/inplace.c @@ -118,7 +118,7 @@ invalid_filename(const awk_string_t *filename) /* do_inplace_begin --- start in-place editing */ static awk_value_t * -do_inplace_begin(int nargs, awk_value_t *result) +do_inplace_begin(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename; struct stat sbuf; @@ -201,7 +201,7 @@ do_inplace_begin(int nargs, awk_value_t *result) /* do_inplace_end --- finish in-place editing */ static awk_value_t * -do_inplace_end(int nargs, awk_value_t *result) +do_inplace_end(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, suffix; @@ -262,8 +262,8 @@ do_inplace_end(int nargs, awk_value_t *result) } static awk_ext_func_t func_table[] = { - { "inplace_begin", do_inplace_begin, 2 }, - { "inplace_end", do_inplace_end, 2 }, + { "inplace_begin", do_inplace_begin, 2, 2, awk_false, NULL }, + { "inplace_end", do_inplace_end, 2, 2, awk_false, NULL }, }; static awk_bool_t init_inplace(void) diff --git a/extension/ordchr.c b/extension/ordchr.c index 4f9cd616..c7451f6d 100644 --- a/extension/ordchr.c +++ b/extension/ordchr.c @@ -58,24 +58,17 @@ int plugin_is_GPL_compatible; /* do_ord --- return numeric value of first char of string */ static awk_value_t * -do_ord(int nargs, awk_value_t *result) +do_ord(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t str; double ret = -1; assert(result != NULL); - if (do_lint && nargs > 1) - lintwarn(ext_id, _("ord: called with too many arguments")); - if (get_argument(0, AWK_STRING, & str)) { ret = str.str_value.str[0]; - } else if (do_lint) { - if (nargs == 0) - lintwarn(ext_id, _("ord: called with no arguments")); - else - lintwarn(ext_id, _("ord: called with inappropriate argument(s)")); - } + } else if (do_lint) + lintwarn(ext_id, _("ord: called with inappropriate argument(s)")); /* Set the return value */ return make_number(ret, result); @@ -84,7 +77,7 @@ do_ord(int nargs, awk_value_t *result) /* do_chr --- turn numeric value into a string */ static awk_value_t * -do_chr(int nargs, awk_value_t *result) +do_chr(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t num; unsigned int ret = 0; @@ -95,29 +88,22 @@ do_chr(int nargs, awk_value_t *result) assert(result != NULL); - if (do_lint && nargs > 1) - lintwarn(ext_id, _("chr: called with too many arguments")); - if (get_argument(0, AWK_NUMBER, & num)) { val = num.num_value; ret = val; /* convert to int */ ret &= 0xff; str[0] = ret; str[1] = '\0'; - } else if (do_lint) { - if (nargs == 0) - lintwarn(ext_id, _("chr: called with no arguments")); - else - lintwarn(ext_id, _("chr: called with inappropriate argument(s)")); - } + } else if (do_lint) + lintwarn(ext_id, _("chr: called with inappropriate argument(s)")); /* Set the return value */ return make_const_string(str, 1, result); } static awk_ext_func_t func_table[] = { - { "ord", do_ord, 1 }, - { "chr", do_chr, 1 }, + { "ord", do_ord, 1, 1, awk_false, NULL }, + { "chr", do_chr, 1, 1, awk_false, NULL }, }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/readdir.c b/extension/readdir.c index 6106a44b..39acba68 100644 --- a/extension/readdir.c +++ b/extension/readdir.c @@ -316,7 +316,7 @@ init_readdir() } static awk_ext_func_t func_table[] = { - { NULL, NULL, 0 } + { NULL, NULL, 0, 0, awk_false, NULL } }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/readfile.c b/extension/readfile.c index fbe25748..b453da21 100644 --- a/extension/readfile.c +++ b/extension/readfile.c @@ -98,7 +98,7 @@ done: /* do_readfile --- read a file into memory */ static awk_value_t * -do_readfile(int nargs, awk_value_t *result) +do_readfile(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename; int ret; @@ -109,9 +109,6 @@ do_readfile(int nargs, awk_value_t *result) assert(result != NULL); make_null_string(result); /* default return value */ - if (do_lint && nargs > 1) - lintwarn(ext_id, _("readfile: called with too many arguments")); - unset_ERRNO(); if (get_argument(0, AWK_STRING, &filename)) { @@ -134,7 +131,7 @@ do_readfile(int nargs, awk_value_t *result) make_malloced_string(text, sbuf.st_size, result); goto done; } else if (do_lint) - lintwarn(ext_id, _("readfile: called with no arguments")); + lintwarn(ext_id, _("readfile: called with wrong kind of argument")); done: /* Set the return value */ @@ -241,7 +238,7 @@ init_readfile() } static awk_ext_func_t func_table[] = { - { "readfile", do_readfile, 1 }, + { "readfile", do_readfile, 1, 1, awk_false, NULL }, }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/revoutput.c b/extension/revoutput.c index 84d0aaa5..5862ed6e 100644 --- a/extension/revoutput.c +++ b/extension/revoutput.c @@ -134,7 +134,7 @@ init_revoutput() } static awk_ext_func_t func_table[] = { - { NULL, NULL, 0 } + { NULL, NULL, 0, 0, awk_false, NULL } }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/revtwoway.c b/extension/revtwoway.c index 82fabb2b..ac4e22cf 100644 --- a/extension/revtwoway.c +++ b/extension/revtwoway.c @@ -336,7 +336,7 @@ init_revtwoway() } static awk_ext_func_t func_table[] = { - { NULL, NULL, 0 } + { NULL, NULL, 0, 0, awk_false, NULL } }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/rwarray.c b/extension/rwarray.c index ad77b68c..b62b6de0 100644 --- a/extension/rwarray.c +++ b/extension/rwarray.c @@ -99,7 +99,7 @@ static awk_bool_t read_value(FILE *fp, awk_value_t *value); /* do_writea --- write an array */ static awk_value_t * -do_writea(int nargs, awk_value_t *result) +do_writea(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, array; FILE *fp = NULL; @@ -109,9 +109,6 @@ do_writea(int nargs, awk_value_t *result) assert(result != NULL); make_number(0.0, result); - if (do_lint && nargs > 2) - lintwarn(ext_id, _("writea: called with too many arguments")); - if (nargs < 2) goto out; @@ -254,7 +251,7 @@ write_value(FILE *fp, awk_value_t *val) /* do_reada --- read an array */ static awk_value_t * -do_reada(int nargs, awk_value_t *result) +do_reada(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, array; FILE *fp = NULL; @@ -265,9 +262,6 @@ do_reada(int nargs, awk_value_t *result) assert(result != NULL); make_number(0.0, result); - if (do_lint && nargs > 2) - lintwarn(ext_id, _("reada: called with too many arguments")); - if (nargs < 2) goto out; @@ -470,8 +464,8 @@ read_value(FILE *fp, awk_value_t *value) } static awk_ext_func_t func_table[] = { - { "writea", do_writea, 2 }, - { "reada", do_reada, 2 }, + { "writea", do_writea, 2, 2, awk_false, NULL }, + { "reada", do_reada, 2, 2, awk_false, NULL }, }; diff --git a/extension/rwarray0.c b/extension/rwarray0.c index 00289cad..faa73783 100644 --- a/extension/rwarray0.c +++ b/extension/rwarray0.c @@ -95,7 +95,7 @@ static awk_bool_t read_value(int fd, awk_value_t *value); /* do_writea --- write an array */ static awk_value_t * -do_writea(int nargs, awk_value_t *result) +do_writea(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, array; int fd = -1; @@ -105,9 +105,6 @@ do_writea(int nargs, awk_value_t *result) assert(result != NULL); make_number(0.0, result); - if (do_lint && nargs > 2) - lintwarn(ext_id, _("writea: called with too many arguments")); - if (nargs < 2) goto out; @@ -250,7 +247,7 @@ write_value(int fd, awk_value_t *val) /* do_reada --- read an array */ static awk_value_t * -do_reada(int nargs, awk_value_t *result) +do_reada(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, array; int fd = -1; @@ -261,9 +258,6 @@ do_reada(int nargs, awk_value_t *result) assert(result != NULL); make_number(0.0, result); - if (do_lint && nargs > 2) - lintwarn(ext_id, _("reada: called with too many arguments")); - if (nargs < 2) goto out; @@ -465,8 +459,8 @@ read_value(int fd, awk_value_t *value) } static awk_ext_func_t func_table[] = { - { "writea", do_writea, 2 }, - { "reada", do_reada, 2 }, + { "writea", do_writea, 2, 2, awk_false, NULL }, + { "reada", do_reada, 2, 2, awk_false, NULL }, }; diff --git a/extension/testext.c b/extension/testext.c index 9216d64a..bf342182 100644 --- a/extension/testext.c +++ b/extension/testext.c @@ -107,7 +107,7 @@ BEGIN { } */ static awk_value_t * -dump_array_and_delete(int nargs, awk_value_t *result) +dump_array_and_delete(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t value, value2, value3; awk_flat_array_t *flat_array; @@ -201,7 +201,7 @@ BEGIN { */ static awk_value_t * -try_modify_environ(int nargs, awk_value_t *result) +try_modify_environ(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t value, index, newvalue; awk_flat_array_t *flat_array; @@ -290,7 +290,7 @@ BEGIN { */ static awk_value_t * -var_test(int nargs, awk_value_t *result) +var_test(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t value, value2; awk_value_t *valp; @@ -357,7 +357,7 @@ BEGIN { } */ static awk_value_t * -test_errno(int nargs, awk_value_t *result) +test_errno(int nargs, awk_value_t *result, struct awk_ext_func *unused) { assert(result != NULL); make_number(0.0, result); @@ -386,7 +386,7 @@ BEGIN { } */ static awk_value_t * -test_deferred(int nargs, awk_value_t *result) +test_deferred(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t arr; awk_value_t index, value; @@ -465,7 +465,7 @@ BEGIN { */ static awk_value_t * -test_array_size(int nargs, awk_value_t *result) +test_array_size(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t value; size_t count = 0; @@ -529,7 +529,7 @@ BEGIN { } */ static awk_value_t * -test_array_elem(int nargs, awk_value_t *result) +test_array_elem(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t array, index, index2, value; @@ -617,7 +617,7 @@ BEGIN { */ static awk_value_t * -test_array_param(int nargs, awk_value_t *result) +test_array_param(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t new_array; awk_value_t arg0; @@ -660,7 +660,7 @@ BEGIN { } */ static awk_value_t * -print_do_lint(int nargs, awk_value_t *result) +print_do_lint(int nargs, awk_value_t *result, struct awk_ext_func *unused) { assert(result != NULL); make_number(0.0, result); @@ -696,7 +696,7 @@ BEGIN { /* test_scalar --- test scalar cookie */ static awk_value_t * -test_scalar(int nargs, awk_value_t *result) +test_scalar(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t new_value, new_value2; awk_value_t the_scalar; @@ -743,7 +743,7 @@ BEGIN { /* test_scalar_reserved --- test scalar cookie on special variable */ static awk_value_t * -test_scalar_reserved(int nargs, awk_value_t *result) +test_scalar_reserved(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t new_value; awk_value_t the_scalar; @@ -796,7 +796,7 @@ BEGIN { /* test_indirect_vars --- test that access to NR, NF, get correct vales */ static awk_value_t * -test_indirect_vars(int nargs, awk_value_t *result) +test_indirect_vars(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t value; char *name = "NR"; @@ -844,7 +844,7 @@ BEGIN { /* test_get_file --- test that we can create a file */ static awk_value_t * -test_get_file(int nargs, awk_value_t *result) +test_get_file(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, alias; int fd; @@ -882,7 +882,7 @@ test_get_file(int nargs, awk_value_t *result) /* do_get_file --- provide access to get_file API */ static awk_value_t * -do_get_file(int nargs, awk_value_t *result) +do_get_file(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, filetype, fd, res; const awk_input_buf_t *ibuf; @@ -1024,20 +1024,20 @@ static void at_exit2(void *data, int exit_status) } static awk_ext_func_t func_table[] = { - { "dump_array_and_delete", dump_array_and_delete, 2 }, - { "try_modify_environ", try_modify_environ, 0 }, - { "var_test", var_test, 1 }, - { "test_deferred", test_deferred, 0 }, - { "test_errno", test_errno, 0 }, - { "test_array_size", test_array_size, 1 }, - { "test_array_elem", test_array_elem, 2 }, - { "test_array_param", test_array_param, 1 }, - { "print_do_lint", print_do_lint, 0 }, - { "test_scalar", test_scalar, 1 }, - { "test_scalar_reserved", test_scalar_reserved, 0 }, - { "test_indirect_vars", test_indirect_vars, 0 }, - { "test_get_file", test_get_file, 2 }, - { "get_file", do_get_file, 4 }, + { "dump_array_and_delete", dump_array_and_delete, 2, 2, awk_false, NULL }, + { "try_modify_environ", try_modify_environ, 0, 0, awk_false, NULL }, + { "var_test", var_test, 1, 1, awk_false, NULL }, + { "test_deferred", test_deferred, 0, 0, awk_false, NULL }, + { "test_errno", test_errno, 0, 0, awk_false, NULL }, + { "test_array_size", test_array_size, 1, 1, awk_false, NULL }, + { "test_array_elem", test_array_elem, 2, 2, awk_false, NULL }, + { "test_array_param", test_array_param, 1, 1, awk_false, NULL }, + { "print_do_lint", print_do_lint, 0, 0, awk_false, NULL }, + { "test_scalar", test_scalar, 1, 1, awk_false, NULL }, + { "test_scalar_reserved", test_scalar_reserved, 0, 0, awk_false, NULL }, + { "test_indirect_vars", test_indirect_vars, 0, 0, awk_false, NULL }, + { "test_get_file", test_get_file, 2, 2, awk_false, NULL }, + { "get_file", do_get_file, 4, 4, awk_false, NULL }, }; /* init_testext --- additional initialization function */ diff --git a/extension/time.c b/extension/time.c index e6b2b39f..01be7784 100644 --- a/extension/time.c +++ b/extension/time.c @@ -103,15 +103,12 @@ int plugin_is_GPL_compatible; * on the platform */ static awk_value_t * -do_gettimeofday(int nargs, awk_value_t *result) +do_gettimeofday(int nargs, awk_value_t *result, struct awk_ext_func *unused) { double curtime; assert(result != NULL); - if (do_lint && nargs > 0) - lintwarn(ext_id, _("gettimeofday: ignoring arguments")); - #if defined(HAVE_GETTIMEOFDAY) { struct timeval tv; @@ -153,7 +150,7 @@ do_gettimeofday(int nargs, awk_value_t *result) * did not complete successfully (perhaps interrupted) */ static awk_value_t * -do_sleep(int nargs, awk_value_t *result) +do_sleep(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t num; double secs; @@ -161,9 +158,6 @@ do_sleep(int nargs, awk_value_t *result) assert(result != NULL); - if (do_lint && nargs > 1) - lintwarn(ext_id, _("sleep: called with too many arguments")); - if (! get_argument(0, AWK_NUMBER, &num)) { update_ERRNO_string(_("sleep: missing required numeric argument")); return make_number(-1, result); @@ -212,8 +206,8 @@ do_sleep(int nargs, awk_value_t *result) } static awk_ext_func_t func_table[] = { - { "gettimeofday", do_gettimeofday, 0 }, - { "sleep", do_sleep, 1 }, + { "gettimeofday", do_gettimeofday, 0, 0, awk_false, NULL }, + { "sleep", do_sleep, 1, 1, awk_false, NULL }, }; /* define the dl_load function using the boilerplate macro */ |