2 Proprietary Rand Corporation
, 1981.
3 Further distribution of
this software
4 subject to the terms of the Rand
10 #include <sys/types.h>
15 extern struct swit anoyes
[]; /* Std no/yes gans array */
20 struct swit switches
[] = {
24 "noformat", 0, /* 3 */
28 "noverbose", 0, /* 7 */
40 register char *drft
, *cp
;
45 char *arguments
[50], **argp
;
52 cp
= r1bindex(argv
[0], '/');
53 if((cp
= m_find(cp
)) != NULL
) {
54 ap
= brkstring(cp
= getcpy(cp
), " ", "\n");
55 ap
= copyip(ap
, arguments
);
62 switch(smatch(++cp
, switches
)) {
63 case -2:ambigsw(cp
, switches
); /* ambiguous */
66 case -1:fprintf(stderr
, "send: -%s unknown\n", cp
);
69 case 1: vec
[vecp
++] = drft
= m_maildir(draft
);
72 case 2: case 3: case 4:
73 case 5: case 6: case 7:
76 case 8: help("send [file] [switches]",
81 fprintf(stderr
, "Send: Only one message at a time.\n");
84 vec
[vecp
++] = drft
= cp
;
87 drft
= m_maildir(draft
);
88 if(stat(drft
, &stbuf
) == -1) {
89 fprintf(stderr
, "Draft file: %s doesn't exist.\n", drft
);
92 cp
= concat("Use \"", drft
, "\"? ", 0);
97 if(stat(drft
, &stbuf
) == -1) {
98 fprintf(stderr
, "Draft file: %s doesn't exist.\n", drft
);
104 vec
[0] = r1bindex(mh_deliver
, '/');
106 while((pid
= fork()) == -1) {
107 fprintf(stderr
, "Waiting for a fork\n");
111 execv(mh_deliver
, vec
);
115 signal(SIGINT
, SIG_IGN
);
116 signal(SIGQUIT
, SIG_IGN
);
117 while((i
= wait(&status
)) != -1 && i
!= pid
) ;
118 if(status
== 0 && !debug
)
122 /*** m_update(); ***/
133 if(cp
= rindex(file
, '/'))
134 sprintf(buf
, "%.*s", (++cp
)-file
, file
);
140 if(link(file
, buf
) < 0 || unlink(file
) < 0) {
141 fprintf(stderr
, "Send: Backup rename failure ");