home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
ddjmag
/
ddj8706.arc
/
BBS.L6
< prev
next >
Wrap
Text File
|
1987-05-05
|
3KB
|
132 lines
Listing Six
pmail
1 USERS=/u/bbs/rbin/user.file
2 echo 'who am i | cut -f1 -d" " ' 'date | cut -c1-16' "pmail" >>/u/bbs/log.file
# display pmail instructions
3 echo
4 echo" ************** Private Mail ***************"
5 echo
6 echo Commands:
7 echo s - send mail to another user
8 echo r - read mail sent to you
9 echo l - list the users by user id and name
10 echo x - exit the private mail system
11 echo
# accept the first pmail command
12 echo "Command: \c"
13 read choice
# loop until the user wants to quit
14 while [ "$choice" != x -o "$choice" != X ]
15 do
16 echo
17 case $choice in
18 [Ss])
# send private mail
# print instructions
19 echo "WARNING: To successfully send mail observe these rules:"
20 echo
21 echo " 1. If you wish to erase a character, use the backspace key."
22 echo "DO NOT, DO NOT use the delete key."
23 echo " 2. Type a carriage return at the end of each line on the"
24 echo "screen. Lines should be no more than 80 characters."
25 echo " 3. Do not use the following characters in your message (they"
26 echo "have special meaning to the system): @ and #"
27 echo
28 echo "Press RETURN to begin sending your message: \c"
29 read dummy
30 echo
# collect user id of recipient
31 echo "To whom (user id): \c"
32 read to
# verify that recipient entered is a valid user id
33 TPERS='grep $to $USERS | wc -c'
34 if [ "$TPERS" -eq 0 ]
35 then
# user id is invalid
36 echo
37 echo "Sorry, that user id doesn't exist."
38 echo "List them with the l command."
39 else
# send mail
40 echo
41 echo "Start typing your message. Type a period on a new"
42 echo "line to send the message."
43 echo
44 mail $to
45 fi
# collect next option
46 echo
47 echo "Command (x to exit): \c"
48 read choice
49 continue;;
50 [Rr])
# read private mail
# print instructions
51 echo "After each message you will receive a ╒?╒ prompt."
52 echo "Type ╒d╒ to delete the message, <cr> to leave it in"
53 echo "your mailbox, or ╒q╒ to stop reading mail."
54 echo
# real the mail
55 mail
56 echo
# collect the next command
57 echo "Command (x to exit): \c"
58 read choice
59 continue;;
60 [Ll])
# display a list of user names and associated user id's
61 echo
62 more $USERS
63 echo
# collect the next command
64 echo "Command (x to exit): \c"
65 read choice
66 continue;;
67 *)
# if an unrecognized command was entered, prompt for another one
68 echo "Command (x to exit): \c"
69 read choice
70 continue;;
71 esac
72 done
73 echo