1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate * CDDL HEADER START
3*0Sstevel@tonic-gate *
4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
7*0Sstevel@tonic-gate * with the License.
8*0Sstevel@tonic-gate *
9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate * and limitations under the License.
13*0Sstevel@tonic-gate *
14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate *
20*0Sstevel@tonic-gate * CDDL HEADER END
21*0Sstevel@tonic-gate */
22*0Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23*0Sstevel@tonic-gate /* All Rights Reserved */
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gate
26*0Sstevel@tonic-gate /*
27*0Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988
28*0Sstevel@tonic-gate * The Regents of the University of California
29*0Sstevel@tonic-gate * All Rights Reserved
30*0Sstevel@tonic-gate *
31*0Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from
32*0Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its
33*0Sstevel@tonic-gate * contributors.
34*0Sstevel@tonic-gate */
35*0Sstevel@tonic-gate
36*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
37*0Sstevel@tonic-gate
38*0Sstevel@tonic-gate #include "rcv.h"
39*0Sstevel@tonic-gate #include <locale.h>
40*0Sstevel@tonic-gate
41*0Sstevel@tonic-gate /*
42*0Sstevel@tonic-gate * mailx -- a modified version of a University of California at Berkeley
43*0Sstevel@tonic-gate * mail program
44*0Sstevel@tonic-gate *
45*0Sstevel@tonic-gate * Rcv -- receive mail rationally.
46*0Sstevel@tonic-gate *
47*0Sstevel@tonic-gate * Termination processing.
48*0Sstevel@tonic-gate */
49*0Sstevel@tonic-gate
50*0Sstevel@tonic-gate static void writeback(int noremove);
51*0Sstevel@tonic-gate
52*0Sstevel@tonic-gate #define PRIV(x) setgid(myegid), (x), setgid(myrgid);
53*0Sstevel@tonic-gate
54*0Sstevel@tonic-gate /*
55*0Sstevel@tonic-gate * Save all of the undetermined messages at the top of "mbox"
56*0Sstevel@tonic-gate * Save all untouched messages back in the system mailbox.
57*0Sstevel@tonic-gate * Remove the system mailbox, if none saved there.
58*0Sstevel@tonic-gate */
59*0Sstevel@tonic-gate
60*0Sstevel@tonic-gate void
quit(int noremove)61*0Sstevel@tonic-gate quit(
62*0Sstevel@tonic-gate int noremove /* don't remove system mailbox, trunc it instead */
63*0Sstevel@tonic-gate )
64*0Sstevel@tonic-gate {
65*0Sstevel@tonic-gate int mcount, p, modify, autohold, anystat, holdbit, nohold, fd;
66*0Sstevel@tonic-gate FILE *ibuf, *obuf, *fbuf, *readstat;
67*0Sstevel@tonic-gate register struct message *mp;
68*0Sstevel@tonic-gate register int c;
69*0Sstevel@tonic-gate char *id;
70*0Sstevel@tonic-gate int appending;
71*0Sstevel@tonic-gate char *mbox = Getf("MBOX");
72*0Sstevel@tonic-gate
73*0Sstevel@tonic-gate /*
74*0Sstevel@tonic-gate * If we are read only, we can't do anything,
75*0Sstevel@tonic-gate * so just return quickly.
76*0Sstevel@tonic-gate */
77*0Sstevel@tonic-gate
78*0Sstevel@tonic-gate mcount = 0;
79*0Sstevel@tonic-gate if (readonly)
80*0Sstevel@tonic-gate return;
81*0Sstevel@tonic-gate /*
82*0Sstevel@tonic-gate * See if there any messages to save in mbox. If no, we
83*0Sstevel@tonic-gate * can save copying mbox to /tmp and back.
84*0Sstevel@tonic-gate *
85*0Sstevel@tonic-gate * Check also to see if any files need to be preserved.
86*0Sstevel@tonic-gate * Delete all untouched messages to keep them out of mbox.
87*0Sstevel@tonic-gate * If all the messages are to be preserved, just exit with
88*0Sstevel@tonic-gate * a message.
89*0Sstevel@tonic-gate *
90*0Sstevel@tonic-gate * If the luser has sent mail to himself, refuse to do
91*0Sstevel@tonic-gate * anything with the mailbox, unless mail locking works.
92*0Sstevel@tonic-gate */
93*0Sstevel@tonic-gate
94*0Sstevel@tonic-gate #ifndef CANLOCK
95*0Sstevel@tonic-gate if (selfsent) {
96*0Sstevel@tonic-gate printf(gettext("You have new mail.\n"));
97*0Sstevel@tonic-gate return;
98*0Sstevel@tonic-gate }
99*0Sstevel@tonic-gate #endif
100*0Sstevel@tonic-gate
101*0Sstevel@tonic-gate /*
102*0Sstevel@tonic-gate * Adjust the message flags in each message.
103*0Sstevel@tonic-gate */
104*0Sstevel@tonic-gate
105*0Sstevel@tonic-gate anystat = 0;
106*0Sstevel@tonic-gate autohold = value("hold") != NOSTR;
107*0Sstevel@tonic-gate appending = value("append") != NOSTR;
108*0Sstevel@tonic-gate holdbit = autohold ? MPRESERVE : MBOX;
109*0Sstevel@tonic-gate nohold = MBOXED|MBOX|MSAVED|MDELETED|MPRESERVE;
110*0Sstevel@tonic-gate if (value("keepsave") != NOSTR)
111*0Sstevel@tonic-gate nohold &= ~MSAVED;
112*0Sstevel@tonic-gate for (mp = &message[0]; mp < &message[msgCount]; mp++) {
113*0Sstevel@tonic-gate if (mp->m_flag & MNEW) {
114*0Sstevel@tonic-gate receipt(mp);
115*0Sstevel@tonic-gate mp->m_flag &= ~MNEW;
116*0Sstevel@tonic-gate mp->m_flag |= MSTATUS;
117*0Sstevel@tonic-gate }
118*0Sstevel@tonic-gate if (mp->m_flag & MSTATUS)
119*0Sstevel@tonic-gate anystat++;
120*0Sstevel@tonic-gate if ((mp->m_flag & MTOUCH) == 0)
121*0Sstevel@tonic-gate mp->m_flag |= MPRESERVE;
122*0Sstevel@tonic-gate if ((mp->m_flag & nohold) == 0)
123*0Sstevel@tonic-gate mp->m_flag |= holdbit;
124*0Sstevel@tonic-gate }
125*0Sstevel@tonic-gate modify = 0;
126*0Sstevel@tonic-gate if (Tflag != NOSTR) {
127*0Sstevel@tonic-gate if ((readstat = fopen(Tflag, "w")) == NULL)
128*0Sstevel@tonic-gate Tflag = NOSTR;
129*0Sstevel@tonic-gate }
130*0Sstevel@tonic-gate for (c = 0, p = 0, mp = &message[0]; mp < &message[msgCount]; mp++) {
131*0Sstevel@tonic-gate if (mp->m_flag & MBOX)
132*0Sstevel@tonic-gate c++;
133*0Sstevel@tonic-gate if (mp->m_flag & MPRESERVE)
134*0Sstevel@tonic-gate p++;
135*0Sstevel@tonic-gate if (mp->m_flag & MODIFY)
136*0Sstevel@tonic-gate modify++;
137*0Sstevel@tonic-gate if (Tflag != NOSTR && (mp->m_flag & (MREAD|MDELETED)) != 0) {
138*0Sstevel@tonic-gate id = hfield("message-id", mp, addone);
139*0Sstevel@tonic-gate if (id != NOSTR)
140*0Sstevel@tonic-gate fprintf(readstat, "%s\n", id);
141*0Sstevel@tonic-gate else {
142*0Sstevel@tonic-gate id = hfield("article-id", mp, addone);
143*0Sstevel@tonic-gate if (id != NOSTR)
144*0Sstevel@tonic-gate fprintf(readstat, "%s\n", id);
145*0Sstevel@tonic-gate }
146*0Sstevel@tonic-gate }
147*0Sstevel@tonic-gate }
148*0Sstevel@tonic-gate if (Tflag != NOSTR)
149*0Sstevel@tonic-gate fclose(readstat);
150*0Sstevel@tonic-gate if (p == msgCount && !modify && !anystat) {
151*0Sstevel@tonic-gate if (p == 1)
152*0Sstevel@tonic-gate printf(gettext("Held 1 message in %s\n"), mailname);
153*0Sstevel@tonic-gate else
154*0Sstevel@tonic-gate printf(gettext("Held %d messages in %s\n"), p,
155*0Sstevel@tonic-gate mailname);
156*0Sstevel@tonic-gate return;
157*0Sstevel@tonic-gate }
158*0Sstevel@tonic-gate if (c == 0) {
159*0Sstevel@tonic-gate writeback(noremove);
160*0Sstevel@tonic-gate return;
161*0Sstevel@tonic-gate }
162*0Sstevel@tonic-gate
163*0Sstevel@tonic-gate /*
164*0Sstevel@tonic-gate * Create another temporary file and copy user's mbox file
165*0Sstevel@tonic-gate * therein. If there is no mbox, copy nothing.
166*0Sstevel@tonic-gate * If s/he has specified "append" don't copy the mailbox,
167*0Sstevel@tonic-gate * just copy saveable entries at the end.
168*0Sstevel@tonic-gate */
169*0Sstevel@tonic-gate
170*0Sstevel@tonic-gate mcount = c;
171*0Sstevel@tonic-gate if (!appending) {
172*0Sstevel@tonic-gate if ((fd = open(tempQuit, O_RDWR|O_CREAT|O_EXCL, 0600)) < 0 ||
173*0Sstevel@tonic-gate (obuf = fdopen(fd, "w")) == NULL) {
174*0Sstevel@tonic-gate perror(tempQuit);
175*0Sstevel@tonic-gate return;
176*0Sstevel@tonic-gate }
177*0Sstevel@tonic-gate if ((ibuf = fopen(tempQuit, "r")) == NULL) {
178*0Sstevel@tonic-gate perror(tempQuit);
179*0Sstevel@tonic-gate removefile(tempQuit);
180*0Sstevel@tonic-gate fclose(obuf);
181*0Sstevel@tonic-gate return;
182*0Sstevel@tonic-gate }
183*0Sstevel@tonic-gate removefile(tempQuit);
184*0Sstevel@tonic-gate if ((fbuf = fopen(mbox, "r")) != NULL) {
185*0Sstevel@tonic-gate while ((c = getc(fbuf)) != EOF)
186*0Sstevel@tonic-gate putc(c, obuf);
187*0Sstevel@tonic-gate fclose(fbuf);
188*0Sstevel@tonic-gate }
189*0Sstevel@tonic-gate fflush(obuf);
190*0Sstevel@tonic-gate if (fferror(obuf)) {
191*0Sstevel@tonic-gate perror(tempQuit);
192*0Sstevel@tonic-gate fclose(ibuf);
193*0Sstevel@tonic-gate fclose(obuf);
194*0Sstevel@tonic-gate return;
195*0Sstevel@tonic-gate }
196*0Sstevel@tonic-gate fclose(obuf);
197*0Sstevel@tonic-gate if ((fd = open(mbox, O_RDWR|O_CREAT|O_TRUNC, MBOXPERM)) < 0 ||
198*0Sstevel@tonic-gate (obuf = fdopen(fd, "r+")) == NULL) {
199*0Sstevel@tonic-gate perror(mbox);
200*0Sstevel@tonic-gate fclose(ibuf);
201*0Sstevel@tonic-gate return;
202*0Sstevel@tonic-gate }
203*0Sstevel@tonic-gate if (issysmbox)
204*0Sstevel@tonic-gate touchlock();
205*0Sstevel@tonic-gate } else { /* we are appending */
206*0Sstevel@tonic-gate if ((fd = open(mbox, O_RDWR|O_CREAT, MBOXPERM)) < 0 ||
207*0Sstevel@tonic-gate (obuf = fdopen(fd, "a")) == NULL) {
208*0Sstevel@tonic-gate perror(mbox);
209*0Sstevel@tonic-gate return;
210*0Sstevel@tonic-gate }
211*0Sstevel@tonic-gate }
212*0Sstevel@tonic-gate for (mp = &message[0]; mp < &message[msgCount]; mp++)
213*0Sstevel@tonic-gate if (mp->m_flag & MBOX) {
214*0Sstevel@tonic-gate if (msend(mp, obuf, (int)value("alwaysignore") ?
215*0Sstevel@tonic-gate M_IGNORE|M_SAVING : M_SAVING, fputs) < 0) {
216*0Sstevel@tonic-gate perror(mbox);
217*0Sstevel@tonic-gate if (!appending)
218*0Sstevel@tonic-gate fclose(ibuf);
219*0Sstevel@tonic-gate fclose(obuf);
220*0Sstevel@tonic-gate return;
221*0Sstevel@tonic-gate }
222*0Sstevel@tonic-gate mp->m_flag &= ~MBOX;
223*0Sstevel@tonic-gate mp->m_flag |= MBOXED;
224*0Sstevel@tonic-gate if (issysmbox)
225*0Sstevel@tonic-gate touchlock();
226*0Sstevel@tonic-gate }
227*0Sstevel@tonic-gate
228*0Sstevel@tonic-gate /*
229*0Sstevel@tonic-gate * Copy the user's old mbox contents back
230*0Sstevel@tonic-gate * to the end of the stuff we just saved.
231*0Sstevel@tonic-gate * If we are appending, this is unnecessary.
232*0Sstevel@tonic-gate */
233*0Sstevel@tonic-gate
234*0Sstevel@tonic-gate if (!appending) {
235*0Sstevel@tonic-gate rewind(ibuf);
236*0Sstevel@tonic-gate c = getc(ibuf);
237*0Sstevel@tonic-gate while (c != EOF) {
238*0Sstevel@tonic-gate putc(c, obuf);
239*0Sstevel@tonic-gate if (ferror(obuf))
240*0Sstevel@tonic-gate break;
241*0Sstevel@tonic-gate c = getc(ibuf);
242*0Sstevel@tonic-gate }
243*0Sstevel@tonic-gate fclose(ibuf);
244*0Sstevel@tonic-gate fflush(obuf);
245*0Sstevel@tonic-gate }
246*0Sstevel@tonic-gate trunc(obuf);
247*0Sstevel@tonic-gate if (fferror(obuf)) {
248*0Sstevel@tonic-gate perror(mbox);
249*0Sstevel@tonic-gate fclose(obuf);
250*0Sstevel@tonic-gate return;
251*0Sstevel@tonic-gate }
252*0Sstevel@tonic-gate fclose(obuf);
253*0Sstevel@tonic-gate if (mcount == 1)
254*0Sstevel@tonic-gate printf(gettext("Saved 1 message in %s\n"), mbox);
255*0Sstevel@tonic-gate else
256*0Sstevel@tonic-gate printf(gettext("Saved %d messages in %s\n"), mcount, mbox);
257*0Sstevel@tonic-gate
258*0Sstevel@tonic-gate /*
259*0Sstevel@tonic-gate * Now we are ready to copy back preserved files to
260*0Sstevel@tonic-gate * the system mailbox, if any were requested.
261*0Sstevel@tonic-gate */
262*0Sstevel@tonic-gate writeback(noremove);
263*0Sstevel@tonic-gate }
264*0Sstevel@tonic-gate
265*0Sstevel@tonic-gate /*
266*0Sstevel@tonic-gate * Preserve all the appropriate messages back in the system
267*0Sstevel@tonic-gate * mailbox, and print a nice message indicating how many were
268*0Sstevel@tonic-gate * saved. Incorporate any new mail that we found.
269*0Sstevel@tonic-gate */
270*0Sstevel@tonic-gate static void
writeback(int noremove)271*0Sstevel@tonic-gate writeback(int noremove)
272*0Sstevel@tonic-gate {
273*0Sstevel@tonic-gate register struct message *mp;
274*0Sstevel@tonic-gate register int p, c;
275*0Sstevel@tonic-gate struct stat st;
276*0Sstevel@tonic-gate FILE *obuf = 0, *fbuf = 0, *rbuf = 0;
277*0Sstevel@tonic-gate void (*fhup)(int), (*fint)(int), (*fquit)(int);
278*0Sstevel@tonic-gate int fd = -1;
279*0Sstevel@tonic-gate
280*0Sstevel@tonic-gate fhup = sigset(SIGHUP, SIG_IGN);
281*0Sstevel@tonic-gate fint = sigset(SIGINT, SIG_IGN);
282*0Sstevel@tonic-gate fquit = sigset(SIGQUIT, SIG_IGN);
283*0Sstevel@tonic-gate
284*0Sstevel@tonic-gate if (issysmbox)
285*0Sstevel@tonic-gate lockmail();
286*0Sstevel@tonic-gate if ((fbuf = fopen(mailname, "r+")) == NULL) {
287*0Sstevel@tonic-gate perror(mailname);
288*0Sstevel@tonic-gate goto die;
289*0Sstevel@tonic-gate }
290*0Sstevel@tonic-gate if (!issysmbox)
291*0Sstevel@tonic-gate lock(fbuf, "r+", 1);
292*0Sstevel@tonic-gate fstat(fileno(fbuf), &st);
293*0Sstevel@tonic-gate if (st.st_size > mailsize) {
294*0Sstevel@tonic-gate printf(gettext("New mail has arrived.\n"));
295*0Sstevel@tonic-gate snprintf(tempResid, PATHSIZE, "%s/:saved/%s", maildir, myname);
296*0Sstevel@tonic-gate PRIV(rbuf = fopen(tempResid, "w+"));
297*0Sstevel@tonic-gate if (rbuf == NULL) {
298*0Sstevel@tonic-gate snprintf(tempResid, PATHSIZE, "/tmp/Rq%-ld", mypid);
299*0Sstevel@tonic-gate fd = open(tempResid,O_RDWR|O_CREAT|O_EXCL, 0600);
300*0Sstevel@tonic-gate PRIV(rbuf = fdopen(fd, "w+"));
301*0Sstevel@tonic-gate if (rbuf == NULL) {
302*0Sstevel@tonic-gate snprintf(tempResid, PATHSIZE,
303*0Sstevel@tonic-gate "%s/:saved/%s", maildir,
304*0Sstevel@tonic-gate myname);
305*0Sstevel@tonic-gate perror(tempResid);
306*0Sstevel@tonic-gate fclose(fbuf);
307*0Sstevel@tonic-gate goto die;
308*0Sstevel@tonic-gate }
309*0Sstevel@tonic-gate }
310*0Sstevel@tonic-gate #ifdef APPEND
311*0Sstevel@tonic-gate fseek(fbuf, mailsize, 0);
312*0Sstevel@tonic-gate while ((c = getc(fbuf)) != EOF)
313*0Sstevel@tonic-gate putc(c, rbuf);
314*0Sstevel@tonic-gate #else
315*0Sstevel@tonic-gate p = st.st_size - mailsize;
316*0Sstevel@tonic-gate while (p-- > 0) {
317*0Sstevel@tonic-gate c = getc(fbuf);
318*0Sstevel@tonic-gate if (c == EOF) {
319*0Sstevel@tonic-gate perror(mailname);
320*0Sstevel@tonic-gate fclose(fbuf);
321*0Sstevel@tonic-gate goto die;
322*0Sstevel@tonic-gate }
323*0Sstevel@tonic-gate putc(c, rbuf);
324*0Sstevel@tonic-gate }
325*0Sstevel@tonic-gate #endif
326*0Sstevel@tonic-gate fclose(fbuf);
327*0Sstevel@tonic-gate fseek(rbuf, 0L, 0);
328*0Sstevel@tonic-gate if (issysmbox)
329*0Sstevel@tonic-gate touchlock();
330*0Sstevel@tonic-gate }
331*0Sstevel@tonic-gate
332*0Sstevel@tonic-gate if ((obuf = fopen(mailname, "r+")) == NULL) {
333*0Sstevel@tonic-gate perror(mailname);
334*0Sstevel@tonic-gate goto die;
335*0Sstevel@tonic-gate }
336*0Sstevel@tonic-gate #ifndef APPEND
337*0Sstevel@tonic-gate if (rbuf != NULL)
338*0Sstevel@tonic-gate while ((c = getc(rbuf)) != EOF)
339*0Sstevel@tonic-gate putc(c, obuf);
340*0Sstevel@tonic-gate #endif
341*0Sstevel@tonic-gate p = 0;
342*0Sstevel@tonic-gate for (mp = &message[0]; mp < &message[msgCount]; mp++)
343*0Sstevel@tonic-gate if ((mp->m_flag&MPRESERVE)||(mp->m_flag&MTOUCH)==0) {
344*0Sstevel@tonic-gate p++;
345*0Sstevel@tonic-gate if (msend(mp, obuf, 0, fputs) < 0) {
346*0Sstevel@tonic-gate perror(mailname);
347*0Sstevel@tonic-gate goto die;
348*0Sstevel@tonic-gate }
349*0Sstevel@tonic-gate if (issysmbox)
350*0Sstevel@tonic-gate touchlock();
351*0Sstevel@tonic-gate }
352*0Sstevel@tonic-gate #ifdef APPEND
353*0Sstevel@tonic-gate if (rbuf != NULL)
354*0Sstevel@tonic-gate while ((c = getc(rbuf)) != EOF)
355*0Sstevel@tonic-gate putc(c, obuf);
356*0Sstevel@tonic-gate #endif
357*0Sstevel@tonic-gate fflush(obuf);
358*0Sstevel@tonic-gate trunc(obuf);
359*0Sstevel@tonic-gate if (fferror(obuf)) {
360*0Sstevel@tonic-gate perror(mailname);
361*0Sstevel@tonic-gate goto die;
362*0Sstevel@tonic-gate }
363*0Sstevel@tonic-gate alter(mailname);
364*0Sstevel@tonic-gate if (p) {
365*0Sstevel@tonic-gate if (p == 1)
366*0Sstevel@tonic-gate printf(gettext("Held 1 message in %s\n"), mailname);
367*0Sstevel@tonic-gate else
368*0Sstevel@tonic-gate printf(gettext("Held %d messages in %s\n"), p,
369*0Sstevel@tonic-gate mailname);
370*0Sstevel@tonic-gate }
371*0Sstevel@tonic-gate
372*0Sstevel@tonic-gate if (!noremove && (fsize(obuf) == 0) && (value("keep") == NOSTR)) {
373*0Sstevel@tonic-gate if (stat(mailname, &st) >= 0)
374*0Sstevel@tonic-gate PRIV(delempty(st.st_mode, mailname));
375*0Sstevel@tonic-gate }
376*0Sstevel@tonic-gate
377*0Sstevel@tonic-gate die:
378*0Sstevel@tonic-gate if (rbuf) {
379*0Sstevel@tonic-gate fclose(rbuf);
380*0Sstevel@tonic-gate PRIV(removefile(tempResid));
381*0Sstevel@tonic-gate }
382*0Sstevel@tonic-gate if (obuf)
383*0Sstevel@tonic-gate fclose(obuf);
384*0Sstevel@tonic-gate if (issysmbox)
385*0Sstevel@tonic-gate unlockmail();
386*0Sstevel@tonic-gate sigset(SIGHUP, fhup);
387*0Sstevel@tonic-gate sigset(SIGINT, fint);
388*0Sstevel@tonic-gate sigset(SIGQUIT, fquit);
389*0Sstevel@tonic-gate }
390*0Sstevel@tonic-gate
391*0Sstevel@tonic-gate void
lockmail(void)392*0Sstevel@tonic-gate lockmail(void)
393*0Sstevel@tonic-gate {
394*0Sstevel@tonic-gate PRIV(maillock(lockname,10));
395*0Sstevel@tonic-gate }
396*0Sstevel@tonic-gate
397*0Sstevel@tonic-gate void
unlockmail(void)398*0Sstevel@tonic-gate unlockmail(void)
399*0Sstevel@tonic-gate {
400*0Sstevel@tonic-gate PRIV(mailunlock());
401*0Sstevel@tonic-gate }
402