This file is indexed.

/usr/share/xcrysden/Tcl/parseComLinArg.tcl is in xcrysden-data 1.5.60-1build3.

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
#############################################################################
# Author:                                                                   #
# ------                                                                    #
#  Anton Kokalj                                  Email: Tone.Kokalj@ijs.si  #
#  Department of Physical and Organic Chemistry  Phone: x 386 1 477 3523    #
#  Jozef Stefan Institute                          Fax: x 386 1 477 3811    #
#  Jamova 39, SI-1000 Ljubljana                                             #
#  SLOVENIA                                                                 #
#                                                                           #
# Source: $XCRYSDEN_TOPDIR/Tcl/parseComLinArg.tcl                               #
# ------                                                                    #
# Copyright (c) 1996-2003 by Anton Kokalj                                   #
#############################################################################

proc parseComLinArg comopt {
    global system xcMisc

    set load_attributes 0
    set i 0
    foreach option $comopt {
	incr i

	# odd cycles are tags, even options
        if { $i%2 } {
            set tag $option

	    switch -exact -- $tag {
		"-?"   { 
		    XCrySDenUsage
		}
		"--help" {
		    XCrySDenUsage
		}
		"--quiet" {
		    # quiet run -- without welcome window !!!
		    ViewMol .
		    return
		}
	    }

	} else {    	    
	    switch -glob -- $tag {
		"-r" -
		"--reduce*" {
		    set xcMisc(reduce_to) $option
		    continue
		}
	    }	
	    
	    set filedir [GetAbsoluteFileName $option]

	    if { ! [file exists $filedir] && $tag != "--wien_struct" } {
		destroy .title
		ErrorDialog "file \"$filedir\" does not exists !!!"
		exit
	    }

            switch -glob -- $tag {
		"-a" -
		"--attrib*" {
		    set load_attributes 1
		    set file_attributes $filedir
		}
		"-l" -
		"--light*" {
		    glLight:load $filedir
		}
		"-c" -
		"--custom" {
		    uplevel #0 "source $filedir"
		}

                "--xsf" -
		"--xcr" -
		"--animxsf" -
		"--axsf" {
		    ViewMol .
		    xsfOpen $filedir .mesa
		    #ViewMol .
		    #xsfAnimInit $filedir .mesa
		}	
		"--xmol" -
		"--xyz" {
		    ViewMol .
		    xyzOpen $filedir
		}
		"--pdb" {
		    # first convert to xsf format then set state and render
		    ViewMol .
		    OpenXYZPDB .mesa pdb $filedir
		}
		"--fermi" -
		"--bxsf" {
		    if { [file isfile $filedir] } {
			genFSInit $filedir
		    } else {
			ErrorDialog "file $filedir doesn't exists\n(or is not a regular file) !!!"
			exit
		    }
		}

		"--pw_inp" - "--pwi" {
		    if [file exists $filedir] {
			# pop-up Viewer
			ViewMol .
			openExtStruct 3 crystal external \
			    [list sh $system(TOPDIR)/scripts/pwi2xsf.sh] \
			    pwi2xsf.xsf_out \
			    {PWSCF Input File} ANGS \
			    -file $filedir \
			    -preset pwInputPreset
		    } else {
			ErrorDialog "$filedir doesn't exists !!!"
			exit
		    }
		}

		"--pw_out" - "--pwo" {
		    if [file exists $filedir] {
			# pop-up Viewer
			ViewMol .
			openExtStruct 3 crystal external \
			    [list sh $system(TOPDIR)/scripts/dummy.sh] \
			    pwo2xsf.xsf \
			    {PWSCF Output File} ANGS \
			    -file $filedir \
			    -preset pwOutputPreset
		    } else {
			ErrorDialog "$filedir doesn't exists !!!"
			exit
		    }
		}

		    
		"--fhi_inpini" {
		    if [file exists $filedir] {
			# pop-up Viewer
			ViewMol .
			openExtStruct 3 crystal external34 \
				$system(BINDIR)/fhi_inpini2ftn34 \
				$system(ftn_name).34 {FHI98MD "ini.inp"} \
				BOHR -file $filedir \
				-preset [list fhiPreset inpini]
		    } else {
			ErrorDialog "$filedir doesn't exists !!!"
			exit
		    }
		}
		"--fhi_coord" {
		    if [file exists $filedir] {
			# pop-up Viewer
			ViewMol .
			openExtStruct 3 crystal external \
				$system(BINDIR)/fhi_coord2xcr \
				fhi_coord.xcr {FHI98MD "coord.out"} \
				BOHR -file $filedir \
				-preset [list fhiPreset coord]
		    } else {
			ErrorDialog "$filedir doesn't exists !!!"
			exit
		    }
		}

		# --------------------------------------------------
		#  --crystal_* options are intended as CRYSTAL-95/98/03 interfacing
		# --------------------------------------------------

		"--crystal_inp" {
		    if { [file exists $filedir] } {
			ViewMol .
			OpenFile $filedir
		    } else {
			ErrorDialog "$filedir doesn't exists !!!"
			exit
		    }
		}
		"--crystal_f9" {
		    if { [file exists $filedir] } {
			ViewMol .
			PropC95 $filedir
		    } else {
			ErrorDialog "$filedir doesn't exists !!!"
			exit
		    }
		}

		# --------------------------------------------------
		#  --wien_* options are intended as WIEN2k interfacing
		# --------------------------------------------------

		"--wien_struct" {
		    # option can be directory, filehead or file
		    if { [file isdirectory $filedir] } {
			set filehead [file tail $filedir]
			set file $filedir/$filehead.struct
		    } elseif { [file exists $filedir.struct] } {
			set file $filedir.struct
		    } elseif { [file exists $filedir] } {
			set file $filedir
		    } else {
			ErrorDialog "$filedir is neither directory, neither filehead, niether file"
			exit
		    }
		    # pop-up Viewer
		    ViewMol .
		    wnOpenSFile $file; # maybe vice-versa first wnOpenSFile and then ViewMol file
		}
		"--wien_kpath" {
		    # struct file must be read, and converted
		    # pop-up just BZ Window
		    if { [file isdirectory $filedir] } {
			wnDetComOpt $filedir
			wnKPath $filedir
		    } elseif { [file isfile $filedir] } {
			set dir [file dirname $filedir]
			wnDetComOpt $dir
			wnKPath $filedir			
		    } else {
			ErrorDialog "$filedir directory|file does not exists !!!"
			exit
		    }
		}
		"--wien_renderdensity" {
		    # use wnDensity proc and pop-up Viewer and 2D isoControl
		    # toplevel
		    if { [file isdirectory $filedir] } {
			set filehead [file tail $filedir]
			set file $filedir/$filehead.struct
			ViewMol .
			wnOpenSFile $file
			wnDensity $filedir
		    } else {
			ErrorDialog "$filedir directory does not exists !!!"
			exit
		    }
		}
		"--wien_density" {
		    # popup Viewer & another toplevel for inquiring 2D or 3D
		    # plots; then grid window is displayed
		    if { [file isdirectory $filedir] } {
			set filehead [file tail $filedir]
			set file $filedir/$filehead.struct
			ViewMol .
			wnOpenSFile $file
			wnDetComOpt $filedir
			# pop-up decision window
			wnDensity2D_or_3D $filedir
		    } else {
			ErrorDialog "$filedir directory does not exists !!!"
			exit
		    }		    
		}
		"--wien_f*" {
		    # struct file must be read, and converted
		    if [file isdirectory $filedir] {
			wnDetComOpt $filedir
			wnFSInit $filedir
		    } else {
			ErrorDialog "$filedir directory does not exists !!!"
			exit
		    }
		}
		"--gzmat" {
		    gzmat $filedir
		}
		"--g98_out" -
		"--gXX_out" - 
		"--gxx_out" -
		"--gaussian_out" {
		    # this option is done via new addOption interface ...
		    addOption:hardcoded \
			[list sh $system(TOPDIR)/scripts/g98toxsf.sh] $filedir
		}
		"--cube" -		
		"--gXX_cube" -
		"--g98_cube" {
		    g98Cube $filedir
		}
		"-s" -
		"--script" {
		    scripting::source $filedir		    
		}
		default {
		    #
		    # check for user-custom options
		    addOption:parse $tag $filedir
		}
	    }
	}
    }
	
    if { $i%2 } {
	XCrySDenUsage
	#tk_dialog .mb_error1 Error \
	#	"ERROR: You called XCrySDen with an odd number of args !" \
	#	error 0 OK
    }
    unset i

    if { $load_attributes && [winfo exists .mesa] } {
	xsfLoadAttributes $file_attributes
    }

    # open the xcrysden main window if it is not already opened

    update
    if { ! [winfo exists .mesa] && ! [winfo exists .xcrysden_logo] } {
	ViewMol .
    }
}


proc UpdateWMTitle file {
    global xcMisc system
    
    set xcMisc(titlefile) $file
    wm title . "XCrySDen: [file tail $file]"

    # if file exists (does not always) copy it    
    if { [file exists $file] } {
	# the following copy is used if someone wants to save 
	# file as WIEN2k STRUCT FILE    	
	file copy -force $file $system(SCRDIR)/xc_struc.$system(PID)
    }
}


proc XCrySDenUsage {} {
    global system

    wm withdraw .
    set message [ReadFile $system(TOPDIR)/usage]
    puts stderr "\n$message\n"
    addOption:printCustomUsage
    flush stderr
    exit 1
}