[Click] [PATCH] enhanced print for Script

Eddie Kohler kohler at cs.ucla.edu
Wed Apr 9 14:34:21 EDT 2008


Good idea!  I've implemented it, but with a separate "printn" command, rather 
than "print -n".

Eddie


Marco Canini wrote:
> -----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-----
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


More information about the click mailing list