[Click] preprocessing click configuration files
Marco Canini
marco at reti.dist.unige.it
Wed Jul 23 19:27:36 EDT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I thought I'd share this with the list.
I found a pretty cool text preprocessor similar to the C preprocessor.
It got developed by Mozilla.
You can download it here
http://mxr.mozilla.org/mozilla-central/source/config/preprocessor.pl?raw=1
You can find the docs here
http://developer.mozilla.org/en/docs/Build:Text_Preprocessor
It has more features then a C preprocessor.
One of them that I really needed is variable substitution which can be
combined with the ability to import all the environment variables.
I tend to run it like this:
preprocessor.pl -E -Fsubstitution
So, if I had an environment variable, say DAG, I can do something like
this without the hassle of using the cmd line argument -DDAG:
From at DAG@Dump(-, STOP true, FORCE_IP true)->
Another example: I like to have some form of feedback during trace
analysis so I add this to my configs:
#ifndef QUIET
Script(
label rate_stats,
printn "\rPkts: ",
printn c.count,
printn "\tBytes: ",
printn c.byte_count,
printn "\tPkt/s: ",
printn c.rate,
printn " ",
wait 1s,
goto rate_stats
);
#endif
and when I don't want verbose output I can just execute click with
QUIET=1 click config.click
Hope someone will find this stuff useful.
Cheers
- --
Marco Canini
Ph.D. Candidate
Department of Communication, Computer and System Sciences
University of Genoa
Via all'Opera Pia 13
16145 Genoa Italy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
iD8DBQFIh75oK52QDm/mFCkRArKOAJwPOTsBoLpIGNzSC8jHo7rw7gpZMACeJlB8
sLt8nmjzvZw+XGJdl2rJF9Q=
=AZNr
-----END PGP SIGNATURE-----
More information about the click
mailing list