#!/opt0/tcl/bin/sywish
#
# TO CONFIGURE:  CHANGE THIS PATH to the actual home of the tlib.
#
set tclroot /opt0/tcl
set whichapp "wisql"
#
set config 0
if {[file exists $tclroot/lib/ucosybtk/.ucosybtk.cf]} {
        source $tclroot/lib/ucosybtk/.ucosybtk.cf
	puts stderr "using generic cf file $tclroot/lib/ucosybtk/.ucosybtk.cf"
        incr config
} else {
        puts stderr "WARNING!  WARNING!  no global config file!"
        puts stderr "$tclroot/lib/ucosybtk/.ucosybtk.cf not found!"
}
if {[file exists ~[id user]/.ucosybtk.cf]} {
	puts stderr "using private cf file ~[id user]/.ucosybtk.cf"
        source ~[id user]/.ucosybtk.cf
        incr config
}
#
if {!$config} {
        puts stderr "No .ucosybtk.cf found in $tclroot/lib/ucosybtk or in login dir."
        puts stderr "Unable to configure until you remedy this problem."
        puts stderr "Try installing the sample.ucosybtk.cf from the distrib"
        puts stderr "    as $tclroot/lib/ucosybtk/.ucosybtk.cf"
        exit 1
}
#
loadlibindex /u/de/tcl/s/ucosyb.tlib
loadlibindex /u/de/tcl/w/wisql.tlib
#
#  wisql
# 	
#  Copyright 1992 Tom Poindexter, 1993-5 Tom Poindexter and
#	the Regents of the University of California
#
#  a windowing version of the sybase isql command  
#  uses extended tcl, tk, and sybtcl interface
#
#  usage: wisql
#
#---------------------------------------------------------------------------
# RCS
#
# $Header$
#
#---------------------------------------------------------------------------
# RELEASE
#
# CURRENT REV: 	4.1.6  (see the patchlevel file)
#
#---------------------------------------------------------------------------

# rel 1.5 changes to the standard ucosyb library for more flexibility
# global syb
global dbpipe1

global currentFile
global fontSize
global execCmd
global start

global cmdRing
global cmdIdx
global cmdLast

global mode

global bitmapdir
global exedir
global maven

set release 4.1.6

#	normal mode is User or NonExpert
#	expert mode permits user to see text of objects
#	the cmdXXX stuff lets us keep a ring buffer of SQL commands
#
set cmdIdx  0
set cmdLast 0
for {set i 0} {$i < 10} {incr i} {
  set cmdRing($i) ""
}
#
#	and we will set ourselves up to use various - flags if we want to
#	at some later time.
#
foreach arg $argv {
	if {[crange $arg 0 0] == "-"} {
		case [crange $arg 1 end] in {
		{x} {
			set mode 1
		}
		}
	} else {
		set uname $arg
		if {$uname == "sa"} {set mode 1}
	}
}
	

# set startT [getclock]
# echo "starting wisql at 0 seconds"

set execCmd doSql
set fontSize 14

set syb {}
set currentFile {}
set table ""

wm title    . "Wisql:  X11 GUI for Sybase rev $release"
wm iconname . "Wisql"

# use the tkmail bindings, with whatever hacks we add locally
# if the enhanced bindxtnd.tcl is not the default, source it
        if {[info proc tkBindDefVar]==""} {
          foreach key [bind Text] { bind Text $key {} }
          foreach key [bind Entry] { bind Entry $key {} }
          source $tclroot/lib/tkbind/bindxtnd.tcl
          source $tclroot/lib/tkbind/text.tcl
          source $tclroot/lib/tkbind/entry.tcl
          # source additional packages here
        }

# kick off the entire process

getSignOn

# that's all it takes

