File: sun-message

package info (click to toggle)
metamail 2.7-47sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,360 kB
  • ctags: 1,331
  • sloc: ansic: 16,102; sh: 10,934; csh: 229; makefile: 174
file content (56 lines) | stat: -rw-r--r-- 917 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh -e
#
#  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.

if [ "$2" = "uuencode" ]
then 
	fn=`tempfile -p metamail -m 600`
	uudecode -o $fn "$1"

	echo "The following file was uudecoded:"
	echo

	defans=1
	while :
	do
		ls -l $fn

		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] "

		read ans
		if test -z "${ans:-}"
		then
			ans=$defans
		fi

		case $ans in
			1)	sensible-pager $fn ;;
			2)	echo -n "Save as: $HOME/"
				read nfn
				if test ! -z "${nfn:-}"
				then
					cp $fn "$HOME/$nfn"
				else
					echo Not Saved.
				fi
				;;
			3)	rm "$1" $fn
				exit 0
				;;
			*)	echo Invalid choice. ;;
		esac
		defans=3
	done
else
	sensible-pager "$1"
fi