/usr/lib/grass64/etc/dm/tksys.tcl is in grass-gui 6.4.3-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | #!/bin/sh
# the next line restarts using wish \
exec $GRASS_WISH "$0" "$@"
# tksys.tcl
# get some basic system information
# from within tcl/tk.
# Designed to work with tcl/tk 8.0 and above.
# Works in a terminal window and
# in a graphics window (X Window, MS Windows, Macintosh)
#
# andreas.lange@rhein-main.de
array set items {
platform "Platform "
os "Operating System "
osVersion "OS Version "
machine "Processor Type (arch) "
user "User Name "
hostname "Hostname "
tclversion "Tcl Version "
nameofexecutable \
"Name of Executable "
patchlevel "Tcl Version/Patchlevel "
uname "Full OS ID "
script "Name of current Script " }
array set range {
1 platform
2 os
3 osVersion
4 machine
5 uname
7 patchlevel
8 nameofexecutable
9 script
10 hostname
11 user }
# tclversion is the same as patchlevel
# 6 tclversion
array set tcl_platform_subst {
unix "Unix"
windows "MS Windows"
macintosh "Apple Macintosh" }
array set tcl_machine_subst { }
array set tcl_os_subst { }
proc sys_getinfo { } \
{
global sys tcl_platform tcl_platform_subst
if { [info exists tcl_platform(platform)] } \
{
set sys(platform) $tcl_platform_subst($tcl_platform(platform))
} else {
set sys(platform) "Unknown"
}
foreach name { os osVersion machine user } \
{
if { [info exists tcl_platform($name)] } \
{
set sys($name) $tcl_platform($name)
} else {
set sys($name) "unknown"
}
}
# fix for tcl/tk 8.0, where tcl_platform(user) is missing
if { [string compare "$sys(user)" "unknown"] == 0 && \
[string compare "$sys(platform)" "$tcl_platform_subst(unix)"] == 0 } \
{
set sys(user) [exec whoami]
}
set host [info hostname]
if { [string length $host] == 0 } \
{
set sys(hostname) "hostname not available"
} else {
set sys(hostname) $host
}
foreach name { tclversion nameofexecutable patchlevel script } \
{
set tmp [info $name]
if { [info exists tmp] } \
{
set sys($name) $tmp
} else {
set sys($name) "n/a"
}
}
if { [string compare "$sys(platform)" "$tcl_platform_subst(unix)"] == 0 } \
{
set tmp [exec uname -srm]
regsub -all { } $tmp {-} tmp
set sys(uname) $tmp
} else {
set sys(uname) "unsupported"
}
return
}
proc hline { {sign "-"} {nbr 75} } \
{
# string repeat was added with tcl/tk 8.1
# set string [string repeat $sign $nbr]
set string $sign
for { set i 0 } { $i < $nbr } { incr i 1 } \
{
append string $sign
}
return $string
}
proc sys_putinfo { path } \
{
global sys range items
puts $path "\n"
puts $path [hline "="]
puts $path "System Information"
puts $path [hline "="]
foreach index [lsort -integer [array names range]] \
{
set name $range($index)
set string $items($name)
puts $path "$string $sys($name)"
puts $path [hline]
}
return
}
proc sys_wininfo { } \
{
global sys range items
frame .frame0 -borderwidth 2 -relief raised
frame .frame0.heading -borderwidth 2
set t [text .frame0.heading.text -relief ridge \
-height 1 -width 50 \
-font {Helvetica -12 bold} ]
$t tag configure all -justify center
$t insert end "System Information\n"
$t tag add all 1.0 end
$t configure -state disabled
pack .frame0 -side top -fill x
pack .frame0.heading -side top -fill x
pack .frame0.heading.text -side top -fill x
frame .frame1 -borderwidth 2 -relief raised
foreach index [lsort -integer [array names range]] \
{
set name $range($index)
set string $items($name)
frame .frame1.$index
label .frame1.$index.string -anchor w \
-width 20 -text "$string"
label .frame1.$index.name -relief sunken \
-anchor w -width 30 -text "$sys($name)" \
-wraplength [font measure {Helvetica} "XXXXXXXXXXXXXX" ]
pack .frame1.$index.string -side left -fill x
pack .frame1.$index.name -side left
pack .frame1.$index -side top -fill x
}
pack .frame1 -side top -fill x
frame .frame2 -borderwidth 2 -relief raised
button .frame2.ok -text "Quit" -padx 10 -command { exit }
button .frame2.save -text "Save" -padx 10 -command { sys_save }
button .frame2.clear -text "Update" -padx 10 -command { update }
pack .frame2 -side top -fill x
pack .frame2.ok .frame2.save .frame2.clear -side left -expand yes
bind . <Return> { exit }
bind . <Control-c> { exit }
bind . <Escape> { exit }
wm title . "TK System Information"
wm resizable . 0 0
grab .
tkwait window .
# never reached
return
}
proc sys_save { } \
{
global sys range items
set file [tk_getSaveFile -initialdir . \
-defaultextension ".txt" \
-title "Enter filename to save info text"]
if {[string length $file] == 0 } \
{
return
}
if [catch {open $file w} out] {
tk_messageBox -type ok -message $out
} else {
sys_putinfo $out
close $out
}
return
}
# main program
sys_getinfo
if { [regexp {.*tk.*} [lindex $argv 0]] } \
{
sys_wininfo
} else {
sys_putinfo stdout
}
exit
|