*** parray.tcl	Wed Sep 11 16:29:14 2002
--- parray2.tcl	Wed Sep 11 16:36:02 2002
***************
*** 10,16 ****
  # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  #
  
! proc parray {a {pattern *}} {
      upvar 1 $a array
      if {![array exists array]} {
  	error "\"$a\" isn't an array"
--- 10,42 ----
  # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  #
  
! proc parray args {
!     switch -exact -- [llength $args] {
! 	1 {
! 	    set chan stdout
! 	    set a $args
! 	    set pattern *
! 	}
! 	2 {
! 	    # is the first arg a channel?
! 	    if {[catch {tell [lindex $args 0]} out] == 0} {
! 		# yep
! 		foreach {chan a } $args break
! 		set pattern *
! 	    } else {
! 		# nope
! 		foreach {a pattern} $args break
! 		set chan stdout
! 	    }
! 	}
! 	3 {
! 	    foreach {chan a pattern} $args break
! 	}
! 	default {
! 	    error "wrong # args: should be \"[lindex [info level 0] 0] ?channelID? arrayName ?pattern?\""
! 	}
!     }
! 
      upvar 1 $a array
      if {![array exists array]} {
  	error "\"$a\" isn't an array"
***************
*** 24,29 ****
      set maxl [expr {$maxl + [string length $a] + 2}]
      foreach name [lsort [array names array $pattern]] {
  	set nameString [format %s(%s) $a $name]
! 	puts stdout [format "%-*s = %s" $maxl $nameString $array($name)]
      }
  }
--- 50,55 ----
      set maxl [expr {$maxl + [string length $a] + 2}]
      foreach name [lsort [array names array $pattern]] {
  	set nameString [format %s(%s) $a $name]
! 	puts $chan [format "%-*s = %s" $maxl $nameString $array($name)]
      }
  }
