diff options
-rwxr-xr-x | cppawk | 3 | ||||
-rw-r--r-- | cppawk-include/stdver.h | 1 | ||||
-rw-r--r-- | cppawk.1 | 12 | ||||
-rw-r--r-- | testcases | 8 |
4 files changed, 24 insertions, 0 deletions
@@ -39,6 +39,7 @@ awk_opts= tmp_file= delhashbang="sed -e /^#!/d --" prepro_only= +selfdir=$(dirname "$0") # functions @@ -69,6 +70,8 @@ die() exit 1 } +prepro_opts="$prepro_opts -I$selfdir/cppawk-include" + while [ $# -gt 0 ] ; do case $1 in -M?* ) diff --git a/cppawk-include/stdver.h b/cppawk-include/stdver.h new file mode 100644 index 0000000..468b993 --- /dev/null +++ b/cppawk-include/stdver.h @@ -0,0 +1 @@ +#define __cppawk_ver 20220318 @@ -97,6 +97,18 @@ Options which match these patterns are passed to the program instead of .BR awk . +.SH STANDARD HEADERS +.B cppawk +points the preprocessor to look for +.BI "#include <...>" +files in its own directory. The +.BI "<stdver.h>" +header defines a preprocessor symbol +.BI __cppawk_ver +whose value is a decimal integer the form +.IR YYYYMMDD , +such as 20220318. + .SH EXAMPLES Print the larger of field 1 or 2: @@ -153,3 +153,11 @@ abc ./cppawk -v foo="abc'def" 'BEGIN { print foo }' : abc'def +-- +29: +./cppawk ' +#include <stdver.h> + +BEGIN { print __cppawk_ver >= 20220318 }' +: +1 |