This file is indexed.

/usr/share/tkinspect/cmdline.tcl is in tkinspect 5.1.6p10-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
#
# $Id: cmdline.tcl,v 1.3 2002/03/14 23:40:31 pat Exp $
#
# Provide a command line interface to an application (much of the
# code is lifted out of the Tk demo rmt).
#
# [PT]: this should be replaced by tkcon...

dialog command_line {
    param main
    param target ""
    member executing 0
    member last_command ""
    method create {} {
	frame $self.menu -bd 2 -relief raised
	pack $self.menu -side top -fill x
	menubutton $self.menu.file -text "File" -menu $self.menu.m \
	    -underline 0 -menu $self.menu.file.m
	pack $self.menu.file -side left
	set m [menu $self.menu.file.m]
	$m add command -label "Close Window" -underline 0 \
	    -command "destroy $self"
	text $self.t -yscroll "$self.sb set"
	scrollbar $self.sb -command "$self.t yview"
	pack $self.sb -side right -fill y
	pack $self.t -side left -fill both -expand 1

	# Create a binding to forward commands to the target application,
	# plus modify many of the built-in bindings so that only information
	# in the current command can be deleted (can still set the cursor
	# earlier in the text and select and insert;  just can't delete).
	bindtags $self.t "$self.t Text . all"
	bind $self.t <Return> {
	    %W mark set insert {end - 1c}
	    %W insert insert "\n"
	    regexp "(.*)\\.t$" %W dummy self
	    command_line:invoke $self
	    break
	}
	bind $self.t <Delete> {
	    if {[%W tag nextrange sel 1.0 end] != ""} {
		%W tag remove sel sel.first promptEnd
	    } else {
		if [%W compare insert < promptEnd] {
		    break
		}
	    }
	}
	bind $self.t <BackSpace> {
	    if {[%W tag nextrange sel 1.0 end] != ""} {
		%W tag remove sel sel.first promptEnd
	    } else {
		if [%W compare insert <= promptEnd] {
		    break
		}
	    }
	}
	bind $self.t <Control-d> {
	    if [%W compare insert < promptEnd] {
		break
	    }
	}
	bind $self.t <Control-k> {
	    if [%W compare insert < promptEnd] {
		%W mark set insert promptEnd
	    }
	}
	bind $self.t <Control-t> {
	    if [%W compare insert < promptEnd] {
		break
	    }
	}
	bind $self.t <Meta-d> {
	    if [%W compare insert < promptEnd] {
		break
	    }
	}
	bind $self.t <Meta-BackSpace> {
	    if [%W compare insert <= promptEnd] {
		break
	    }
	}
	bind $self.t <Control-h> {
	    if [%W compare insert <= promptEnd] {
		break
	    }
	}
	bind $self.t <Control-x> {
	    %W tag remove sel sel.first promptEnd
	}
	bind $self.t <Key> "command_line:text_insert $self %A; break"
	$self.t tag configure bold \
            -font {Courier 12 bold}
        #-font -*-Courier-Bold-R-Normal-*-120-*-*-*-*-*-*
	$self prompt
    }
    method destroy {} {
	$slot(main) delete_cmdline $self
    }
    method reconfig {} {
    }
    
    # The procedure below is used to print out a prompt at the
    # insertion point (which should be at the beginning of a line
    # right now).
    method prompt {} {
	$self.t insert insert "$slot(target): "
	$self.t mark set promptEnd {insert}
	$self.t mark gravity promptEnd left
	$self.t tag add bold {promptEnd linestart} promptEnd
    }

    # The procedure below executes a command (it takes everything on the
    # current line after the prompt and either sends it to the remote
    # application or executes it locally, depending on "app").
    method invoke {} {
	set cmd [$self.t get promptEnd insert]
	incr slot(executing) 1
	if [info complete $cmd] {
	    if {$cmd == "!!\n"} {
		set cmd $slot(last_command)
	    } else {
		set slot(last_command) $cmd
	    }
	    if {$slot(target) == "local"} {
		set result [catch [list uplevel #0 $cmd] msg]
	    } else {
		set result [catch [list send $slot(target) $cmd] msg]
	    }
	    if {$result != 0} {
		$self.t insert insert "Error: $msg\n"
	    } else {
		if {$msg != ""} {
		    $self.t insert insert $msg\n
		}
	    }
	    $self prompt
	    $self.t mark set promptEnd insert
	}
	incr slot(executing) -1
	$self.t yview -pickplace insert
    }

    # The following procedure is invoked to change the application that
    # we're talking to.  It also updates the prompt for the current
    # command, unless we're in the middle of executing a command from
    # the text item (in which case a new prompt is about to be output
    # so there's no need to change the old one).
    method set_target {target} {
	if ![string length $target] {
	    set target local
	}
	set slot(target) $target
	if !$slot(executing) {
	    $self.t mark gravity promptEnd right
	    $self.t delete "promptEnd linestart" promptEnd
	    $self.t insert promptEnd "$target: "
	    $self.t tag add bold "promptEnd linestart" promptEnd
	    $self.t mark gravity promptEnd left
	}
	wm title $self "Command Line: $target"
	return {}
    }

    method text_insert {s} {
	if {$s == ""} {
	    return
	}
	catch {
	    if {[$self.t compare sel.first <= insert]
		&& [$self.t compare sel.last >= insert]} {
		    $self.t tag remove sel sel.first promptEnd
		    $self.t delete sel.first sel.last
		}
	}
	$self.t insert insert $s
	$self.t see insert
    }
}