4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1998 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
32 * University Copyright- Copyright (c) 1982, 1986, 1988
33 * The Regents of the University of California
36 * University Acknowledgment- Portions of this document are derived from
37 * software developed by the University of California, Berkeley, and its
41 #pragma ident "%Z%%M% %I% %E% SMI"
44 * mailx -- a modified version of a University of California at Berkeley
47 * Local routines that are installation dependent.
52 static int ismailbox(char *file
);
55 * Locate the user's mailbox file (ie, the place where new, unread
56 * mail is queued). In SVr4 UNIX, it is in /var/mail/name.
57 * In preSVr4 UNIX, it is in either /usr/mail/name or /usr/spool/mail/name.
65 copy(name
, copy(maildir
, mailname
));
66 issysmbox
= 1; /* it's a system mailbox */
67 } else if ((cp
= getenv("MAIL")) != NULL
) {
68 /* if $MAIL is set, use it */
69 nstrcpy(mailname
, PATHSIZE
, cp
);
70 issysmbox
= ismailbox(mailname
);
71 /* XXX - should warn that there's no locking? */
73 copy(myname
, copy(maildir
, mailname
));
77 lockname
= strrchr(mailname
, '/') + 1;
81 * Make sure file matches (/usr|/var)(/spool)?/mail/.
82 * If is does, it's a "system mailbox", return true.
88 return (strncmp(file
, maildir
, strlen(maildir
)) == 0);
90 if (strncmp(file
, "/var", 4) != 0
91 && strncmp(file
, "/usr", 4) != 0
95 if (strncmp(file
, "/spool", 6) == 0)
97 return (strncmp(file
, "/mail/", 6) == 0);