/*
* 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
* 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
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "rcv.h"
#include <locale.h>
/*
* mailx -- a modified version of a University of California at Berkeley
* mail program
*
* Rcv -- receive mail rationally.
*
* Termination processing.
*/
/*
* Save all of the undetermined messages at the top of "mbox"
* Save all untouched messages back in the system mailbox.
* Remove the system mailbox, if none saved there.
*/
void
quit(
int noremove /* don't remove system mailbox, trunc it instead */
)
{
register int c;
char *id;
int appending;
/*
* If we are read only, we can't do anything,
* so just return quickly.
*/
mcount = 0;
if (readonly)
return;
/*
* See if there any messages to save in mbox. If no, we
* can save copying mbox to /tmp and back.
*
* Check also to see if any files need to be preserved.
* Delete all untouched messages to keep them out of mbox.
* If all the messages are to be preserved, just exit with
* a message.
*
* If the luser has sent mail to himself, refuse to do
* anything with the mailbox, unless mail locking works.
*/
#ifndef CANLOCK
if (selfsent) {
return;
}
#endif
/*
* Adjust the message flags in each message.
*/
anystat = 0;
}
anystat++;
}
modify = 0;
}
c++;
p++;
modify++;
else {
}
}
}
if (p == 1)
else
mailname);
return;
}
if (c == 0) {
return;
}
/*
* Create another temporary file and copy user's mbox file
* therein. If there is no mbox, copy nothing.
* just copy saveable entries at the end.
*/
mcount = c;
if (!appending) {
return;
}
return;
}
}
return;
}
return;
}
if (issysmbox)
touchlock();
} else { /* we are appending */
return;
}
}
if (!appending)
return;
}
if (issysmbox)
touchlock();
}
/*
* Copy the user's old mbox contents back
* to the end of the stuff we just saved.
* If we are appending, this is unnecessary.
*/
if (!appending) {
while (c != EOF) {
break;
}
}
return;
}
if (mcount == 1)
else
/*
* Now we are ready to copy back preserved files to
* the system mailbox, if any were requested.
*/
}
/*
* Preserve all the appropriate messages back in the system
* mailbox, and print a nice message indicating how many were
* saved. Incorporate any new mail that we found.
*/
static void
{
register int p, c;
if (issysmbox)
lockmail();
goto die;
}
if (!issysmbox)
"%s/:saved/%s", maildir,
myname);
goto die;
}
}
#ifdef APPEND
#else
while (p-- > 0) {
if (c == EOF) {
goto die;
}
}
#endif
if (issysmbox)
touchlock();
}
goto die;
}
#ifndef APPEND
#endif
p = 0;
p++;
goto die;
}
if (issysmbox)
touchlock();
}
#ifdef APPEND
#endif
goto die;
}
if (p) {
if (p == 1)
else
mailname);
}
}
die:
if (rbuf) {
}
if (obuf)
if (issysmbox)
unlockmail();
}
void
lockmail(void)
{
}
void
unlockmail(void)
{
PRIV(mailunlock());
}