ACC SHELL
#!/bin/csh -fb
# (The "-fb" might need to be changed to "-f" on some systems)
#
#
# This is sun-message. It looks at $2 to figure out how to decode $1, then gives the
# user a short menu of choices, display, save, or quit.
#
mkdir /tmp/decode.$$ || exit 1
cd /tmp/decode.$$
if ( -x /bin/mktemp || -x /usr/bin/mktemp ) then
set fn="`mktemp uu.XXXXXX`" || exit 1
else
set fn="uu.$$"
rm -f $fn
endif
if ( ${?METAMAIL_PAGER} ) then
set PAGER=$METAMAIL_PAGER
endif
if ("$2" == "uuencode") then
uudecode -o $fn < "$1"
echo "The following file was uudecoded:"
echo ""
set defans = "1"
while (1)
ls -l
echo ""
echo "Please choose one:"
echo ""
echo "1 -- Display it as ASCII text"
echo "2 -- Save it as a file"
echo "3 -- Quit this menu"
echo ""
echo -n "Which do you prefer (1 - 3)? [$defans] "
set ans = $<
if ("x$ans" == "x") then
set ans = $defans
endif
if ("$ans" == "3") then
rm $1
cd /tmp; /bin/rm -rf /tmp/decode.$$
exit 0
else if ("$ans" == "1") then
if ( ${?PAGER} ) then
${PAGER} $fn
else
more $fn
endif
else if ("$ans" == "2") then
set nfn = ""
echo -n "Save as: $HOME/"
set nfn = $<
if ("x$nfn" != "x") then
/bin/cp $fn ${HOME}/$nfn
else
echo "Not Saved."
endif
else
echo "Invalid choice."
endif
set defans = "3"
end
else
if ( ${?PAGER} ) then
${PAGER} $fn
else
more $1
endif
endif
ACC SHELL 2018