/usr/lib/xpbsmon/box.tk is in torque-client-x11 2.4.16+dfsg-1.5.
This file is owned by root:root, with mode 0o644.
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 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | # OpenPBS (Portable Batch System) v2.3 Software License
#
# Copyright (c) 1999-2000 Veridian Information Solutions, Inc.
# All rights reserved.
#
# ---------------------------------------------------------------------------
# For a license to use or redistribute the OpenPBS software under conditions
# other than those described below, or to purchase support for this software,
# please contact Veridian Systems, PBS Products Department ("Licensor") at:
#
# www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org
# 877 902-4PBS (US toll-free)
# ---------------------------------------------------------------------------
#
# This license covers use of the OpenPBS v2.3 software (the "Software") at
# your site or location, and, for certain users, redistribution of the
# Software to other sites and locations. Use and redistribution of
# OpenPBS v2.3 in source and binary forms, with or without modification,
# are permitted provided that all of the following conditions are met.
# After December 31, 2001, only conditions 3-6 must be met:
#
# 1. Commercial and/or non-commercial use of the Software is permitted
# provided a current software registration is on file at www.OpenPBS.org.
# If use of this software contributes to a publication, product, or
# service, proper attribution must be given; see www.OpenPBS.org/credit.html
#
# 2. Redistribution in any form is only permitted for non-commercial,
# non-profit purposes. There can be no charge for the Software or any
# software incorporating the Software. Further, there can be no
# expectation of revenue generated as a consequence of redistributing
# the Software.
#
# 3. Any Redistribution of source code must retain the above copyright notice
# and the acknowledgment contained in paragraph 6, this list of conditions
# and the disclaimer contained in paragraph 7.
#
# 4. Any Redistribution in binary form must reproduce the above copyright
# notice and the acknowledgment contained in paragraph 6, this list of
# conditions and the disclaimer contained in paragraph 7 in the
# documentation and/or other materials provided with the distribution.
#
# 5. Redistributions in any form must be accompanied by information on how to
# obtain complete source code for the OpenPBS software and any
# modifications and/or additions to the OpenPBS software. The source code
# must either be included in the distribution or be available for no more
# than the cost of distribution plus a nominal fee, and all modifications
# and additions to the Software must be freely redistributable by any party
# (including Licensor) without restriction.
#
# 6. All advertising materials mentioning features or use of the Software must
# display the following acknowledgment:
#
# "This product includes software developed by NASA Ames Research Center,
# Lawrence Livermore National Laboratory, and Veridian Information
# Solutions, Inc.
# Visit www.OpenPBS.org for OpenPBS software support,
# products, and information."
#
# 7. DISCLAIMER OF WARRANTY
#
# THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT
# ARE EXPRESSLY DISCLAIMED.
#
# IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE
# U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# This license will be governed by the laws of the Commonwealth of Virginia,
# without reference to its choice of law rules.
# NOTE: we restrict to one element keys only for efficiency!
proc box {frame_name {args}} {
set boxName [string trim $frame_name "."]
global $boxName canvas sysinfo
set configure 0
set argc [llength $args]
for {set i 0} {$i < $argc} {incr i} {
switch -exact -- [lindex $args $i] {
configure {
set configure 1
}
-title {
set [set boxName](title) [lindex $args [incr i]]
}
title {
if { ![info exists [set boxName](title)]} {
return ""
}
return [set [set boxName](title)]
}
-class {
set [set boxName](class) [lindex $args [incr i]]
}
class {
if { ![info exists [set boxName](class)]} {
return Plain
}
return [set [set boxName](class)]
}
titlelabel {
if { ![info exists [set boxName](titlelabel)]} {
return ""
}
return [set [set boxName](titlelabel)]
}
-key {
set [set boxName](key) [lindex $args [incr i]]
}
key {
if { ![info exists [set boxName](key)]} {
return 0
}
return [set [set boxName](key)]
}
-entrylabels {
set [set boxName](entrylabels) [lindex $args [incr i]]
}
entrylabels {
if { ![info exists [set boxName](entrylabels)]} {
return ""
}
return [set [set boxName](entrylabels)]
}
-lboxlabels {
set [set boxName](lboxlabels) [lindex $args [incr i]]
}
lboxlabels {
if { ![info exists [set boxName](lboxlabels)]} {
return ""
}
return [set [set boxName](lboxlabels)]
}
-lboxwidths {
set [set boxName](lboxwidths) [lindex $args [incr i]]
}
lboxwidths {
if { ![info exists [set boxName](lboxwidths)]} {
return 0
}
return [set [set boxName](lboxwidths)]
}
-lboxheights {
set [set boxName](lboxheights) [lindex $args [incr i]]
}
lboxheights {
if { ![info exists [set boxName](lboxheights)]} {
return 0
}
return [set [set boxName](lboxheights)]
}
-orient {
set [set boxName](orient) [lindex $args [incr i]]
}
orient {
if { ![info exists [set boxName](orient)]} {
return "x"
}
return [set [set boxName](orient)]
}
-grabBox {
set [set boxName](grabBox) [lindex $args [incr i]]
}
grabBox {
if { ![info exists [set boxName](grabBox)]} {
return ""
}
return [set [set boxName](grabBox)]
}
-selindex {
set [set boxName](selindex) [lindex $args [incr i]]
}
selindex {
if { ![info exists [set boxName](selindex)]} {
return -1
}
return [set [set boxName](selindex)]
}
vscroll {
if { ![info exists [set boxName](vscroll)]} {
return ""
}
return [set [set boxName](vscroll)]
}
ncols {
if { ![info exists [set boxName](ncols)]} {
return 1
}
return [set [set boxName](ncols)]
}
-nrows {
set lbox [box $frame_name lbox 0]
if { [string compare $lbox ""] != 0 } {
set [set boxName](nrows) [$lbox size]
}
incr [set boxName](nrows) [lindex $args [incr i]]
return [set [set boxName](nrows)]
}
nrows {
set lbox [box $frame_name lbox 0]
if { [string compare $lbox ""] == 0 } {
return 0
}
set [set boxName](nrows) [$lbox size]
return [set [set boxName](nrows)]
}
lbox {
set index [lindex $args [incr i]]
if {![info exists [set boxName](lbox,$index)]} {
return ""
}
return [set [set boxName](lbox,$index)]
}
entry {
set index [lindex $args [incr i]]
if {![info exists [set boxName](entry,$index)]} {
return ""
}
return [set [set boxName](entry,$index)]
}
-entryval {
set index [lindex $args [incr i]]
set eval [lindex $args [incr i]]
set [set boxName](entryval,$index) $eval
return [set [set boxName](entryval,$index)]
}
entryval {
set index [lindex $args [incr i]]
if {![info exists [set boxName](entryval,$index)]} {
return ""
}
return [set [set boxName](entryval,$index)]
}
-entryvalDeleted {
set [set boxName](entryvalDeleted) [lindex $args [incr i]]
return
}
entryvalDeleted {
if { ![info exists [set boxName](entryvalDeleted)]} {
return ""
}
return [set [set boxName](entryvalDeleted)]
}
-noUpdateButton {
set [set boxName](noUpdateButton) [lindex $args [incr i]]
}
noUpdateButton {
if { ![info exists [set boxName](noUpdateButton)]} {
return 0
}
return [set [set boxName](noUpdateButton)]
}
-addCmd {
set [set boxName](addCmd) [lindex $args [incr i]]
}
addCmd {
if { ![info exists [set boxName](addCmd)]} {
return ""
}
return [set [set boxName](addCmd)]
}
-remCmd {
set [set boxName](remCmd) [lindex $args [incr i]]
}
remCmd {
if { ![info exists [set boxName](remCmd)]} {
return ""
}
return [set [set boxName](remCmd)]
}
updateButton {
if { ![info exists [set boxName](updateButton)]} {
return ""
}
return [set [set boxName](updateButton)]
}
create {
catch {unset $boxName}
}
unset {
catch {unset $boxName}
return
}
getBoxArray {
return "[set boxName]"
}
}
}
# create one frame to hold everything
set f [frame $frame_name -class [box $frame_name class]]
if { ![info exists sysinfo(boxes)] || \
[lsearch -exact $sysinfo(boxes) $f] == -1 } {
lappend sysinfo(boxes) $f
}
$f configure -relief ridge -borderwidth 2
frame $f.t -class CmdFrame -relief raised -borderwidth 2
frame $f.b -relief flat
frame $f.b.e -relief flat
frame $f.b.l -relief ridge -bd 4
frame $f.b.b -relief flat
label $f.t.label -text [box $f title] -justify center
pack $f.t.label -anchor nw -side left -expand 1 -fill both
set [set boxName](titlelabel) $f.t.label
## build the entry widget
## build the add button
button $f.b.e.add -text add -height 2 \
-command "boxAdd $f \"[box $f addCmd]\""
if {[string compare [box $f orient] x] == 0} {
pack $f.b.e.add -side right -anchor c -pady 1m
} else {
pack $f.b.e.add -side bottom -anchor c -pady 1m
}
set k 0
set packlist ""
set entrylabels [box $f entrylabels]
set lboxwidths [box $f lboxwidths]
set lboxheights [box $f lboxheights]
foreach labelinfo $entrylabels {
set elabel [lindex $labelinfo 0]
set type [lindex $labelinfo 1]
set args [lrange $labelinfo 2 end]
frame $f.b.e.$k
switch -exact -- $type {
MENU_ENTRY {
menuEntry $f.b.e.$k create -menuvalues $args -title $elabel \
-textvariable [set boxName](entryval,$k)
set [set boxName](entry,$k) ""
}
default {
set lboxwidth [lindex $lboxwidths $k]
set einfo [buildFullEntrybox $f.b.e.$k [string length $elabel] \
$elabel $lboxwidth "" bottom 0 top right 0 c]
set eframew [lindex $einfo 0]
set elabelw [lindex $einfo 1]
set eentryw [lindex $einfo 2]
global sel$eentryw
set sel$eentryw 0
$eentryw configure -textvariable [set boxName](entryval,$k)
$elabelw configure -anchor nw
set [set boxName](entry,$k) $eentryw
bind_entry_overselect $eentryw
register_default_action $eentryw $f.b.e.add
}
}
set packlist "$packlist $f.b.e.$k"
incr k
}
set [set boxName](ncols) $k
set [set boxName](nrows) 0
if {[string compare packlist ""] != 0} {
eval pack [string trim $packlist] -side left -anchor nw
}
boxSetTabbing $f
# build the listbox
set packlist ""
set k 0
set lboxlabels [box $f lboxlabels]
set llen [llength $lboxlabels]
foreach llabel $lboxlabels {
frame $f.b.l.$k
set lboxwidth [lindex $lboxwidths $k]
set lboxheight [lindex $lboxheights $k]
if {[expr $k + 1] != $llen} {
set listBoxInfo [buildFullListbox $f.b.l.$k \
${lboxwidth}x${lboxheight} $llabel xscroll 0 0 0]
} else {
set listBoxInfo [buildFullListbox $f.b.l.$k \
${lboxwidth}x${lboxheight} $llabel xyscroll 0 0 0]
set [set boxName](vscroll) [lindex $listBoxInfo 4]
}
set hostsListbox [lindex $listBoxInfo 3]
set hostsListboxSelButton [lindex $listBoxInfo 2]
set hostsListboxLabel [lindex $listBoxInfo 1]
bind_listbox_single_select $hostsListbox
bind_listbox_select $hostsListbox $f
set [set boxName](lbox,$k) $hostsListbox
set packlist "$packlist $f.b.l.$k"
incr k
}
if {[string compare packlist ""] != 0} {
eval pack [string trim $packlist] -side left -anchor nw
}
boxSetScroll $f
## build the buttons
set noUpdateButton [box $f noUpdateButton]
if {$noUpdateButton} {
set buttonList [list {delete "delete"}]
} else {
set buttonList [list {delete "delete"} {info "update"}]
}
set cmdButtons [buildCmdButtons $f.b.b [list $buttonList] y 0 11 1 1 0 0]
set cmdButtonFrame [lindex $cmdButtons 0]
set cmdButtonDelete [lindex $cmdButtons 1]
if {!$noUpdateButton} {
set cmdButtonUpd [lindex $cmdButtons 2]
set [set boxName](updateButton) $cmdButtonUpd
}
$cmdButtonDelete configure -command "boxDelete $f \"[box $f remCmd]\""
set fwidth [expr [lindex [$hostsListbox configure -height] end]*$canvas(bigLabelFontHeight)]
if {[string compare [box $f orient] x] == 0} {
pack $f.b.e -pady [expr $fwidth/2] -padx 0 -side left -anchor nw
pack $f.b.l $f.b.b -side left -anchor nw \
-padx $canvas(bigLabelFontWidth)
} else {
pack $f.b.e -side top -anchor nw -pady 0 -padx 0
pack $f.b.l $f.b.b -side left -after $f.b.e -pady 3m -anchor nw -padx 0
}
pack $f.t -anchor nw -side top -fill both -expand 1
pack $f.b -anchor nw -side top -fill none -expand 0
}
proc boxesUnset {} {
global sysinfo
if [info exists sysinfo(boxes)] {
foreach b $sysinfo(boxes) {
box $b unset
}
}
set sysinfo(boxes) ""
}
proc boxAdd {frame_name {addfunc ""}} {
global tk_version dialog
set entrylabels [box $frame_name entrylabels]
set keylist [box $frame_name key]
set ncols [box $frame_name ncols]
set keyval ""
set keys ""
for {set i 0} {$i < $ncols} {incr i} {
box $frame_name -entryval $i \
[cleanstr [box $frame_name entryval $i]]
set kindex [lsearch -regexp $keylist "(^| )$i"]
if {$kindex != -1} {
set entryval [box $frame_name entryval $i]
if {[string compare $entryval ""] == 0} {
set entrylab [lindex $entrylabels $i]
set entryw [box $frame_name entry $i]
popupInfoBox [box $frame_name grabBox] \
"Can't have an empty \"$entrylab\" entry!!!" \
500 $entryw
return
}
set klist [split [lindex $keylist $kindex] ":"]
set k [lindex $klist 0]
lappend keys $k
set kmatchval [lindex $klist 1]
lappend keyval $entryval
if {[string compare $kmatchval ""] != 0 && \
[regexp "^($kmatchval)$" $entryval]} {
set kunique($k) 1
} else {
set kunique($k) 0
}
}
}
set nrows [box $frame_name nrows]
for {set i 0} {$i < $nrows} {incr i} {
set boxval ""
for {set j 0} {$j < $ncols} {incr j} {
if {[lsearch -exact $keys $j] != -1} {
set entryv [box $frame_name entryval $j]
set entryw [box $frame_name entryval $j]
set lbox [box $frame_name lbox $j]
if {$kunique($j)} {
if {![lboxvalue_isUnique $lbox $entryv]} {
popupInfoBox [box $frame_name grabBox] \
"\"$entryv\" already specified in one of the fields!" 500 $entryw
return
}
}
lappend boxval [$lbox get $i]
}
}
if {[lcomp $keyval $boxval] == 0} {
popupInfoBox [box $frame_name grabBox] \
"Unable to add entry: key \"[concat $keyval]\" was duplicated!" 500 [box $frame_name entry 0]
return
}
}
for {set i 0} {$i < [box $frame_name ncols]} {incr i} {
set lbox [box $frame_name lbox $i]
set entry [box $frame_name entry $i]
global sel$entry
$lbox insert end [box $frame_name entryval $i]
set sel$entry 1
}
box $frame_name -nrows +1
boxSelect $frame_name end
if {[string compare $addfunc ""] != 0} {
eval $addfunc
}
}
proc boxDelete {frame_name {remfunc ""}} {
for {set i 0} {$i < [box $frame_name ncols]} {incr i} {
set lbox [box $frame_name lbox $i]
set selindex [$lbox curselection]
if {[string compare $selindex ""] != 0} {
box $frame_name -entryvalDeleted [$lbox get $selindex]
$lbox delete $selindex
boxSelect $frame_name $selindex
}
}
box $frame_name -nrows -1
if {[string compare $remfunc ""] != 0} {
eval $remfunc
}
}
proc boxGetCurselect {frame_name index} {
set selindex [box $frame_name selindex]
if {$selindex == -1} {
return
}
set lbox [box $frame_name lbox $index]
catch {$lbox get $selindex} value
return $value
}
proc boxSelect {frame_name index} {
global tk_version
set nrows [box $frame_name nrows]
if { $index == -1 } {
set lbox [box $frame_name lbox 0]
global cmd$lbox
if [info exists cmd$lbox] {
eval [set cmd$lbox]
}
return
}
set boxName [box $frame_name getBoxArray]
global $boxName
set [set boxName](selindex) $index
set selindex $index
for {set i 0} {$i < [box $frame_name ncols]} {incr i} {
set lbox [box $frame_name lbox $i]
set entry [box $frame_name entry $i]
if { $tk_version < 4.0 } {
$lbox select from $selindex
} else {
catch {$lbox selection clear [$lbox curselection]}
$lbox select set $selindex $selindex
}
set boxval [$lbox get $selindex]
if {[string compare $boxval ""] != 0} {
box $frame_name -entryval $i $boxval
}
if {$i == 0 && [string compare $entry ""] != 0} {
focus $entry
$entry select from 0
$entry select to end
if {$tk_version >= 4.0} {
$entry xview moveto 1
}
}
global cmd$lbox
if [info exists cmd$lbox] {
eval [set cmd$lbox]
}
}
}
proc boxSetScroll {frame_name} {
global tk_version
set vscroll [box $frame_name vscroll]
if {[string compare $vscroll ""] == 0} {
return
}
set lboxes ""
for {set i 0} {$i < [box $frame_name ncols]} {incr i} {
set lbox [box $frame_name lbox $i]
$lbox configure -yscrollcommand "$vscroll set"
lappend lboxes $lbox
}
$vscroll configure -command "boxAdjScrollView [list $lboxes]"
}
proc boxSetTabbing {f} {
for {set i 0} {$i < [box $f ncols]} {incr i} {
set entry [box $f entry $i]
if {[string compare $entry ""] == 0} {
continue
}
set nentry [box $f entry [expr $i+1]]
if {[string compare $nentry ""] == 0} {
set nentry $entry
}
set pentry [box $f entry [expr $i-1]]
if {[string compare $pentry ""] == 0} {
set pentry $entry
}
bind_entry_tab $entry $nentry $pentry
}
}
proc boxAdjScrollView {args} {
set lboxes [lindex $args 0]
set params [lrange $args 1 end]
foreach b $lboxes {
eval $b yview $params
}
}
|