Menu.nlist revision 7c478bd95313f5f23a4c958a745db2134aa03244
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
`if [ "${MFIRST}" = "true" ];
then
message -w "Creating list of new mail messages. Please wait...";
set -l MFIRST=false;
else
message -w "Updating list of new mail messages. Please wait...";
fi;
cocreate -R listing -s ( -e "Unknown command" -i new mailx -N -f $ARG2;
cosend new "set MBOX=$HOME/mbox";
cosend new "set screen=999";
cosend new "set hold";
cosend new "ignore message status"`
menu="Read New Mail"
help=OPEN TEXT OBJECTS/Text.h "Read New Mail" mail/T.nmail
altslks=true
rows=18
init=`if [ "${NR}" -eq "0" ];
then
message -b 1 "There are no messages left in your mailbox.";
echo false;
else
echo true;
fi`
close=` codestroy -R listing new q | set -l MBYE;
regex -v "$MBYE"
'^Held +([0-9]+ messages*)$0 in' '$m0 left in mailbox.'
'.*' '' | set -l MLEFT;
regex -v "$MBYE"
'^New mail has arrived' 'New mail has arrived.'
'.*' '' | set -l MNEW;
regex -v "$MNEW:$MLEFT"
'^:$' 'echo'
'^[^:]+:' 'message -b 2 "$MNEW"'
'.*' 'message -b 1 "$MLEFT"' | set -l CMD;
$CMD;
unset -l MBYE -l MNEW -l MLEFT -l MTO -l MSUBJ`
# First two cosends are needed to allow new messages to pop up in window
# as they are delivered (or rather every $MAILCHECK seconds).
`cosend new "fi $ARG2" | set -l MUPD;
cosend new "fi $ARG3" > /dev/null;
cosend new "h" | regex
'^[^0-9]*([0-9]+)$0 ([^ ]+)$1 +(...)$2 (...)$3 +([0-9]+)$4 (..)$5:(..)$6 +([0-9]+)$7/[0-9]+ *(.*)$8$'
'$m0+$m1+$m2+$m3+$m4+$m5+$m6+$m7+$m8' | awk -F+ '
{
hour = $6
tod = "pm"
if ($6 > 12)
hour -= 12
else {
if (hour == 0)
hour = 12
}
if ($6 < 12)
tod = "am"
printf "name=\"%-3d %s\"\n", $1, $2
printf "description=\"%s/%s %-2d %2d:%s%s %5s lines %-25s\"\n", $3, $4, $5, hour, $7, tod, $8, $9
printf "action=OPEN TEXT OBJECTS/mail/Text.read new %d \"%s\" \"%s\"\n", $1, $2, $9
printf "lininfo=`set -l MTO=\"%s\" -l MSUBJ=\"%s\"`\"%-3d\"\n", $2, $9, $1
print "itemmsg=\"Move to a message with arrow keys and press ENTER to read the message.\""
}
';
regex -v "$MUPD"
'^New mail has arrived.' 'NEW'
'.*' '' | set -l MNEW;
regex -v "$MNEW"
'^$' 'echo'
'.*' 'message -b 2 "New mail has arrived."' | set -l CMD;
$CMD;
unset -l $MUPD`
name=HELP
button=9
action=help
name=REPLY
button=10
action=OPEN OBJECTS/mail/Form.send "Reply to" "${MTO}" "Re: ${MSUBJ}"
name=SAVE
button=11
action=`message -w "Saving message. Please wait...";
cosend new "s ${LININFO} $HOME/mbox" > /dev/null;
message -w "Message has been saved."`update
name=DELETE
button=12
action=`message -w "Deleting message. Please wait...";
cosend new "d ${LININFO}" > /dev/null;
message -w "Message has been deleted."`update
name=UPDATE
button=13
action=update
name=CANCEL
button=14
action=close