aboutsummaryrefslogtreecommitdiffstats
path: root/extension
diff options
context:
space:
mode:
Diffstat (limited to 'extension')
-rw-r--r--extension/ChangeLog5
-rw-r--r--extension/ordchr.c16
2 files changed, 17 insertions, 4 deletions
diff --git a/extension/ChangeLog b/extension/ChangeLog
index a1ba2e90..a0cc713d 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-29 Arnold D. Robbins <arnold@skeeve.com>
+
+ * ordchr.c (do_ord, do_chr): Improve argument checking and
+ lint messages.
+
2012-06-25 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): Remove *.awk.
diff --git a/extension/ordchr.c b/extension/ordchr.c
index ba29d132..8d7eac8f 100644
--- a/extension/ordchr.c
+++ b/extension/ordchr.c
@@ -61,8 +61,12 @@ do_ord(int nargs, awk_value_t *result)
if (get_argument(0, AWK_STRING, & str)) {
ret = str.str_value.str[0];
- } else if (do_lint)
- lintwarn(ext_id, "ord: called with no arguments");
+ } 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)");
+ }
/* Set the return value */
return make_number(ret, result);
@@ -91,8 +95,12 @@ do_chr(int nargs, awk_value_t *result)
ret &= 0xff;
str[0] = ret;
str[1] = '\0';
- } else if (do_lint)
- lintwarn(ext_id, "chr: called with no arguments");
+ } 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)");
+ }
/* Set the return value */
return dup_string(str, 1, result);