aboutsummaryrefslogtreecommitdiffstats
path: root/cppawk.1
diff options
context:
space:
mode:
Diffstat (limited to 'cppawk.1')
-rw-r--r--cppawk.116
1 files changed, 11 insertions, 5 deletions
diff --git a/cppawk.1 b/cppawk.1
index b87cb37..9dbc403 100644
--- a/cppawk.1
+++ b/cppawk.1
@@ -236,13 +236,16 @@ manual page.
.SH EXAMPLES
Print the larger of field 1 or 2:
- cppawk '// C comment
- #define max(a, b) ((a) > (b) ? (a) : (b))
- { print max($1, $2) /* C comment */ } #awk comment'
+.ft B
+ cppawk '\fI// C comment\fP
+ #define max(\fIa\fP, \fIb\fP) ((\fIa\fP) > (\fIb\fP) ? (\fIa\fP) : (\fIb\fP))
+ { print max($1, $2) /* C comment */ } \fI#awk comment\fP'
+.ft R
Implement awk-like processing loop within function, to process
/proc/mounts:
+.ft B
#include "awkloop.h"
function main()
@@ -256,14 +259,17 @@ Implement awk-like processing loop within function, to process
BEGIN {
main()
}
+.ft R
Where
.B awkloop.h
contains:
- #define awkloop(file) for (; getline < file || (close(file) && 0); )
+.ft B
+ #define awkloop(\fIfile\fP) for (; getline < \fIfile\fP || (close(\fIfile\fP) && 0); )
#define nextrec continue
- #define rule(cond) if (cond)
+ #define rule(\fIcond\fP) if (\fIcond\fP)
+.ft R
.SH "SEE ALSO"
awk(1), cpp(6), cppawk-narg(1), cppawk-case(1), cppawk-cons(1)