From 0e0f32eb8d4377dd8b2750a4e81c553d68391e63 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 18 Mar 2022 21:28:29 -0700 Subject: Add cppawk-include directory and header. --- cppawk | 3 +++ cppawk-include/stdver.h | 1 + cppawk.1 | 12 ++++++++++++ testcases | 8 ++++++++ 4 files changed, 24 insertions(+) create mode 100644 cppawk-include/stdver.h diff --git a/cppawk b/cppawk index ebf9ff1..f7d0c33 100755 --- a/cppawk +++ b/cppawk @@ -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 diff --git a/cppawk.1 b/cppawk.1 index 42902a6..fc86e38 100644 --- a/cppawk.1 +++ b/cppawk.1 @@ -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 "" +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: diff --git a/testcases b/testcases index caef473..091f19d 100644 --- a/testcases +++ b/testcases @@ -153,3 +153,11 @@ abc ./cppawk -v foo="abc'def" 'BEGIN { print foo }' : abc'def +-- +29: +./cppawk ' +#include + +BEGIN { print __cppawk_ver >= 20220318 }' +: +1 -- cgit v1.2.3