Files
Mozilla/mozilla/extensions/xmlterm/scripts/xcat.csh
(no author) d368a405db This commit was manufactured by cvs2svn to create branch
'MOZILLA_1_8_0_BRANCH'.

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_0_BRANCH@185757 18797224-902f-48f8-a5cc-f745e15eee43
2005-12-07 05:54:01 +00:00

32 lines
638 B
Tcsh
Executable File

#!/bin/csh
# xcat.csh: a C-shell XMLterm wrapper for the UNIX "cat" command
# Usage: xcat.csh <filename1> <filename2> ...
##set echocmd="/usr/bin/echo"
set echocmd="/bin/echo -e"
foreach file ($*)
set ext=${file:e}
set firstchar = `echo $file|cut -c1`
if ("$firstchar" == "/") then
set url="file:$file"
else
set url="file:$PWD/$file"
endif
switch ($ext)
case "gif":
case "png":
# Is this a security risk??? Perhaps display using IFRAME?
$echocmd "\033{S${LTERM_COOKIE}\007\c"
cat <<EOF
<IMG SRC='$url'>
EOF
$echocmd '\000\c'
breaksw
default:
cat $file
endsw
end