Wapp

Diff
Login

Differences From Artifact [f2e6da6a2e]:

To Artifact [53168977aa]:


1
2
3
4
5


6











7
8
9
10
11
12


13
14
15
# This script runs to initialize wapptclsh.
#
proc initialize_wapptclsh {} {
  global argv argv0 main_script
  if {[llength $argv]==0} return


  set script [lindex $argv 0]











  if {[file readable $script]} {
    set fd [open $script r]
    set main_script [read $fd]
    close $fd
    set argv [lrange $argv 1 end]
    set argv0 $script


  }
}
initialize_wapptclsh




|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
|





>
>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# This script runs to initialize wapptclsh.
#
proc initialize_wapptclsh {} {
  global argv argv0 main_script
  if {[llength $argv]==0} {
    set script --help
  } else {
    set script [lindex $argv 0]
  }
  if {[string index $script 0]=="-"} {
    set opt [string trim $script -]
    if {$opt=="v"} {
      puts stderr "Wapp using SQLite version [sqlite3 -version]"
    } else {
      puts stderr "Usage: $argv0 FILENAME"
      puts stderr "Options:"
      puts stderr "   -v      Show version information"
    }
    exit 1
  } elseif {[file readable $script]} {
    set fd [open $script r]
    set main_script [read $fd]
    close $fd
    set argv [lrange $argv 1 end]
    set argv0 $script
  } else {
    puts stderr "unknown option: \"$script\"\nthe --help option is available"
  }
}
initialize_wapptclsh