summaryrefslogtreecommitdiffstats
path: root/doc/scan.n
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-01-20 13:42:17 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-01-20 13:42:17 (GMT)
commit1549d82a2029add6f62dde489d26a70b466f4fd0 (patch)
tree6b453022eb94d1d13ccd73cb7e033e4859af45fd /doc/scan.n
parentee1c40272a0ee43da070323282205173df4a8816 (diff)
downloadtcl-1549d82a2029add6f62dde489d26a70b466f4fd0.zip
tcl-1549d82a2029add6f62dde489d26a70b466f4fd0.tar.gz
tcl-1549d82a2029add6f62dde489d26a70b466f4fd0.tar.bz2
Use a consistent indentation of 4 for code examples.
Diffstat (limited to 'doc/scan.n')
-rw-r--r--doc/scan.n27
1 files changed, 15 insertions, 12 deletions
diff --git a/doc/scan.n b/doc/scan.n
index 48b5df1..7f2eb65 100644
--- a/doc/scan.n
+++ b/doc/scan.n
@@ -6,7 +6,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: scan.n,v 1.28 2009/02/24 21:04:58 dkf Exp $
+'\" RCS: @(#) $Id: scan.n,v 1.29 2010/01/20 13:42:17 dkf Exp $
'\"
.so man.macros
.TH scan n 8.4 Tcl "Tcl Built-In Commands"
@@ -235,11 +235,11 @@ care, we would use the \fB%i\fR conversion instead):
.CS
set string "08:08" ;# *Not* octal!
if {[\fBscan\fR $string "%d:%d" hours minutes] != 2} {
- error "not a valid time string"
+ error "not a valid time string"
}
# We have to understand numeric ranges ourselves...
if {$minutes < 0 || $minutes > 59} {
- error "invalid number of minutes"
+ error "invalid number of minutes"
}
.CE
.PP
@@ -251,8 +251,8 @@ leading whitespace correct):
set string " a string {with braced words} + leading space "
set words {}
while {[\fBscan\fR $string %s%n word length] == 2} {
- lappend words $word
- set string [string range $string $length end]
+ lappend words $word
+ set string [string range $string $length end]
}
.CE
.PP
@@ -265,10 +265,10 @@ set string "(5.2,-4e-2)"
# the scan pattern are significant, and that ")" is
# the Unicode character \eu0029
if {
- [\fBscan\fR $string " (%f ,%f %c" x y last] != 3
- || $last != 0x0029
+ [\fBscan\fR $string " (%f ,%f %c" x y last] != 3
+ || $last != 0x0029
} then {
- error "invalid coordinate string"
+ error "invalid coordinate string"
}
puts "X=$x, Y=$y"
.CE
@@ -277,16 +277,19 @@ An interactive session demonstrating the truncation of integer
values determined by size modifiers:
.PP
.CS
-% set tcl_platform(wordSize)
+\fI%\fR set tcl_platform(wordSize)
4
-% scan 20000000000000000000 %d
+\fI%\fR scan 20000000000000000000 %d
2147483647
-% scan 20000000000000000000 %ld
+\fI%\fR scan 20000000000000000000 %ld
9223372036854775807
-% scan 20000000000000000000 %lld
+\fI%\fR scan 20000000000000000000 %lld
20000000000000000000
.CE
.SH "SEE ALSO"
format(n), sscanf(3)
.SH KEYWORDS
conversion specifier, parse, scan
+'\" Local Variables:
+'\" mode: nroff
+'\" End: