#
#	Copyright (c) 1995, 1996, Sun Microsystems, Inc.
#
# This software is provided by Sun ``AS IS'' and any express or implied
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose are disclaimed.
# In no event shall Sun Microsystems be liable for any direct, indirect,
# incidental, special, exemplary, or consequential damages.
#
# This software is not a product, and is provided for evaluation purposes
# only.
#
# This software may not be resold without the express permission of
# Sun Microsystems.
#
# Feedback on this tool may be sent to packet-shell-owner@sunroof.eng.sun.com.
#
# Packet Shell Tcl/Tk Resource File
#
# @(#)pshrc	1.8
#

# Change prompt to command (history)

set tcl_prompt1 {
	puts -nonewline [format "%s(%s): " [file tail $argv0] [expr [history nextid]-1]]
}

# Define an unknown proc to mention pinfo command

proc unknown {name args} {
	set cmds [info commands $name*]
	if {[llength $cmds] != 1} {
		error "Unknown command \"$name\", try the pinfo command for help"
	}
	uplevel $cmds $args
}

proc ? {} {global errorInfo; puts $errorInfo}

# Set some configuration parameters

if {[info exists env(PSH_TCLLIB)]} {
	set altbaseDir $env(PSH_TCLLIB)
}

set baseDir $PSH_TCLLIB
 
proc Source {name} {
	global baseDir

	if {[catch {uplevel source -rsrc $name}]} {
		uplevel source [list [file join $baseDir $name]]
	}
}

# Scan the current directory for proto definitions (*.proto)
# and source them with above proc

catch {
 foreach x [glob $baseDir/*.proto] {
	if [catch "Source $x" outstr] {
		puts "Error in $x: $outstr"
	}
 }
}

# also *.tcl files

catch {
 foreach x [glob $baseDir/*.tcl] {
	if [catch "Source $x" outstr] {
		puts "Error in $x: $outstr"
	}
 }
}

# also *.tk files

if [info exists tk_library] {
 catch {
  foreach x [glob $baseDir/*.tk] {
	if [catch "Source $x" outstr] {
		puts "Error in $x: $outstr"
	}
  }
 }
}

catch {if {[info exists $altbaseDir]} {
		foreach x [glob $altbaseDir/*] {
			if [catch "Source $x" outstr] {
				puts "Error in $x: $outstr"
			}
		}
	}
}

puts $psh_version
