/*
 * mail  Version 0.6  18JAN84
 *
 * This is the master script for building the `mail' subtree.
 */
/*
 * TNIX Version
 * Keyshell Version Number 1
 */

mail
{
>
>\ksend mail\e - Lets you send mail to other users.
>
>\kread mail\e - Lets you read mail from other users.
>
>\krmv mail\e - Removes all of the letters in your mailbox.  
>
>\ksend mesg\e - Lets you send a message to someone else who is now logged in.
>
>\kctrl mesg\e - Lets you determine whether messages from others will be 
>            displayed on your terminal.   
>
>\kdone\e - Cancels the command being built or returns to the previous
>            set of keys.

	msg;
	f1;send mail; {
>
>Enter the lowercase login name of the person you want to write to.
>
		cmd (^mail ), msg (^To whom? \(enter the recipient\'s login name in lowercase\): %p), next;
                f1;; hist;
		f2;; hist;
		f3;; hist;
		f4;; hist;
		f5;; hist;
		f7;manual; man (mail);
		f8;done; msg, break;
	}, {
>
		msg (^Now type your letter, ending it with RETURN and CTRL-D),
		exec, msg, break;
	};
	f2;read mail;{
>
        msg(^Looking in your mailbox...), cmd(^mail -p | more), exec, msg, break; 
        };
        f3;rmv mail; {
>
>\kyes\e - Removes \uall\n of your accumulated mail.
>
>\kno\e - Leaves your mail intact.
>
>\kdone\e - The same as \kno\e.
>
>To remove letters selectively, you can use the \umail\n command.  For 
>details about \umail\n, press \kdone\e and then type \uman mail\n.
> 
        msg(^Are you sure you want to remove all of your mail? %%);
       	        f1;yes; cmd(^rm -f /usr/spool/mail/\$USER), msg, exec, break;
		f2;no; msg, break;
		f8;done; msg, break;
        };
	f4;send mesg; {
>
>Enter the lowercase login name of the person to whom you want to send a
>message.  The intended recipient must be currently logged in and must
>not have denied message permission. 
>
>To find out who is logged in, press \kwho is on\e.
>
		msg(^Wait for a message to appear above...),
		sly (history off), sly(echo "

If the person you're writing to isn't logged in or has denied message
permission, the write program will exit...

"),
		sly (history on),
		cmd (^write ), msg (^To whom? \(enter the recipient\'s login name in lowercase\): %p), next;
		f6;who is on; call, msg, cmd(^who), exec, return;
		f7;manual; man(write);
		f8;done; cmd, msg, break;
	}, {
>
		msg (^Now type your message, ending it with RETURN and CTRL-D...),
		exec, break;
        };
	f5;ctrl mesg; {
>
>This controls whether messages sent to you via the \uwrite\n command or
>the \ksend mesg\e key will be displayed.  Such messages sometimes 
>disrupt the display.
>
>\kyes\e - Display messages at any time.
>
>\kno\e - Suppress display of messages.
>
		cmd (^mesg -),
		msg (^Should messages from others be displayed?  Select \"yes\" or \"no\": %%);
		f1;yes; par (y), msg, exec, break;
		f2;no; par (n), msg, exec, break;
		f7;manual; man (mesg);
		f8;done; msg, break;
	};
	f8;done; msg, break;
}
