1*91ed9ce0Sdrh#!/usr/bin/tclsh 2*91ed9ce0Sdrh# 3*91ed9ce0Sdrh# Given an sqlite3.c source file identified by the command-line 4*91ed9ce0Sdrh# argument, extract the "sqlite3.h" header file that is embedded inside 5*91ed9ce0Sdrh# the sqlite3.c source file and write it to standard output. 6*91ed9ce0Sdrh# 7*91ed9ce0Sdrhif {[llength $argv]!=1} { 8*91ed9ce0Sdrh puts stderr "Usage: $argv0 sqlite3.c >sqlite3.h" 9*91ed9ce0Sdrh exit 1 10*91ed9ce0Sdrh} 11*91ed9ce0Sdrhset in [open [lindex $argv 0] rb] 12*91ed9ce0Sdrhwhile {![eof $in]} { 13*91ed9ce0Sdrh set line [gets $in] 14*91ed9ce0Sdrh if {[string match {* Begin file sqlite3.h *} $line]} break 15*91ed9ce0Sdrh} 16*91ed9ce0Sdrhwhile {![eof $in]} { 17*91ed9ce0Sdrh set line [gets $in] 18*91ed9ce0Sdrh if {[string match {* End of sqlite3.h *} $line]} break 19*91ed9ce0Sdrh puts $line 20*91ed9ce0Sdrh} 21*91ed9ce0Sdrhclose $in 22