aboutsummaryrefslogtreecommitdiffstats
path: root/awk.h
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2016-06-27 20:36:13 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2016-06-27 20:36:13 -0400
commit25b0547949a05839988dae236fa9a28be6573586 (patch)
tree3d6956ea1b5cdfcd3716adeed905b4fe861ff210 /awk.h
parente4863f1b6341cbcc4132a8161e000e81092b4d65 (diff)
downloadegawk-25b0547949a05839988dae236fa9a28be6573586.tar.gz
egawk-25b0547949a05839988dae236fa9a28be6573586.tar.bz2
egawk-25b0547949a05839988dae236fa9a28be6573586.zip
Add comment to awk.h regarding the potential lack of NUL-termination for strings.
Diffstat (limited to 'awk.h')
-rw-r--r--awk.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/awk.h b/awk.h
index 1d1e4fb8..c737c16b 100644
--- a/awk.h
+++ b/awk.h
@@ -476,6 +476,13 @@ typedef struct exp_node {
#define re_cnt flags
/* Node_val */
+/*
+ * Note that the string in stptr may not be NUL-terminated, but it is
+ * guaranteed to have at least one extra byte that may be temporarily set
+ * to '\0'. This is helpful when calling functions such as strtod that require
+ * a NUL-terminated argument. In particular, field values $n for n > 0 and
+ * n < NF will not have a NUL terminator, since they point into the $0 buffer.
+ */
#define stptr sub.val.sp
#define stlen sub.val.slen
#define valref sub.val.sref