@@ -1,8 +1,8 @@ #!/usr/local/bin/tclsh # FILE: "/diska/home/joze/src/tclreadline/tclreadlineSetup.tcl.in" -# LAST MODIFICATION: "Wed Aug 25 11:12:19 1999 (joze)" +# LAST MODIFICATION: "Wed Aug 25 14:49:37 1999 (joze)" # (C) 1998, 1999 by Johannes Zellner, # $Id$ # --- # # tclreadline -- gnu readline for tcl @@ -322,11 +322,11 @@ } else { eval exec ls -FC [::tclreadline::Glob $args] } } -proc ::tclreadline::Setup {} { +proc ::tclreadline::Setup {args} { uplevel #0 { if {[info commands ::tclreadline::readline] == ""} { ::tclreadline::Init @@ -390,14 +390,24 @@ } global env variable historyfile - if [info exists env(HOME)] { - set historyfile $env(HOME)/.tclsh-history + if {[string trim [llength ${args}]]} { + set historyfile "" + catch { + set historyfile [file nativename [lindex ${args} 0]] + } + if {"" == [string trim $historyfile]} { + set historyfile [lindex ${args} 0] + } } else { - set historyfile .tclsh-history + if [info exists env(HOME)] { + set historyfile $env(HOME)/.tclsh-history + } else { + set historyfile .tclsh-history + } } set msg [::tclreadline::readline initialize $historyfile] if {$msg != ""} { puts stderr "$msg" } @@ -428,13 +438,13 @@ return [eval concat $commandstring] } -proc ::tclreadline::Loop {} { +proc ::tclreadline::Loop {args} { - ::tclreadline::Setup + eval ::tclreadline::Setup ${args} uplevel #0 { while {1} {