This file is indexed.

/usr/share/cgnstools/export.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
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
# export.tcl - CGNS export routines

proc export_default {w name cmd} {
  global ProgData Font Export tcl_platform

  if {$cmd != ""} {
    set exe [lindex $cmd 0]
    set exepath [get_executable $exe]
    if {$exepath != ""} {set exe $exepath}
    if {$tcl_platform(platform) == "windows"} {
      set Export(exefile) [join [split $exe /] \\]
    } else {
      set Export(exefile) $exe
    }
    set Export(options) [lrange $cmd 1 end]
  }
  set Export(cgnsfile) $ProgData(file,name)

  toplevel $w
  wm title $w $name
  wm transient $w .
  wm protocol $w WM_DELETE_WINDOW {set Export(done) 0}

  set labw 12

  FrameCreate $w.top -text "Export Command" -font $Font(bold)
  pack $w.top -side top -padx 5 -pady 5 -fill x
  set top [FrameGet $w.top]

  set f [frame $top.exe]
  pack $f -side top -fill x -expand 1
  label $f.lab -text Executable -width $labw -anchor w
  pack $f.lab -side left
  entry $f.ent -textvariable Export(exefile) -width 30
  pack $f.ent -side left -fill x -expand 1
  button $f.but -text Browse -pady 0 -command "export_browse $w exefile"
  pack $f.but -side right -fill y
  $f.ent xview [$f.ent index end]

  set f [frame $top.opts]
  pack $f -side top -fill x -expand 1
  label $f.lab -text Options -width $labw -anchor w
  pack $f.lab -side left
  entry $f.ent -textvariable Export(options) -width 30
  pack $f.ent -side left -fill x -expand 1

  set f [frame $top.input]
  pack $f -side top -fill x -expand 1
  label $f.lab -text "CGNS Input" -width $labw -anchor w
  pack $f.lab -side left
  entry $f.ent -textvariable Export(cgnsfile) -width 30
  pack $f.ent -side left -fill x -expand 1
  button $f.but -text Browse -pady 0 -command "export_browse $w cgnsfile"
  pack $f.but -side right -fill y

  set f [frame $top.output]
  pack $f -side top -fill x -expand 1
  label $f.lab -text "Output File" -width $labw -anchor w
  pack $f.lab -side left
  entry $f.ent -textvariable Export(outputfile) -width 30
  pack $f.ent -side left -fill x -expand 1
  button $f.but -text Browse -pady 0 \
    -command "export_browse $w outputfile {$name}"
  pack $f.but -side right -fill y

  if {[export_buttons $w export_check]} {
    set cmd [tools_unix_path $Export(exefile)]
    foreach opt $Export(options) {
      lappend cmd $opt
    }
    lappend cmd $Export(cgnsfile) $Export(outputfile)
    run_command $name $cmd
  }
}

proc export_input {w {base 0} {zone 0} {sol 0} {labw ""}} {
  global Export Font

  if {$labw == ""} {
    if {$sol} {
      set labw 12
    } else {
      set labw 10
    }
  }

  FrameCreate $w.input -text "CGNS Input" -font $Font(bold)
  pack $w.input -side top -padx 5 -pady 2 -fill x
  set input [FrameGet $w.input]

  set f [frame $input.file]
  pack $f -side top -fill x
  label $f.lab -text Filename -width $labw -anchor w
  pack $f.lab -side left
  entry $f.ent -textvariable Export(cgnsfile) -width 30
  pack $f.ent -side left -fill x -expand 1
  button $f.but -text Browse -pady 0 -command "export_browse $w cgnsfile"
  pack $f.but -side right -fill y

  if {$base} {
    set f [frame $input.base]
    pack $f -side top -anchor w
    label $f.lab -text "Base Index" -width $labw -anchor w
    entry $f.ent -textvariable Export(basenum) -width 10
    checkbutton $f.but -text default \
      -variable Export(basenum,flag) -onvalue 1 -offvalue 0 \
      -command "export_state basenum $f.ent"
    pack $f.lab $f.ent $f.but -side left
    export_state basenum $f.ent
  }

  if {$zone} {
    set f [frame $input.zone]
    pack $f -side top -anchor w
    label $f.lab -text "Zone Index" -width $labw -anchor w
    entry $f.ent -textvariable Export(zonenum) -width 10
    checkbutton $f.but -text default \
      -variable Export(zonenum,flag) -onvalue 1 -offvalue 0 \
      -command "export_state zonenum $f.ent"
    pack $f.lab $f.ent $f.but -side left
    export_state zonenum $f.ent
  }

  if {$sol} {
    set f [frame $input.sol]
    pack $f -side top -anchor w
    label $f.lab -text "Solution Index" -width $labw -anchor w
    entry $f.ent -textvariable Export(solnum) -width 10
    checkbutton $f.but -text default \
      -variable Export(solnum,flag) -onvalue 1 -offvalue 0 \
      -command "export_state solnum $f.ent"
    pack $f.lab $f.ent $f.but -side left
    export_state solnum $f.ent
  }
}

