From f2b6d100d8958a9c811c950f113a0ce38a25d484 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 6 Dec 2016 22:06:26 +0200 Subject: Add min_required and max_expected arg counts to API. --- extension/fork.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'extension/fork.c') diff --git a/extension/fork.c b/extension/fork.c index 82593b7f..064a2a8c 100644 --- a/extension/fork.c +++ b/extension/fork.c @@ -77,9 +77,6 @@ do_fork(int nargs, awk_value_t *result) assert(result != NULL); - if (do_lint && nargs > 0) - lintwarn(ext_id, _("fork: called with too many arguments")); - ret = fork(); if (ret < 0) @@ -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); @@ -139,9 +132,6 @@ do_wait(int nargs, awk_value_t *result) 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 }, + { "waitpid", do_waitpid, 1, 1 }, + { "wait", do_wait, 0, 0 }, }; /* define the dl_load function using the boilerplate macro */ -- cgit v1.2.3 From 0855ef4db6d8e0d1d57776eb273c9de321bfd6cf Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 14 Dec 2016 21:25:20 +0200 Subject: Fix lint stuff, arg checking. Add a data pointer. Pass finfo to functions. --- extension/fork.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'extension/fork.c') diff --git a/extension/fork.c b/extension/fork.c index 064a2a8c..823506dd 100644 --- a/extension/fork.c +++ b/extension/fork.c @@ -71,7 +71,7 @@ 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; @@ -103,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; @@ -126,7 +126,7 @@ 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; @@ -141,9 +141,9 @@ do_wait(int nargs, awk_value_t *result) } static awk_ext_func_t func_table[] = { - { "fork", do_fork, 0, 0 }, - { "waitpid", do_waitpid, 1, 1 }, - { "wait", do_wait, 0, 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 */ -- cgit v1.2.3