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]
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
26 #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.6 */
30 Routine creates dead.letter
34 static char pn
[] = "mkdead";
36 char *dotdead
= &dead
[1];
37 gid_t egid
= getegid();
43 Make certain that there's something to copy.
49 Try to create dead letter in current directory
54 if ((aret
= legal(dotdead
)) && stat(dotdead
, &st
) == 0)
55 malf
= fopen(dotdead
, "a");
56 if ((malf
== NULL
) || (aret
== 0)) {
58 try to create in $HOME
60 if((hmdead
= malloc(strlen(home
) + strlen(dead
) + 1)) == NULL
) {
61 fprintf(stderr
, "%s: Can't malloc\n",program
);
62 Dout(pn
, 0, "Cannot malloc.\n");
65 cat(hmdead
, home
, dead
);
66 if ((aret
=legal(hmdead
)) && !(stat(hmdead
, &st
) < 0 &&
68 malf
= fopen(hmdead
, "a");
69 if ((malf
== NULL
) || (aret
== 0)) {
71 "%s: Cannot create %s\n",
73 Dout(pn
, 0, "Cannot create %s\n", dotdead
);
77 Dout(pn
, 0, "error set to %d\n", error
);
82 chmod(hmdead
, DEADPERM
);
83 fprintf(stderr
,"%s: Mail saved in %s\n",program
,hmdead
);
86 chmod(dotdead
, DEADPERM
);
87 fprintf(stderr
,"%s: Mail saved in %s\n",program
,dotdead
);
91 Copy letter into dead letter box
94 aret
= fseek(tmpf
,0L,0);
97 if (!copystream(tmpf
, malf
))
105 static char pn
[] = "savdead";
106 setsig(SIGINT
, saveint
);
107 dflag
= 2; /* do not send back letter on interrupt */
108 Dout(pn
, 0, "dflag set to 2\n");
111 Dout(pn
, 0, "error set to %d\n", error
);
114 Dout(pn
, 0, "maxerr set to %d\n", maxerr
);