summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2019-02-25 09:15:02 +0200
committerArnold D. Robbins <arnold@skeeve.com>2019-02-25 09:15:02 +0200
commit44611db36ba329fab248179e0350d44fcff5e3c2 (patch)
treefc1e2676b5c0d2865257aaf65cd66b1f5f473cb5 /eval.c
parentef25d1166e7a183dd4d07f73904775234359de81 (diff)
downloadgawk-44611db36ba329fab248179e0350d44fcff5e3c2.tar.gz
Improvements for z/OS, building and test suite.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 4858fa69..4650150b 100644
--- a/eval.c
+++ b/eval.c
@@ -1023,7 +1023,23 @@ update_ERRNO_string(const char *string)
{
update_PROCINFO_num("errno", 0);
unref(ERRNO_node->var_value);
- ERRNO_node->var_value = make_string(string, strlen(string));
+ size_t len = strlen(string);
+#if defined(USE_EBCDIC) && defined(ELIDE_IBM_ERROR_CODE)
+ // skip over leading IBM error code
+ // N.B. This code is untested
+ if (isupper(string[0]) && isupper(string[1])) {
+ while (*string && *string != ' ')
+ string++;
+
+ while (*string && *string == ' ')
+ string++;
+
+ len = strlen(string);
+ if (string[len-1] == '.')
+ len--; // remove the final '.'
+ }
+#endif
+ ERRNO_node->var_value = make_string(string, len);
}
/* unset_ERRNO --- eliminate the value of ERRNO */