tim@sunybcs.UUCP (07/16/86)
I am sure a lot of people out there use the terminal program vterm
(i think it is the best that I have seem), but do you take advantage
of its escape sequences?
Here are to scripts that will allow you to
(1) download files to your current disk simply by typing
dl filename(s) at the prompt,
(2) print files to the printer by typing
p filename(s) at the prompt.
You can do something like:
% dl project.* to download all files starting project. or
% dl * to download an entire directory.
(same thing with 'p').
Here are the two scripts: (if for some reason the escape characters in
the files get expaned to two characters (i.e. ^[), vi them and change
it back to a real escape char (via ^Vesc)
----cut here------
#!/bin/csh -f
#
# TDT - Sun Jul 13 14:45:10 EDT 1986
# Download a file to PC using vterm and vterm's escape sequences.
# Start by giving a filename, and then using ascii transfer
# Ends when it sees "---End Acii Text---", so if that string
# is someplace in the file, it screws up
#
# Options:
# -b : wake me up when done
# end it with a break (cntrl-C)
#
mesg n
biff n
topwhile:
while ($#argv > 0)
switch ($1)
case "-b":
set beeper
shift
goto topwhile
endsw
if (-e $1) then
echo -n "[>0f"
echo $1
echo "[>1r"
cat $1
echo "---End Ascii Text---"
else
echo "No such file $1"
endif
shift
end
mesg y
biff n
if ($?beeper) then
while (1 == 1)
echo -n ""
sleep 5
end
endif
unset beeper
----cut here----
#!/bin/csh -f
#
# TDT - Sun Jul 13 14:22:40 EDT 1986
# Print a file on PC printer from Vterm. Using vterm escape sequences,
# start the printer to print everything, then stop it when done.
# Options:
# -l : Default (long) use 'pr' to print. Present here just in
# case you want to print a file with cat, then pr a file
# formfeed IS sent after every file printed
#
# -s : (short) if present, will use 'cat' to show the file,
# otherwise it will use 'pr' for a better format.
# With -s no formfeed is sent
#
# -b : if present, at end of printing will wake me up
# end with break (cntrl-C)
mesg n
biff n
set show = "pr"
topwhile:
while ($#argv > 0)
switch ($1)
case "-s":
set show = "cat"
shift
goto topwhile
case "-l":
set show = "pr"
shift
goto topwhile
case "-b":
set beeper
shift
goto topwhile
endsw
if (-e $1) then
echo -n "[?5i"
$show $1
echo -n "[?4i"
else
echo "No such file $1"
endif
shift
end
mesg y
biff y
if ($?beeper) then
while (1 == 1)
echo -n ""
sleep 5
end
endif
unset beeper
unset show
--------
____________ ____/--\____
\______ ___) ( _ ____) "Damn it Jim!,
__| |____/ / `--' I'm a programmer not a Doctor!"
) `|=(-
\------------'
Timothy D. Thomas SUNY/Buffalo Computer Science
UUCP: [decvax,dual,rocksanne,watmath,rocksvax]!sunybcs!tim
CSnet: tim@buffalo, ARPAnet: tim%buffalo@CSNET-RELAY