orig/vinfo.csh
author Axel Jacobs <axel@jaloxa.eu>
Mon, 14 Apr 2014 22:21:17 +0100
changeset 73 87fa3132a136
parent 0 0aa115157c9c
permissions -rw-r--r--
New IES test file with spaces in file name
axel@0
     1
#!/bin/csh -f
axel@0
     2
# RCSid: $Id: vinfo.csh,v 3.2 2004/11/19 23:00:49 greg Exp $
axel@0
     3
#
axel@0
     4
# Edit information header in Radiance file
axel@0
     5
#
axel@0
     6
set plist=()
axel@0
     7
set ilist=()
axel@0
     8
foreach f ($*)
axel@0
     9
	if (! -f $f:q) then
axel@0
    10
		echo "${f}: no such file or directory"
axel@0
    11
		continue
axel@0
    12
	endif
axel@0
    13
	if (! -w $f:q) then
axel@0
    14
		echo "$f is read-only"
axel@0
    15
		sleep 1
axel@0
    16
		continue
axel@0
    17
	endif
axel@0
    18
	set info="$f.info"
axel@0
    19
	getinfo < $f:q > $info:q
axel@0
    20
	set plist=($plist:q $f:q)
axel@0
    21
	set ilist=($ilist:q $info:q)
axel@0
    22
end
axel@0
    23
vi $ilist:q
axel@0
    24
set i=1
axel@0
    25
while ( $i <= $#plist )
axel@0
    26
	set f=$plist[$i]:q
axel@0
    27
	set info=$ilist[$i]:q
axel@0
    28
	if ("`tail -1 $info:q`" != "") then
axel@0
    29
		echo "" >> $info:q
axel@0
    30
	endif
axel@0
    31
	getinfo < $f:q | cmp -s - $info:q
axel@0
    32
	if ($status != 0) then
axel@0
    33
		getinfo - < $f:q >> $info:q
axel@0
    34
		mv $info:q $f:q
axel@0
    35
	else
axel@0
    36
		rm $info:q
axel@0
    37
	endif
axel@0
    38
	@ i++
axel@0
    39
end