File: hftcp

package info (click to toggle)
hf 0.7.3-4etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 3,684 kB
  • ctags: 3,156
  • sloc: ansic: 26,447; cpp: 4,909; sh: 3,785; makefile: 309
file content (73 lines) | stat: -rwxr-xr-x 1,193 bytes parent folder | download | duplicates (2)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
# test script vor remote control with hf
# install me as an inetd service, see HF-HOWTO
# by Günther Montag dl4mge

rc_done="\033[71G\033[32mdone\033[m"
rc_failed="\033[71G\033[31m\033[1mfailed\033[m"

function help {
echo "
hftcp
Command:
h	help
r	read mail
s	send mail
b	shell 
l	launch the missiles
p	send global peace message 
q	quit
"
}

help
EX=
tmpfile=/tmp/hftcp
while [ 1 ];
do
    echo -n "hftcp:> "
    read command
    case $command in
	h) help
	;;
	r) mail
	;;
	s) 
	    rm -f $tmpfile
	    touch $tmpfile
	    
	    EX=
	    echo -n "to ? "
	    read to
	    echo -n "cc ? "
	    read cc
	    echo -n "bc ? "
	    read bc
	    echo -n "subject ? "
	    read subject
	    echo  "enter text. Quit with /EX ! "
	    while [ ! $EX ] ;
	    do
		read moretext
		if [ "$moretext" == "/EX" ] ;  then
		    EX=1
		else
		    echo -n $moretext >> $tmpfile
		fi
	    done
	    mail -s $subject -c $cc -b $bc $to  < $tmpfile
	;;
	b) echo "I will start sh. Quit with exit."
	    /bin/sh
	;;
	l) echo -e No ! $rc_failed
	;;
	p) sleep 1 && echo -e Transmission of World-wide Peace Message "$rc_done"
	;;
	q)  rm -f $tmpfile
	    exit 0
	;;
	*) echo unknown command
	;;
    esac
done