This file is indexed.

/usr/share/cgnstools/findfile.tcl is in cgns-convert 3.3.0-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
#----- search for specified file

proc findfile:check {type fname} {
  global tcl_platform
  if {$type == "executable" && $tcl_platform(platform) == "windows"} {
    foreach ext {.com .exe .bat} {
      if [file exists $fname$ext] {
        return $fname$ext
      }
    }
  }
  if [file $type $fname] {
    if {$type == "executable" && [file isdirectory $fname]} {
        return {}
    }
    return $fname
  }
  return {}
}

proc findfile:path {str delim} {
  global env
  set path {}
  foreach p [split $str $delim] {
    set dir {}
    foreach d [split $p /] {
      if {[string length $d] > 1 && [string index $d 0] == {$}} {
        if [info exists env([string range $d 1 end])] {
          lappend dir $env([string range $d 1 end])
        } else {
          set dir {}
          break
        }
      } else {
        lappend dir $d
      }
    }
    if [llength $dir] {
      lappend path [join $dir /]
    }
  }
  if [llength $path] {
    return [join $path $delim]
  }
  return ""
}

proc find_file {type fname args} {
  global tcl_platform env

  if {$fname == ""} {
    return {}
  }
  set dr [file dirname $fname]
  set fn [file tail $fname]
  if {$type == ""} {
    set type exists
  }

  # check if path given

  if {$dr != "."} {
    set curdir [pwd]
    catch {cd $dr}
    set filename [pwd]/$fn
    cd $curdir
    return [findfile:check $type $filename]
  }

  # check if running under windows

  if {[info exists tcl_platform(platform)] &&
    $tcl_platform(platform) == "windows"} {
    set delim ";"
  } else {
    set delim ":"
  }

  if {$args == ""} {

    # check current directory

    set filename [findfile:check $type [pwd]/$fn]
    if {$filename != ""} {
      return $filename
    }
    if {$fname != $fn} {
      return {}
    }

    # check PATH environment variable

    if [info exists env(PATH)] {
      foreach dir [split $env(PATH) $delim] {
        set filename [findfile:check $type $dir/$fn]
        if {$filename != ""} {
          return $filename
        }
      }
    }

  } else {

    # check supplied list of paths/directories

    foreach val $args {
      foreach ent [split $val] {
        if {$ent != ""} {
          set path [findfile:path $ent $delim]
          if {$path != ""} {
            foreach dir [split $path $delim] {
              set filename [findfile:check $type $dir/$fn]
              if {$filename != ""} {
                return $filename
              }
            }
          }
        }
      }
    }
  }

  return {}
}