gecko-dev/extensions/xmlterm/scripts/xcat.csh
svn%xmlterm.org 2b49b0c3d9 xmlterm changes only (not part of the default build).
Added directory "scripts" to hold XMLterm-aware commands like "xls" and "xcat".
2000-02-29 15:50:56 +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