[Click] [PATCH] enhanced print for Script

Marco Canini marco at reti.dist.unige.it
Tue Apr 1 10:14:24 EDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear all,
I'm attaching a patch that modifies the Script's print command to allow
one to specify the -n switch causing print not to append \n to the
output text.
I'd thought it might be useful for others so please consider to
integrate this patch into click.

This is the use case for which I needed that feature:

[...]
c::Counter->
[...]

Script(
label rate_stats,
print -n "\rPkts: ",
print -n c.count,
print -n "\tBytes: ",
print -n c.byte_count,
print -n "\tPkt/s: ",
print -n c.rate,
print -n "          ",
wait 1s,
goto rate_stats
);

it basically gives me a nice status line in the terminal.

- --
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)

iD8DBQFH8kNAK52QDm/mFCkRAic/AKCcQxr2pLspifLGvKkW1e+79w5q1wCgz1zR
9UHYvZyvSYnuEWd7ME8H6ro=
=tIFI
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: script.cc.patch
Url: https://pdos.csail.mit.edu/pipermail/click/attachments/20080401/905e7deb/attachment.txt 


More information about the click mailing list