2 Proprietary Rand Corporation
, 1981.
3 Further distribution of
this software
4 subject to the terms of the Rand
10 #include "../adrparse.h"
14 #include <sys/types.h>
15 #include <sys/timeb.h>
24 char *malloc(), *calloc(), *getncpy(), *sprintf(), *strcpy(), *strncop();
28 #define OUTPUTLINELEN 72
30 #define RECVPROG "/.mh_receive"
32 #define FCCS 10 /* Max number of fcc's allowed */
36 int alitype
; /*** 0 = nomatch, 2 = *match, 1 = stringmatch ***/
38 struct shome
{ /* Internal name/uid/home database */
46 struct swit switches
[] = {
48 "deliver", -1, /* 1 */
50 "noformat", 0, /* 3 */
54 "noremove", 0, /* 7 */
56 "noverbose", 0, /* 9 */
62 int verbose
, format
=1, msgid
, debug
, myuid
, rmflg
;
63 short lockwait
; /* Secs to wait for mail lock (From strings/lockdir.c) */
64 #define LOCKWAIT (lockwait * 5) /* Ignore lock if older than this */
66 short outputlinelen
= OUTPUTLINELEN
;
68 char tmpfil
[32], uutmpfil
[32], fccfold
[FCCS
][128];
71 char *head_alias
= ""; /* 1st match in a local mailbox's alias chain */
72 /* (If a:b, b:c, c:d then head_alias == "a") */
74 struct mailname localaddrs
, netaddrs
, uuaddrs
;
75 struct mailname
*mn_from
;
83 register char *cp
, **argp
;
84 register struct mailname
*lp
;
85 char buf
[BUFSIZ
], name
[NAMESZ
];
87 int state
, compnum
, fd
;
88 FILE *in
, *out
, *uuout
;
92 format
=0; /* default to noformat if no Arpanet */
98 switch(smatch(++cp
, switches
)) {
99 case -2:ambigsw(cp
, switches
); /* ambiguous */
102 case -1:fprintf(stderr
, "deliver: -%s unknown switch.\n", cp
);
104 case 0: verbose
++; debug
++; continue; /* -debug */
105 case 1: if(!(deliverto
= *argp
++) || *deliverto
== '-'){
106 missing
: fprintf(stderr
, "deliver: missing arg to %s\n",
111 case 2: format
= 1; continue; /* -format */
112 case 3: format
= 0; continue; /* -noformat */
113 case 4: msgid
= 1; continue; /* -msgid */
114 case 5: msgid
= 0; continue; /* -nomsgid */
115 case 6: rmflg
= 1; continue; /* -remove */
116 case 7: rmflg
= -1; continue; /* -noremove */
117 case 8: verbose
= 1; continue; /* -verbose */
118 case 9: verbose
= 0; continue; /* -noverbose */
119 case 10: if(!(cp
= *argp
++) || *cp
== '-')
121 outputlinelen
= atoi(cp
);
123 case 11: help("deliver [switches] file",
128 fprintf(stderr
, "Deliver: Only one message at a time!\n");
134 fprintf(stderr
, "Deliver: No Message specified.\n");
135 fprintf(stderr
, "Deliver: Usage: deliver [switches] file\n");
138 if(outputlinelen
< 10) {
139 fprintf(stderr
, "deliver: Impossible width: %d\n",
147 if((uid
= geteuid()) && uid
!= 1 && getegid() != DAEMON_GRP
) {
148 /* if(myuid != 0 && getgid() != DAEMON_GRP) { */
149 fprintf(stderr
, "Deliver: -deliver switch su only.\n");
153 setpgrp(0, getpid()); /* So we don't blow away our parent */
156 strcpy(uutmpfil
, msg
);
157 if(access(tmpfil
, 4) == -1) {
158 fprintf(stderr
, "Deliver: Can't access ");
162 if(!rmflg
) rmflg
= -1;
165 if(!rmflg
) rmflg
= 1;
166 if((in
= fopen(msg
, "r")) == NULL
) {
167 fprintf(stderr
, "Deliver: Can't open ");
171 VOID
copy(makename("locs", ".tmp"), copy("/usr/tmp/mh/", tmpfil
));
173 if((out
= fopen(tmpfil
, "w")) == NULL
) {
174 fprintf(stderr
, "Can't create %s\n", tmpfil
);
177 VOID
chmod(tmpfil
, 0744);
181 VOID
copy(makename("uulc", ".tmp"), copy("/usr/tmp/mh/", uutmpfil
));
183 if((uuout
= fopen(uutmpfil
, "w")) == NULL
) {
184 fprintf(stderr
, "Can't create %s\n", uutmpfil
);
187 VOID
chmod(uutmpfil
, 0600);
189 uuout
= fopen("/dev/null","w");;
191 putdate(out
); /* Tack on the date */
192 putdate(uuout
); /* Tack on the date */
193 for(compnum
= 1, state
= FLD
;;) {
194 state
= m_getfld(state
, name
, buf
, sizeof buf
, in
);
202 if(uleq(name
, "fcc")) {
204 while(*cp
== ' ' || *cp
== '\t')
207 fprintf(stderr
, "Deliver: too many fcc's.\n");
210 VOID
copy(cp
, fccfold
[fccind
]);
211 if(cp
= rindex(fccfold
[fccind
], '\n'))
216 hdrptr
= add(buf
, hdrptr
);
217 while(state
== FLDPLUS
) {
218 state
= m_getfld(state
, name
, buf
, sizeof buf
, in
);
219 hdrptr
= add(buf
, hdrptr
);
221 putfmt(name
, hdrptr
, out
);
222 { /* Do not format uucp mail */
224 tmpformat
= format
; format
= 0;
225 putfmt (name
, hdrptr
, uuout
);
234 putfrom(out
); /* Tack on the from */
235 /* But NOT on the UUCP mail */
236 putmsgid(out
); /* and msg id if desired */
237 putmsgid(uuout
); /* (why not?) */
239 fprintf(out
, "\n%s", buf
);
240 fprintf(uuout
, "\n%s", buf
);
241 while(state
== BODY
) {
242 state
=m_getfld(state
,name
,buf
,sizeof buf
,in
);
252 fprintf(stderr
, "??Message Format Error ");
253 fprintf(stderr
, "in Component #%d.\n", compnum
);
257 fprintf(stderr
, "Getfld returned %d\n", state
);
269 del1
: if(deliverto
) {
273 printf("Before alias():\n"); pl();
276 if(localaddrs
.m_next
)
277 alias(); /* Map names if needed */
279 for(lp
= localaddrs
.m_next
; lp
; lp
= lp
->m_next
)
280 if(home(lp
->m_mbox
) == NULL
) {
281 fprintf(stderr
, "Deliver: Unknown local user: %s.\n", lp
->m_mbox
);
282 fprintf(stderr
, "Deliver: Message not delivered.\n");
288 printf("Addrs:\n"); pl();
291 VOID
signal(SIGINT
, SIG_IGN
);
292 VOID
signal(SIGQUIT
, SIG_IGN
);
293 if(!debug
) { /* Send the mail */
294 if(localaddrs
.m_next
) {
295 fd
= open(tmpfil
, 0);
296 for(lp
= localaddrs
.m_next
; lp
; lp
= lp
->m_next
)
297 sendmail(lp
->m_mbox
, fd
, lp
->m_headali
);
301 for(state
= 0; state
< fccind
; state
++)
302 fcc(tmpfil
, fccfold
[state
]);
315 if (!deliverto
) /* "Deliverto" makes it same as tmpfil */
316 VOID
unlink (uutmpfil
); /* Even if rmflg < 0? */
323 putfmt(name
, str
, out
)
328 register struct mailname
*mp
;
333 while(*str
== ' ' || *str
== '\t') str
++;
334 if(uleq(name
, "to") ||
337 uleq(name
, "reply-to") ||
338 uleq(name
, "from")) {
339 while(cp
= getname(str
)) {
340 if(!(mp
= getm(cp
, HOSTNAME
)))
342 if(uleq(name
, "from") || uleq(name
, "reply-to") ||
344 mp
->m_hnum
== HOSTNUM
?
346 (*mp
->m_at
== '!') ? &uuaddrs
:
348 if(!uleq(name
, "bcc") && format
) {
350 fprintf(out
, "%s: ", name
);
351 linepos
+= (nameoutput
= strlen(name
)+2);
353 cp
= adrformat(mp
,HOSTNAME
);
354 /* Needs default name in uumail case */
356 if(linepos
!= nameoutput
)
357 if(len
+ linepos
+ 2 > outputlinelen
) {
358 fprintf(out
, ",\n%*s", nameoutput
, "");
359 linepos
= nameoutput
;
367 if(uleq(name
, "from"))
372 if(linepos
) putc('\n', out
);
373 if(!format
&& !uleq(name
, "bcc"))
377 fprintf(out
, "%s: %s", name
, str
);
383 register struct passwd
*pw
;
384 register struct shome
*h
, *ph
;
385 struct passwd
*getpwent();
387 ph
= (struct shome
*) &homes
;
388 while((pw
= getpwent()) != NULL
) {
389 h
= (struct shome
*) malloc(sizeof *h
);
391 h
->h_name
= (char *) malloc((unsigned)strlen(pw
->pw_name
)+1);
392 strcpy(h
->h_name
, pw
->pw_name
);
393 h
->h_uid
= pw
->pw_uid
;
394 h
->h_gid
= pw
->pw_gid
;
395 h
->h_home
= (char *) malloc((unsigned)strlen(pw
->pw_dir
)+1);
396 strcpy(h
->h_home
, pw
->pw_dir
);
407 register struct shome
*h
;
409 for(h
= homes
; h
; h
= h
->h_next
)
410 if(uleq(name
, h
->h_name
))
415 char *bracket
= "\1\1\1\1\n";
417 sendmail(name
, fd
, head_alias
) /* Runs with signals ignored! */
423 register int i
, m
, c
;
424 register char *mail
, *receive
, *lock
= 0;
425 register struct shome
*h
;
429 printf("%s: ", name
); fflush(stdout
);
431 VOID
lseek(fd
, 0l, 0);
434 mail
= concat(mailboxes
, "/", h
->h_name
, NULLCP
);
435 /*** mail = concat(h->h_home, mailbox, NULLCP); ***/
436 receive
= concat(h
->h_home
, RECVPROG
, NULLCP
);
437 if(access(receive
, 1) == 0) { /* User has a receive prog */
439 calluserprog(receive
, mail
, fd
, h
, head_alias
);
443 if((m
= open(mail
, 2)) < 0) {
444 if((m
= creat(mail
, 0600)) < 0) {
445 fprintf(stderr
, "Deliver: Can't write ");
447 donecd
= 1; goto out
;
449 VOID
chown(mail
, h
->h_uid
, h
->h_gid
);
451 printf("Creating %s ", mail
); fflush(stdout
);
454 lock
= concat(lockdir
, "/", h
->h_name
, NULLCP
);
455 for(i
= 0; i
< lockwait
; i
+= 2) {
456 if(link(mail
, lock
) >= 0)
458 if(i
== 0 && stat(mail
, &stbuf
) >= 0 &&
459 stbuf
.st_ctime
+ LOCKWAIT
< time((long *) 0)) {
464 printf("Busy "); fflush(stdout
);
471 printf("Removing lock. "); fflush(stdout
);
473 if(link(mail
, lock
) < 0) {
474 fprintf(stderr
, "Can't lock %s to %s\n",
480 VOID
lseek(m
, 0l, 2);
481 if(write(m
, bracket
, 5) != 5)
484 if((c
= read(fd
, buf
, sizeof buf
)) > 0)
485 if(write(m
, buf
, c
) != c
) {
486 wrerr
: fprintf(stderr
, "Write error on ");
491 while(c
== sizeof buf
);
492 if(write(m
, bracket
, 5) != 5)
501 if(verbose
&& !donecd
)
507 register struct mailname
*mp
;
508 register struct shome
*h
;
509 register struct hosts
*hp
;
512 char namebuf
[15], tmpname
[40], queuename
[40];
516 VOID
sprintf(tmpname
, "%s/%s", TMAILQDIR
, namebuf
);
517 VOID
sprintf(queuename
, "%s/%s", MAILQDIR
, namebuf
);
518 if((md
= fopen(tmpname
, "w")) == NULL
) {
519 fprintf(stderr
, "Deliver: Can't create netmail tmp: ");
523 for(h
= homes
; ; h
= h
->h_next
) {
525 fprintf(stderr
, "Deliver: Who are you?\n");
528 if(h
->h_uid
== myuid
)
532 now
= time((long *)0);
533 fprintf(md
, "%s %s\n", h
->h_name
, cdate(&now
));
535 printf("Netmail..."); fflush(stdout
);
537 for(mp
= netaddrs
.m_next
; mp
; mp
= mp
->m_next
) {
538 if(debug
) printf("%s at %s\n",mp
->m_mbox
, mp
->m_host
);
539 for(hp
= hosts
.nh_next
; hp
; hp
= hp
->nh_next
)
540 if(mp
->m_hnum
== hp
->nh_num
)
543 fprintf(stderr
, "Deliver: hnum->name botch.\n");
546 fprintf(md
, "/%s %s\n", hp
->nh_name
, mp
->m_mbox
);
548 printf("%s at %s: queued\n", mp
->m_mbox
, mp
->m_host
);
551 if(fflush(md
) == EOF
) goto wrerr
;
552 if((fd
= open(tmpfil
, 0)) == -1) {
553 fprintf(stderr
, "Deliver: HuH? Can't reopen ");
558 if((count
= read(fd
, buf
, sizeof buf
)) > 0) {
559 if(write(fileno(md
), buf
, count
) != count
) {
560 wrerr
: fprintf(stderr
, "Deliver: write error on ");
562 VOID
unlink(tmpname
);
565 } else if(count
< 0) {
566 fprintf(stderr
, "deliver: Read error on ");
568 VOID
unlink(tmpname
);
571 } while(count
== sizeof buf
);
572 if(close(fd
) == -1 || fclose(md
) == EOF
) goto wrerr
;
573 if(link(tmpname
, queuename
) == -1 ||
574 unlink(tmpname
) == -1) {
575 fprintf(stderr
, "Deliver: Trouble linking tmpfile into queue ");
578 VOID
chmod (queuename
, 0600);
583 register struct mailname
*mp
;
584 register struct shome
*h
;
591 for(h
= homes
; h
; h
= h
->h_next
)
592 if(h
->h_uid
== myuid
)
595 fprintf(stderr
, "Deliver: Who are you?\n");
599 now
= time((long *)0);
600 for(mp
= uuaddrs
.m_next
; mp
; mp
= mp
->m_next
) {
601 VOID
sprintf(cmd
, index(mp
->m_mbox
, '!') ?
602 "uux - %s!rmail \\(%s\\)" :
604 mp
->m_host
, mp
->m_mbox
);
605 if ((rmf
=popen (cmd
, "w")) == NULL
) {
606 fprintf(stderr
, "Deliver: Could not open uux pipe.\n");
610 if((fd
= open(uutmpfil
, 0)) == -1) {
611 fprintf(stderr
, "Deliver: HuH? Can't reopen ");
615 /* UUCP mail insists on beginning with a "From" line. */
616 /* No other concessions (">" before From) will be provided now */
617 fprintf(rmf
, "From %s %.24s remote from %s\n", h
->h_name
,
620 VOID
fflush(rmf
); /* Lest the "write"s get in ahead */
623 if((count
= read(fd
, buf
, sizeof buf
)) > 0) {
624 if(write(fileno(rmf
), buf
, count
) != count
) {
625 wrerr
: fprintf(stderr
, "Deliver: write error on pipe\n");
628 } else if(count
< 0) {
629 fprintf(stderr
, "deliver: Read error on ");
633 } while(count
== sizeof buf
);
634 if(close(fd
) == -1 ) goto wrerr
;
637 printf("%s At %s (via uux): queued.\n",
638 mp
->m_mbox
, mp
->m_host
);
643 char hex
[] = "0123456789ABCDEF"; /* Hexadecimal */
645 crname(ptr
) /* Create unique file name in /usr/tmp */
651 register char *p
, *q
;
654 p
= (char *)&tvec
[0];
661 VOID
time((time_t *)tvec
);
663 *q
++ = hex
[(*p
>>4)&017];
664 *q
++ = hex
[ *p
++ &017];
673 register struct shome
*h
;
674 register struct mailname
*mp
;
677 for(h
= homes
; h
; h
= h
->h_next
)
678 if(h
->h_uid
== myuid
) {
680 if(!(mp
= getm(h
->h_name
, HOSTNAME
)))
682 cp
= adrformat(mp
,HOSTNAME
);
687 if(mn_from
->m_hnum
!= HOSTNUM
||
688 !uleq(mn_from
->m_mbox
, h
->h_name
))
689 fprintf(out
, "Sender: %s\n", cp
);
691 fprintf(out
, "From: %s\n", cp
);
694 fprintf(stderr
, "Deliver: WHO ARE YOU?\n");
702 register char *t
, *p
;
705 struct tm
*tmp
, *localtime();
706 static char *wday
[] = {
717 now
= time((long *)0);
720 tmp
= localtime(&now
);
721 p
= timezone(tb
.timezone
, tmp
->tm_isdst
);
723 /* day 13 Apr 1981 20 :38 -PST */
724 fprintf(out
, "Date: %sday, %.2s %.3s %.4s %.2s:%.2s-%.3s\n",
725 wday
[tmp
->tm_wday
], t
+8, t
+4, t
+20, t
+11, t
+14, p
);
735 now
= time((long *)0);
736 fprintf(sp
, "Message-ID: <%u.%ld@%s>\n", myuid
, now
, HOSTNAME
);
743 register struct mailname
*mp
;
746 for(mp
= localaddrs
.m_next
; mp
; mp
=mp
->m_next
)
748 mp
->m_mbox
, mp
->m_headali
, mp
->m_next
?", ":"");
751 for(mp
= netaddrs
.m_next
; mp
; mp
=mp
->m_next
)
752 printf("%s@%s (%s)%s",
753 mp
->m_mbox
, mp
->m_host
, mp
->m_headali
, mp
->m_next
?", ":"");
756 for(mp
= uuaddrs
.m_next
; mp
; mp
=mp
->m_next
)
757 printf("%s!%s (%s)%s",
758 mp
->m_host
, mp
->m_mbox
, mp
->m_headali
, mp
->m_next
?", ":"");
764 register struct mailname
*np
, *queue
;
766 register struct mailname
*mp
;
768 /*** printf("insert(%s@%d)=>", np->m_mbox, np->m_hnum); /***/
769 for(mp
= queue
; mp
->m_next
; mp
= mp
->m_next
)
770 if(duplicate(np
, mp
)) { /* Don't insert existing name! */
771 /*** printf("0\n"); /***/
775 /*** printf("1\n"); /***/
780 struct mailname
*np
, *mp
;
782 if (*np
->m_at
== '!')
783 /* If uucp, compare host names */
784 if(uleq(np
->m_host
, mp
->m_next
->m_host
) &&
785 uleq(np
->m_mbox
, mp
->m_next
->m_mbox
))
790 /* Otherwise, compare host numbers */
791 if(np
->m_hnum
== mp
->m_next
->m_hnum
&&
792 uleq(np
->m_mbox
, mp
->m_next
->m_mbox
))
793 /* Special consideration, eg: news.topic1 != news.topic2 */
794 return( uleq(np
->m_headali
, mp
->m_next
->m_headali
) ? 1
795 : alitype
== STAR
? 0 : 1);
805 register struct mailname
*mp
;
807 if(!(mp
= getm(str
, HOSTNAME
)))
809 mp
->m_headali
= getcpy(head_alias
);
810 if(!insert(mp
, mp
->m_hnum
== HOSTNUM
?
812 (*mp
->m_at
== '!')? &uuaddrs
:
819 /* alias implementation below...
825 #define GROUP "/etc/group"
826 char *AliasFile
= "/etc/MailAliases";
828 char *termptr
, *listsave
;
838 while(isspace(*ptr
) || *ptr
== ',' || *ptr
== ':')
840 while(isalnum(*ptr
) || *ptr
== '/' || *ptr
== '-' ||
841 *ptr
== '!' || *ptr
== '@' || *ptr
== ' ' ||
842 *ptr
== '.' || *ptr
== '*')
867 case RESET
: /* Reread the current alias replacement-list */
878 register char *cp
, *pp
;
880 struct mailname ptrsave
;
881 register struct mailname
*lp
;
882 char line
[256], pbuf
[64];
885 if((a
= fopen(AliasFile
, "r")) == NULL
) {
886 fprintf(stderr
, "Can't open alias file ");
890 while(fgets(line
, sizeof line
, a
)) {
891 if(line
[0] == ';' || line
[0] == '\n') /* Comment Line */
894 if((parsep
= getcpy(parse(line
, pbuf
))) == NULL
) {
895 oops
: fprintf(stderr
, "Bad alias file %s\n", AliasFile
);
896 fprintf(stderr
, "Line: %s", line
);
900 for(lp
= &localaddrs
; lp
->m_next
; lp
= lp
->m_next
) {
901 if(alitype
= aleq(lp
->m_next
->m_mbox
, parsep
)) {
904 ptrsave
.m_next
= lp
; /* Maintain ptr */
905 remove(lp
); /* continuity after */
906 lp
= &ptrsave
; /* lp->next is removed. */
908 if(!(cp
= setptr(NEXT
)) ||
909 !(pp
= parse(cp
, pbuf
)))
912 case '<': /* From file */
914 if((pp
= parse(cp
, pbuf
)) == NULL
)
918 case '=': /* UNIX group */
920 if((pp
= parse(cp
, pbuf
)) == NULL
)
924 case '*': /* ALL Users */
927 default: /* Simple list */
930 if(!(cp
= setptr(NEXT
)) ||
931 !(pp
= parse(cp
, pbuf
)))
936 /* May be more news.*<topics> in hdr */
937 if(alitype
== STAR
) continue;
948 /* propogate original alias match */
951 head_alias
= (*mp
->m_headali
? getcpy(mp
->m_headali
) :
959 register char *cp
, *pp
;
960 char line
[128], pbuf
[64];
963 /*** printf("addfile(%s)\n", file); ***/
964 if((f
= fopen(file
, "r")) == NULL
) {
965 fprintf(stderr
, "Can't open ");
969 while(fgets(line
, sizeof line
, f
)) {
971 while(pp
= parse(cp
, pbuf
)) {
982 register char *cp
, *pp
;
984 char line
[128], pbuf
[64], *rindex();
987 /*** printf("addgroup(%s)\n", group); ***/
988 if((f
= fopen(GROUP
, "r")) == NULL
) {
989 fprintf(stderr
, "Can't open ");
993 while(fgets(line
, sizeof line
, f
)) {
994 pp
= parse(line
, pbuf
);
995 if(strcmp(pp
, group
) == 0) {
996 cp
= rindex(line
, ':');
997 while(pp
= parse(cp
, pbuf
)) {
1005 fprintf(stderr
, "Group: %s non-existent\n", group
);
1013 register struct shome
*h
;
1015 /*** printf("addall()\n"); ***/
1016 for(h
= homes
; h
; h
= h
->h_next
)
1017 if(h
->h_uid
>= EVERYONE
)
1021 remove(mp
) /* Remove NEXT from argument node! */
1022 register struct mailname
*mp
;
1024 register struct mailname
*rp
;
1027 mp
->m_next
= rp
->m_next
;
1028 cndfree(rp
->m_mbox
);
1029 cndfree(rp
->m_host
);
1030 cndfree(rp
->m_text
);
1031 cndfree(rp
->m_headali
);
1032 cndfree( (char *)rp
);
1043 char *empty
[] = {0};
1045 calluserprog(prog
, mail
, fd
, h
, head_alias
)
1046 char *prog
, *mail
, *head_alias
;
1048 register struct shome
*h
;
1050 register int pid
, child
, i
;
1054 printf("Invoking %s ", prog
); fflush(stdout
);
1057 while((child
= fork()) == -1)
1059 fprintf(stderr
, "Can't get a fork to invoke %s!\n",
1065 if(child
== 0) { /* In child... */
1068 for(i
= 4; i
< 15; i
++)
1071 putenv("USER", h
->h_name
);
1072 putenv("HOME", h
->h_home
);
1073 VOID
setgid(h
->h_gid
);
1074 VOID
setuid(h
->h_uid
);
1075 execlp(prog
, prog
, tmpfil
, mail
, h
->h_home
, head_alias
, 0);
1079 VOID
signal(SIGALRM
, alarmclock
);
1081 VOID
alarm(120); /* Give receive proc 120 secs */
1083 while((pid
= wait(&status
)) != -1 && pid
!= child
&& !alarmed
) ;
1085 VOID
kill(0, SIGINT
);
1086 VOID
signal(SIGALRM
, alarmclock
);
1089 while((pid
= wait(&status
)) != -1 && pid
!= child
&& !alarmed
) ;
1091 VOID
kill(child
, SIGKILL
);
1092 VOID
signal(SIGALRM
, alarmclock
);
1095 while((pid
= wait(&status
)) != -1 && pid
!= child
&& !alarmed
) ;
1097 fprintf(stderr
, "Deliver: Killed %s--Took more than 120 seconds!\n",
1104 printf("Deliver: %s error %d from %s on delivery to %s\n",
1105 status
&0377? "System" : "User",
1106 status
&0377? status
&0377 : status
>>8,
1111 fprintf(stderr
, "Deliver: wait on receive process returned -1\n");
1117 aleq(string
, aliasent
)
1118 register char *string
, *aliasent
;
1122 while(c
= *string
++)
1123 if(*aliasent
== '*')
1125 else if((c
|040) != (*aliasent
|040))
1129 /*** return(*aliasent == 0 | *aliasent == '*'); ***/
1130 return(*aliasent
== '*' ? STAR
: *aliasent
== 0 ? 1 : 0);
1134 char *file
, *folder
;
1136 int child
, pid
, status
;
1140 printf("Fcc: %s...", folder
); fflush(stdout
);
1142 while((child
= fork()) == -1) sleep(5);
1146 strcat(fold
, folder
);
1148 execl(fileproc
, "file", "-link", "-file", file
, fold
, 0);
1150 } else while((pid
= wait(&status
)) != -1 && pid
!= child
) ;
1152 fprintf(stderr
, "Deliver: Error on fcc to %s\n", folder
);