proc export_output {w ftype name exts {labw 10}} {
  global Export Font

  FrameCreate $w.output -text "$name Output" -font $Font(bold)
  pack $w.output -side top -padx 5 -pady 2 -fill x
  set f [FrameGet $w.output]

  label $f.lab -text Filename -width $labw -anchor w
  pack $f.lab -side left
  entry $f.ent -textvariable Export($ftype) -width 30
  pack $f.ent -side left -fill x -expand 1
  button $f.but -text Browse -pady 0 \
    -command "export_browse $w $ftype {$name} {$exts}"
  pack $f.but -side right -fill y
}

proc export_options {w {labw ""}} {
  global Export Font

  FrameCreate $w.opts -text "Command Line Options" -font $Font(bold)
  pack $w.opts -side top -padx 5 -pady 2 -fill x
  set f [FrameGet $w.opts]

  label $f.lab -text Options
  pack $f.lab -side left
  if {$labw != ""} {
    $f.lab configure -width $labw -anchor w
  }
  entry $f.ent -textvariable Export(options) -width 30
  pack $f.ent -side left -fill x -expand 1
}

proc export_browse {w ftype {name ""} {exts {}}} {
  global Export tcl_platform
  if {$ftype == "cgnsfile"} {
    set fname [FileOpen "CGNS Input File" $Export(cgnsfile) $w \
      {{{CGNS Files} {.cgns .cgn .adf}} {{All Files} {*}}}]
    if {$fname != ""} {
      if {$tcl_platform(platform) == "windows"} {
        set Export(cgnsfile) [join [split $fname /] \\]
      } else {
        set Export(cgnsfile) $fname
      }
    }
  } elseif {$ftype == "exefile"} {
    if {$tcl_platform(platform) == "windows"} {
      set types {{{Executable Files} {.exe .cmd .bat .com}} {{All Files} {*}}}
    } else {
      set types {{{All Files} {*}}}
    }
    set fname [FileOpen "Export Executable" $Export(exefile) $w $types]
    if {$fname != ""} {
      if {$tcl_platform(platform) == "windows"} {
        set Export(exefile) [join [split $fname /] \\]
      } else {
        set Export(exefile) $fname
      }
    }
  } else {
    if {$name == ""} {set name Output}
    if {$exts == {}} {
      set types {{{All Files} {*}}}
    } else {
      set types [list [list "$name Files" $exts] [list "All Files" *]]
    }
    set fname [FileSave "$name File" $Export($ftype) $w $types]
    if {$fname != ""} {
      if {$tcl_platform(platform) == "windows"} {
        set Export($ftype) [join [split $fname /] \\]
      } else {
        set Export($ftype) $fname
      }
    }
  }
}

proc export_state {what ent {def 1}} {
  global Export
  if {$Export($what,flag)} {
    set Export($what) ""
    $ent configure -state disabled -cursor {}
  } else {
    if {$Export($what) == ""} {
      set Export($what) $def
    }
    $ent configure -state normal -cursor xterm
  }
}

proc export_buttons {w {check ""}} {
  global Export
  set f [frame $w.but]
  pack $f -side top -pady 5
  button $f.accept -text Accept -width 6 -default active
  button $f.cancel -text Cancel -width 6 -command {set Export(done) 0}
  pack $f.accept $f.cancel -side left -padx 5

  if {$check == ""} {
    $f.accept configure -command {set Export(done) 1}
  } else {
    $f.accept configure -command "$check $w"
    bind $w <Return> "$check $w"
  }

  center_window $w .
  set oldFocus [focus]
  set oldGrab [grab current $w]
  if {$oldGrab != ""} {
    set grabStatus [grab status $oldGrab]
  }
  catch {grab $w}
  tkwait visibility $w
  focus $w
  tkwait variable Export(done)
  catch {focus $oldFocus}
  destroy $w
  if {$oldGrab != ""} {
    if {$grabStatus == "global"} {
      grab -global $oldGrab
    } else {
      grab $oldGrab
    }
  }
  return $Export(done)
}

proc export_check {w} {
  global Export
  if {$Export(exefile) == "" ||
      $Export(outputfile) == "" ||
      $Export(cgnsfile) == ""} {
    errormsg "must specify an executable, CGNS file and an output file" $w
    return
  }
  if {![file exists $Export(exefile)] ||
      ![file executable $Export(exefile)]} {
    errormsg "the export executable does not exist or is not executable" $w
    return
  }
  if {![file exists $Export(cgnsfile)]} {
    errormsg "the CGNS input file doesn't exist" $w
    return
  }
  set Export(done) 1
}