]> diplodocus.org Git - nmh/blob - docs/historical/2.9BSD/cmds/deliver.c
Added test of encoded Resent-To: and Resent-cc:.
[nmh] / docs / historical / 2.9BSD / cmds / deliver.c
1 #ifndef lint
2 static char sccsid[] = "@(#)deliver.c 4.3 3/5/83";
3 #endif
4
5 #include "mh.h"
6 #include <stdio.h>
7 #include <ctype.h>
8 #include <pwd.h>
9 #include <sys/types.h>
10 #include <sys/timeb.h>
11 #include <sys/stat.h>
12 #include <signal.h>
13 #include <strings.h>
14
15 /*#define DELIVERMAIL "/etc/delivermail"*/
16 #define EVERYONE 10
17 #define RECVPROG "/.mh_receive"
18 #define FCCS 10 /* Max number of fcc's allowed */
19
20 struct shome { /* Internal name/uid/home database */
21 struct shome *h_next;
22 char *h_name;
23 int h_uid;
24 int h_gid;
25 char *h_home;
26 } *homes, *home();
27
28 struct swit switches[] = {
29 "debug", -1, /* 0 */
30 "format", 0, /* 1 */
31 "noformat", 0, /* 2 */
32 "msgid", 0, /* 3 */
33 "nomsgid", 0, /* 4 */
34 "verbose", 0, /* 5 */
35 "noverbose", 0, /* 6 */
36 "help", 4, /* 7 */
37 0, 0
38 };
39
40 int verbose, format, msgid, debug, myuid, addrp;
41 int lockwait; /* Secs to wait for mail lock (From strings/lockdir.c) */
42 #define LOCKWAIT (lockwait * 5) /* Ignore lock if older than this */
43 int donecd;
44 long now;
45 char tmpfil[32], fccfold[FCCS][128];
46 char tmp2fil[32];
47 int fccind;
48 char *rindex();
49
50 struct mailname {
51 struct mailname *m_next;
52 char *m_name;
53 } addrlist;
54
55 main(argc, argv)
56 int argc;
57 char *argv[];
58 {
59 register char *cp, *addrs, **argp;
60 register struct mailname *lp;
61 char buf[BUFSIZ], name[NAMESZ];
62 char *msg;
63 int state, compnum, fd;
64 FILE *in, *out;
65 char *getname();
66
67 msg = 0;
68 argp = argv + 1;
69 while(cp = *argp++) {
70 if(*cp == '-')
71 switch(smatch(++cp, switches)) {
72 case -2:ambigsw(cp, switches); /* ambiguous */
73 done(1);
74 /* unknown */
75 case -1:fprintf(stderr, "sndmsg: -%s unknown switch.\n", cp);
76 done(1);
77 case 0: verbose++; debug++; continue; /* -debug */
78 case 1: fprintf(stderr, "Deliver: -format not yet.\n");
79 done(1);
80 /*** case 1: format = 1; continue; /* -format */
81 case 2: format = 0; continue; /* -noformat */
82 case 3: msgid = 1; continue; /* -msgid */
83 case 4: msgid = 0; continue; /* -nomsgid */
84 case 5: verbose = 1; continue; /* -verbose */
85 case 6: verbose = 0; continue; /* -noverbose */
86 case 7: help("deliver [switches] file",
87 switches);
88 done(1);
89 }
90 if(msg) {
91 fprintf(stderr, "Deliver: Only one message at a time!\n");
92 done(1);
93 } else
94 msg = cp;
95 }
96 if(!msg) {
97 fprintf(stderr, "Deliver: No Message specified.\n");
98 fprintf(stderr, "Deliver: Usage: deliver [switches] file\n");
99 done(1);
100 }
101 if((in = fopen(msg, "r")) == NULL) {
102 fprintf(stderr, "Deliver: Can't open ");
103 perror(msg);
104 done(1);
105 }
106 copy(makename("locs", ".tmp"), copy("/tmp/", tmpfil));
107 if(!debug) {
108 if((out = fopen(tmpfil, "w")) == NULL) {
109 fprintf(stderr, "Can't create %s\n", tmpfil);
110 done(1);
111 }
112 chmod(tmpfil, 0744);
113 } else
114 out = stdout;
115
116 gethomes();
117 myuid = getuid();
118 #ifndef UNIXCOMP
119 putdate(0, out); /* Tack on the date */
120 putfrom(out); /* Tack on the from */
121 #endif
122 putmsgid(out); /* and msg id if desired */
123 for(addrs = 0, compnum = 1, state = FLD;;) {
124 state = m_getfld(state, name, buf, sizeof buf, in);
125 swt: switch(state) {
126
127 case FLD:
128 case FLDEOF:
129 case FLDPLUS:
130 compnum++;
131 if(uleq(name, "to") || uleq(name, "cc") ||
132 uleq(name, "bcc"))
133 addrs = add(buf, addrs);
134 if(!uleq(name, "bcc")) {
135 cp = buf;
136 while(*cp == ' ' || *cp == '\t')
137 cp++;
138 fprintf(out, "%s: %s", name, cp);
139 if(uleq(name, "fcc")) {
140 if(fccind >= FCCS) {
141 fprintf(stderr, "Deliver: too many fcc's.\n");
142 done(1);
143 }
144 copy(cp, fccfold[fccind]);
145 if(cp = rindex(fccfold[fccind], '\n'))
146 *cp = 0;
147 fccind++;
148 }
149 }
150 while(state == FLDPLUS || state == FLDEOF) {
151 state = m_getfld(state, name, buf, sizeof buf, in);
152 addrs = add(buf, addrs);
153 fputs(buf, out);
154 }
155 if(state == FLDEOF)
156 goto process;
157 break;
158
159 case BODY:
160 case BODYEOF:
161 fprintf(out, "\n%s", buf);
162 while(state == BODY) {
163 state=m_getfld(state,name,buf,sizeof buf,in);
164 fputs(buf, out);
165 }
166
167 case FILEEOF:
168 goto process;
169
170 case LENERR:
171 case FMTERR:
172 fprintf(stderr, "??Message Format Error ");
173 fprintf(stderr, "in Component #%d.\n", compnum);
174 done(1);
175
176 default:
177 fprintf(stderr, "Getfld returned %d\n", state);
178 done(1);
179 }
180 }
181 process:
182 if(!debug)
183 fclose(out);
184 else
185 printf("-----\n");
186 fclose(in);
187 while(cp = getname(addrs)) /* Put addrs in chain */
188 insert(cp);
189 if(debug) {
190 printf("Before alias(): "); pl();
191 }
192
193 alias(); /* Map names if needed */
194
195 for(lp = addrlist.m_next; lp; lp = lp->m_next) {
196 #ifdef UNIXCOMP
197 if (netname(lp->m_name))
198 continue;
199 #endif
200 #ifndef DELIVERMAIL
201 if(home(lp->m_name) == NULL) {
202 fprintf(stderr, "Deliver: Unknown User: %s.\n", lp->m_name);
203 fprintf(stderr, "Deliver: Message Not Delivered.\n");
204 if(!debug)
205 unlink(tmpfil);
206 done(1);
207 }
208 #endif DELIVERMAIL
209 }
210 if(debug) {
211 printf("Addrs: "); pl();
212 }
213
214 signal(SIGINT, SIG_IGN);
215 signal(SIGQUIT, SIG_IGN);
216 if(!debug) { /* Send the mail */
217 fd = open(tmpfil, 0);
218 for(lp = addrlist.m_next; lp; lp = lp->m_next)
219 sendmail(lp->m_name, fd);
220 #ifdef DELIVERMAIL
221 stflush(fd);
222 #endif
223 close(fd);
224 if(fccind) {
225 #ifdef UNIXCOMP
226 strcpy(tmp2fil, "/tmp/mhFXXXXXX");
227 mktemp(tmp2fil);
228 out = fopen(tmp2fil, "w");
229 putdate(0, out); /* Tack on the date */
230 putfrom(out); /* Tack on the from */
231 appendfile(tmpfil, out);
232 fclose(out);
233 for(state = 0; state < fccind; state++)
234 fcc(tmp2fil, fccfold[state]);
235 unlink(tmp2fil);
236 #else
237 for(state = 0; state < fccind; state++)
238 fcc(tmp2fil, fccfold[state]);
239 #endif
240 }
241 unlink(tmpfil);
242 }
243 done(donecd);
244 }
245
246 #ifdef UNIXCOMP
247
248 appendfile(name, fout)
249 char name[];
250 register FILE *fout;
251 {
252 register int c;
253 register FILE *fin;
254
255 if ((fin = fopen(name, "r")) == NULL) {
256 perror(name);
257 return;
258 }
259 while ((c = getc(fin)) != EOF)
260 putc(c, fout);
261 fclose(fin);
262 }
263
264 netname(name)
265 char name[];
266 {
267 register char *cp;
268 char *index();
269
270 cp = name;
271 if (index(cp, ':') || index(cp, '!') ||
272 index(cp, '@') || index(cp, '^'))
273 return(1);
274 return(0);
275 }
276 #endif
277
278
279 gethomes()
280 {
281 register struct passwd *pw;
282 register struct shome *h, *ph;
283 struct passwd *getpwent();
284
285 ph = (struct shome *) &homes;
286 while((pw = getpwent()) != NULL) {
287 h = (struct shome *) malloc(sizeof *h);
288 h->h_next = NULL;
289 h->h_name = (char *) malloc(strlen(pw->pw_name)+1);
290 strcpy(h->h_name, pw->pw_name);
291 h->h_uid = pw->pw_uid;
292 h->h_gid = pw->pw_gid;
293 h->h_home = (char *) malloc(strlen(pw->pw_dir)+1);
294 strcpy(h->h_home, pw->pw_dir);
295 ph->h_next = h;
296 ph = h;
297 }
298 }
299
300
301 struct shome *
302 home(name)
303 register char *name;
304 {
305 register struct shome *h;
306
307 for(h = homes; h; h = h->h_next)
308 if(uleq(name, h->h_name))
309 return(h);
310 return(NULL);
311 }
312
313
314 char *
315 getname(addrs)
316 char *addrs;
317 {
318 register char *tp;
319 static char name[32];
320 static char *getaddrs;
321
322 if(!getaddrs)
323 getaddrs = addrs;
324 tp = name;
325
326 while(*getaddrs && !isalpha(*getaddrs))
327 getaddrs++;
328 if(!*getaddrs) {
329 getaddrs = 0;
330 return NULL;
331 }
332 #ifdef UNIXCOMP
333 while(!isspace(*getaddrs))
334 *tp++ = *getaddrs++;
335 #else
336 while(isalnum(*getaddrs) || index(".:@/-", *getaddrs))
337 *tp++ = *getaddrs++;
338 #endif
339 *tp = 0;
340 if(name[0] == 0)
341 return NULL;
342 return name;
343 }
344
345 char *bracket = "\1\1\1\1\n";
346
347 sendmail(name, fd) /* Runs with signals ignored! */
348 char *name;
349 register int fd;
350 {
351 char buf[BUFSIZ], *myname;
352 register int i, m, c;
353 register char *mail, *receive, *lock = 0;
354 register struct shome *h;
355 int pid, status;
356 struct stat stbuf;
357
358 if(verbose) {
359 printf("%s: ", name);
360 fflush(stdout);
361 }
362 lseek(fd, 0l, 0);
363 h = home(name);
364
365 /*
366 * If no home for this user, as in network address
367 * being forced down this path, just assume normal
368 * delivery
369 */
370
371 if (h == NULL)
372 goto force;
373
374 mail = concat(mailboxes, h->h_name, 0);
375 /*** mail = concat(h->h_home, mailbox, 0); ***/
376 receive = concat(h->h_home, RECVPROG, 0);
377 if(access(receive, 1) == 0) { /* User has a receive prog */
378
379 calluserprog(receive, mail, fd, h);
380
381 } else {
382
383 force:
384
385 #ifdef UNIXCOMP
386 #ifdef DELIVERMAIL
387 nstash(name);
388 if (verbose)
389 printf("Sent.\n");
390 return;
391 #endif DELIVERMAIL
392 #ifndef DELIVERMAIL
393 myname = getenv("USER");
394 if (myname == (char *) 0)
395 myname = "nobody";
396 pid = fork();
397 switch (pid) {
398 case 0:
399 /* fiddle with files, then . . . */
400 lseek(fd, 0L, 0);
401 close(0);
402 dup(fd);
403 close(fd);
404 execl(Mailprog, "Mail", "-r", myname, name, 0);
405 execl("/bin/mail", "mail", "-r", myname, name, 0);
406 perror(Mailprog);
407 _exit(1);
408
409 case -1:
410 perror("fork");
411 return;
412
413 default:
414 while (wait(&status) != pid)
415 ;
416 }
417 #endif DELIVERMAIL
418 #endif UNIXCOMP
419 #ifndef UNIXCOMP
420 if((m = open(mail, 2)) < 0) {
421 if((m = creat(mail, 0600)) < 0) {
422 fprintf(stderr, "Deliver: Can't write ");
423 perror(mail);
424 goto out;
425 }
426 chown(mail, h->h_uid, h->h_gid);
427 if(verbose) {
428 fprintf(stderr, "Creating %s ", mail);
429 fflush(stdout);
430 }
431 }
432 lock = concat(lockdir, h->h_name, 0);
433 for(i = 0; i < lockwait; i += 2) {
434 if(link(mail, lock) >= 0)
435 break;
436 if(i == 0 && stat(mail, &stbuf) >= 0 &&
437 stbuf.st_ctime + LOCKWAIT < time((long *) 0)) {
438 i = lockwait;
439 break;
440 }
441 if(verbose) {
442 printf("Busy ");
443 fflush(stdout);
444 }
445 sleep(2);
446 }
447 if(i >= lockwait) {
448 unlink(lock);
449 if(verbose) {
450 printf("Removing lock. ");
451 fflush(stdout);
452 }
453 if(link(mail, lock) < 0) {
454 fprintf(stderr, "Can't lock %s to %s\n",
455 mail, lock);
456 donecd = 1;
457 goto out1;
458 }
459 }
460 lseek(m, 0l, 2);
461 write(m, bracket, 5);
462 do
463 if((c = read(fd, buf, sizeof buf)) > 0)
464 if(write(m, buf, c) != c) {
465 fprintf(stderr, "Write error on ");
466 perror(mail);
467 donecd = 1;
468 goto out1;
469 }
470 while(c == sizeof buf);
471 write(m, bracket, 5);
472 out1: close(m);
473 out: cndfree(mail);
474 if(lock) {
475 unlink(lock);
476 cndfree(lock);
477 }
478 #endif UNIXCOMP
479 }
480 if(verbose && !donecd)
481 printf("Sent.\n");
482 }
483
484 #ifdef DELIVERMAIL
485
486 /*
487 * Salt away a name to send to, ultimately.
488 */
489
490 char *stashname[100];
491 char **stashp;
492
493 nstash(name)
494 char name[];
495 {
496 register char *cp;
497
498 cp = (char *) calloc(1, strlen(name) + 1);
499 strcpy(cp, name);
500 if (stashp == 0) {
501 stashp = stashname;
502 *stashp++ = "delivermail";
503 *stashp++ = "-i";
504 }
505 *stashp++ = cp;
506 }
507
508 stflush(fd)
509 {
510 int pid;
511
512 if (stashp == 0)
513 return;
514 while ((pid = fork()) == -1)
515 sleep(2);
516 if (pid == 0) {
517 signal(SIGHUP, SIG_IGN);
518 signal(SIGINT, SIG_IGN);
519 signal(SIGQUIT, SIG_IGN);
520 close(0);
521 dup(fd);
522 close(fd);
523 execv(DELIVERMAIL, stashname);
524 perror(DELIVERMAIL);
525 _exit(1);
526 }
527 }
528 #endif
529
530 putfrom(out)
531 register FILE *out;
532 {
533 register struct shome *h;
534
535 for(h = homes; h; h = h->h_next)
536 if(h->h_uid == myuid) {
537 fprintf(out, "From: %s\n", h->h_name);
538 return;
539 }
540 fprintf(stderr, "Deliver: WHO ARE YOU?\n");
541 done(1);
542 }
543
544
545 putmsgid(sp)
546 FILE *sp;
547 {
548
549 if(!msgid)
550 return;
551 if(!now)
552 time(&now);
553 fprintf(sp, "Message-ID: <%u.%u.%ld.%s@%s>\n", getpid(), myuid,
554 now, localname, hostname);
555 }
556
557 /***/
558 pl()
559 {
560 register struct mailname *mp;
561
562 for(mp = addrlist.m_next; mp; mp=mp->m_next)
563 printf("%s%s", mp->m_name, mp->m_next?", ":"");
564 printf("\n");
565 }
566 /***/
567
568 insert(name)
569 char *name;
570 {
571 register struct mailname *mp;
572 char *getcpy();
573
574 /*** printf("insert(%s)\n", name); ***/
575
576 for(mp = &addrlist; mp->m_next; mp = mp->m_next)
577 if(uleq(name, mp->m_next->m_name))
578 return; /* Don't insert existing name! */
579 mp->m_next = (struct mailname *) malloc(sizeof *mp->m_next);
580 mp = mp->m_next;
581 mp->m_next = 0;
582 mp->m_name = getcpy(name);
583 }
584
585
586 /* alias implementation below...
587 */
588
589
590
591 #define GROUP "/etc/group"
592 char *AliasFile = "/usr/local/lib/MailAliases";
593
594 char *termptr;
595
596 char *
597 parse(ptr, buf)
598 register char *ptr;
599 char *buf;
600 {
601 register char *cp;
602
603 cp = buf;
604 while(isspace(*ptr) || *ptr == ',' || *ptr == ':')
605 ptr++;
606 while(isalnum(*ptr) || *ptr == '/' || *ptr == '-' ||
607 *ptr == '.' || *ptr == '*')
608 *cp++ = *ptr++;
609 if(cp == buf) {
610 switch(*ptr) {
611 case '<':
612 case '=':
613 *cp++ = *ptr++;
614 }
615 }
616 *cp = 0;
617 if(cp == buf)
618 return 0;
619 termptr = ptr;
620 return buf;
621 }
622
623 char *
624 advance(ptr)
625 register char *ptr;
626 {
627 return(termptr);
628 }
629
630 alias()
631 {
632 register char *cp, *pp;
633 register struct mailname *lp;
634 char line[256], pbuf[64];
635 FILE *a;
636
637 if((a = fopen(AliasFile, "r")) == NULL)
638 return;
639 while(fgets(line, sizeof line, a)) {
640 if(line[0] == ';' || line[0] == '\n') /* Comment Line */
641 continue;
642 if((pp = parse(line, pbuf)) == NULL) {
643 oops: fprintf(stderr, "Bad alias file %s\n", AliasFile);
644 fprintf(stderr, "Line: %s", line);
645 done(1);
646 }
647 for(lp = &addrlist; lp->m_next; lp = lp->m_next) {
648 if(aleq(lp->m_next->m_name, pp)) {
649 remove(lp);
650 if(!(cp = advance(line)) ||
651 !(pp = parse(cp, pbuf)))
652 goto oops;
653 switch(*pp) {
654 case '<': /* From file */
655 cp = advance(cp);
656 if((pp = parse(cp, pbuf)) == NULL)
657 goto oops;
658 addfile(pp);
659 break;
660 case '=': /* UNIX group */
661 cp = advance(cp);
662 if((pp = parse(cp, pbuf)) == NULL)
663 goto oops;
664 addgroup(pp);
665 break;
666 case '*': /* ALL Users */
667 addall();
668 break;
669 default: /* Simple list */
670 for(;;) {
671 insert(pp);
672 if(!(cp = advance(line)) ||
673 !(pp = parse(cp, pbuf)))
674 break;
675 }
676 }
677 break;
678 }
679 }
680 }
681 }
682
683
684 addfile(file)
685 char *file;
686 {
687 register char *cp, *pp;
688 char line[128], pbuf[64];
689 FILE *f;
690
691 /*** printf("addfile(%s)\n", file); ***/
692 if((f = fopen(file, "r")) == NULL) {
693 fprintf(stderr, "Can't open ");
694 perror(file);
695 done(1);
696 }
697 while(fgets(line, sizeof line, f)) {
698 cp = line;
699 while(pp = parse(cp, pbuf)) {
700 insert(pp);
701 cp = advance(cp);
702 }
703 }
704 fclose(f);
705 }
706
707 addgroup(group)
708 char *group;
709 {
710 register char *cp, *pp;
711 int found = 0;
712 char line[128], pbuf[64], *rindex();
713 FILE *f;
714
715 /*** printf("addgroup(%s)\n", group); ***/
716 if((f = fopen(GROUP, "r")) == NULL) {
717 fprintf(stderr, "Can't open ");
718 perror(GROUP);
719 done(1);
720 }
721 while(fgets(line, sizeof line, f)) {
722 pp = parse(line, pbuf);
723 if(strcmp(pp, group) == 0) {
724 cp = rindex(line, ':');
725 while(pp = parse(cp, pbuf)) {
726 insert(pp);
727 cp = advance(cp);
728 }
729 found++;
730 }
731 }
732 if(!found) {
733 fprintf(stderr, "Group: %s non-existent\n", group);
734 done(1);
735 }
736 fclose(f);
737 }
738
739 addall()
740 {
741 register struct shome *h;
742
743 /*** printf("addall()\n"); ***/
744 for(h = homes; h; h = h->h_next)
745 if(h->h_uid >= EVERYONE)
746 insert(h->h_name);
747 }
748
749 remove(mp) /* Remove NEXT from argument node! */
750 register struct mailname *mp;
751 {
752 register struct mailname *rp;
753
754 rp = mp->m_next;
755 mp->m_next = rp->m_next;
756 cndfree(rp->m_name);
757 cndfree(rp);
758 }
759
760 int alarmed;
761
762 alarmclock()
763 {
764 alarmed++;
765 }
766
767 extern char **environ;
768 char envhome[60] = "HOME=";
769 char envname[60] = "NAME=";
770 char *envinit[] = {envhome, envname, (char *) 0};
771
772 calluserprog(prog, mail, fd, h)
773 char *prog, *mail;
774 int fd;
775 register struct shome *h;
776 {
777 register int pid, child, i;
778 int status;
779
780 if(verbose) {
781 printf("Invoking %s ", prog);
782 fflush(stdout);
783 }
784 i = 0;
785 while((child = fork()) == -1)
786 if(++i > 10) {
787 fprintf(stderr, "Can't get a fork to invoke %s!\n",
788 prog);
789 donecd = 1;
790 return;
791 } else
792 sleep(2);
793 if(child == 0) { /* In child... */
794 if(fd != 3)
795 dup2(fd, 3);
796 for(i = 4; i < 15; i++)
797 close(i);
798 strcat(envname, h->h_name);
799 strcat(envhome, h->h_home);
800 environ = envinit;
801 setgid(h->h_gid);
802 setuid(h->h_uid);
803 execlp(prog, prog, tmpfil, mail, h->h_home, 0);
804 perror(prog);
805 done(-1);
806 }
807 signal(SIGALRM, alarmclock);
808 alarmed = 0;
809 alarm(30); /* Give receive proc 30 secs */
810 status = 0;
811 while((pid = wait(&status)) != -1 && pid != child && !alarmed) ;
812 if(alarmed) {
813 kill(0, SIGINT);
814 signal(SIGALRM, alarmclock);
815 alarmed = 0;
816 alarm(30);
817 while((pid = wait(&status)) != -1 && pid != child && !alarmed) ;
818 if(alarmed) {
819 kill(child, SIGKILL);
820 signal(SIGALRM, alarmclock);
821 alarmed = 0;
822 alarm(30);
823 while((pid = wait(&status)) != -1 && pid != child && !alarmed) ;
824 }
825 fprintf(stderr, "Deliver: Killed %s--Took more than 30 seconds!\n",
826 prog);
827 donecd = 1;
828 status = 0;
829 } else
830 alarm(0);
831 if(status) {
832 printf("Deliver: %s error %d from %s on delivery to %s\n",
833 status&0377? "System" : "User",
834 status&0377? status&0377 : status>>8,
835 prog, h->h_name);
836 donecd = 1;
837 }
838 if(pid == -1) {
839 fprintf(stderr, "Deliver: wait on receive process returned -1\n");
840 perror("");
841 donecd = 1;
842 }
843 }
844
845 aleq(string, aliasent)
846 register char *string, *aliasent;
847 {
848 register int c;
849
850 while(c = *string++)
851 if(*aliasent == '*')
852 return 1;
853 else if((c|040) != (*aliasent|040))
854 return(0);
855 else
856 aliasent++;
857 return(*aliasent == 0 | *aliasent == '*');
858 }
859
860 fcc(file, folder)
861 char *file, *folder;
862 {
863 int child, pid, status;
864 char fold[128];
865
866 if(verbose) {
867 printf("Fcc: %s...", folder);
868 fflush(stdout);
869 }
870 while((child = fork()) == -1) sleep(5);
871 if(child == 0) {
872 if(*file != '+')
873 strcpy(fold, "+");
874 strcat(fold, folder);
875 setuid(myuid);
876 execl(fileproc, "file", "-link", "-file", file, fold, 0);
877 exit(-1);
878 } else while((pid = wait(&status)) != -1 && pid != child) ;
879 if(status)
880 fprintf(stderr, "Deliver: Error on fcc to %s\n", folder);
881 else if(verbose)
882 putchar('\n');
883 }