This file is indexed.

/usr/share/tkgate/vpd/tty.tcl is in tkgate-data 2.0~b10-4.

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
#   Copyright (C) 1987-2004 by Jeffery P. Hansen
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Last edit by hansen on Sun Dec  7 20:30:36 2008
#

#cut and paste into tty
#bind $w <Shift-KeyPress-Insert> " if { \[catch {selection get} sel\]==0 } { foreach c \[split \$sel \"\"\] { scan \$c %%c c; Simulator::cmdSend \"command $tkg_ttygat($w) key \$c\" } } "

#
# List of ttys
#

image create bitmap txtcurs -file "$bd/txtcurs.b"

#Security::allow TTY::post
#Security::allow TTY::data

#############################################################################
#
# Register the "safe" tty procedures
#
VPD::register TTY
VPD::allow TTY::post
VPD::allow TTY::data

namespace eval TTY {
  variable tty_w
  variable TD

  proc post {n} {
    variable tty_w
    global simOn

    set w [VPD::createWindow "TTY $n" -shutdowncommand "TTY::unpost $n"]
    set tty_w($n) $w

    text $w.txt -state disabled
    pack $w.txt
    $w.txt image create end -image txtcurs

    bind $w <KeyPress> "TTY::sendChar $n \"%A\""

    if {[info exists ::tkgate_isInitialized]} {
      VPD::outsignal $n.TD TTY::TD($n)
      VPD::insignal $n.RD -command "TTY::data $n" -format %d
      VPD::insignal $n.FORCE -command "TTY::force $n" -format %s
    }
  }

  proc sendChar {n key} {
    variable TD
    if { [string length $key ] == 1 } {
      binary scan $key c c
      set TTY::TD($n) $c
    }
  }

  #
  # Send character c as if it were typed in the keyboard.
  #
  proc force {n c} {
    set L [string length $c] 

    for { set i 0 } { $i < $L } { incr i } {
      TTY::sendChar $n [string range $c $i $i]
    }
  }


  proc unpost {n} {
    variable tty_w

    destroy $tty_w($n)
    unset tty_w($n)
  }

  proc data {n c} {
    variable tty_w

    set w $tty_w($n)

    catch {
      if { $c == 7 } {
	bell
	return
      } elseif { $c == 127 } {
	$w.txt configure -state normal
	$w.txt delete "end - 3 chars"
	$w.txt see end
	$w.txt configure -state disabled
	return
      }

      set x [format %c $c]

      $w.txt configure -state normal
      $w.txt insert "end - 2 chars" $x
      $w.txt see end
      $w.txt configure -state disabled
    }
  }
}