Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/sqlite/src/tool/replace.tcl

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/tcl 1 #!/usr/bin/tcl
2 # 2 #
3 # Replace string with another string -OR- include 3 # Replace string with another string -OR- include
4 # only lines successfully modified with a regular 4 # only lines successfully modified with a regular
5 # expression. 5 # expression.
6 # 6 #
7 fconfigure stdout -translation binary -encoding binary
8 fconfigure stderr -translation binary -encoding binary
7 set mode [string tolower [lindex $argv 0]] 9 set mode [string tolower [lindex $argv 0]]
8 set from [lindex $argv 1] 10 set from [lindex $argv 1]
9 set to [lindex $argv 2] 11 set to [lindex $argv 2]
10 if {$mode ni [list exact include]} {exit 1} 12 if {$mode ni [list exact regsub include]} {exit 1}
11 if {[string length $from]==0} {exit 2} 13 if {[string length $from]==0} {exit 2}
12 while {![eof stdin]} { 14 while {![eof stdin]} {
13 set line [gets stdin] 15 set line [gets stdin]
14 if {[eof stdin]} break 16 if {[eof stdin]} break
15 switch -exact $mode { 17 switch -exact $mode {
16 exact {set line [string map [list $from $to] $line]} 18 exact {set line [string map [list $from $to] $line]}
19 regsub {regsub -all -- $from $line $to line}
17 include {if {[regsub -all -- $from $line $to line]==0} continue} 20 include {if {[regsub -all -- $from $line $to line]==0} continue}
18 } 21 }
19 puts stdout $line 22 puts stdout $line
20 } 23 }
OLDNEW
« no previous file with comments | « third_party/sqlite/src/tool/opcodesum.tcl ('k') | third_party/sqlite/src/tool/run-speed-test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698