diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2010-01-20 13:42:17 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2010-01-20 13:42:17 (GMT) |
commit | 1549d82a2029add6f62dde489d26a70b466f4fd0 (patch) | |
tree | 6b453022eb94d1d13ccd73cb7e033e4859af45fd /doc/chan.n | |
parent | ee1c40272a0ee43da070323282205173df4a8816 (diff) | |
download | tcl-1549d82a2029add6f62dde489d26a70b466f4fd0.zip tcl-1549d82a2029add6f62dde489d26a70b466f4fd0.tar.gz tcl-1549d82a2029add6f62dde489d26a70b466f4fd0.tar.bz2 |
Use a consistent indentation of 4 for code examples.
Diffstat (limited to 'doc/chan.n')
-rw-r--r-- | doc/chan.n | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: chan.n,v 1.25 2010/01/14 11:47:08 dkf Exp $ +'\" RCS: @(#) $Id: chan.n,v 1.26 2010/01/20 13:42:17 dkf Exp $ .so man.macros .TH chan n 8.5 Tcl "Tcl Built-In Commands" .BS @@ -769,24 +769,24 @@ set offset 0 \fI# Search for string "FOOBAR" in the file\fR while {[\fBchan gets\fR $f line] >= 0} { - set idx [string first FOOBAR $line] - if {$idx > -1} { - \fI# Found it; rewrite line\fR + set idx [string first FOOBAR $line] + if {$idx > -1} { + \fI# Found it; rewrite line\fR - \fBchan seek\fR $f [expr {$offset + $idx}] - \fBchan puts\fR -nonewline $f BARFOO + \fBchan seek\fR $f [expr {$offset + $idx}] + \fBchan puts\fR -nonewline $f BARFOO - \fI# Skip to end of following line, and truncate\fR - \fBchan gets\fR $f - \fBchan gets\fR $f - \fBchan truncate\fR $f + \fI# Skip to end of following line, and truncate\fR + \fBchan gets\fR $f + \fBchan gets\fR $f + \fBchan truncate\fR $f - \fI# Stop searching the file now\fR - break - } + \fI# Stop searching the file now\fR + break + } - \fI# Save offset of start of next line for later\fR - set offset [\fBchan tell\fR $f] + \fI# Save offset of start of next line for later\fR + set offset [\fBchan tell\fR $f] } \fBchan close\fR $f .CE |