]> diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/uip/RCS/spost.c,v
sbr/mts.c: Delete mmdlm2; use same-valued mmdlm1 instead.
[nmh] / docs / historical / mh-6.8.5 / uip / RCS / spost.c,v
1 head 1.8;
2 access;
3 symbols;
4 locks; strict;
5 comment @ * @;
6
7
8 1.8
9 date 92.12.15.00.20.22; author jromine; state Exp;
10 branches;
11 next 1.7;
12
13 1.7
14 date 92.11.04.01.04.35; author jromine; state Exp;
15 branches;
16 next 1.6;
17
18 1.6
19 date 92.01.31.22.28.25; author jromine; state Exp;
20 branches;
21 next 1.5;
22
23 1.5
24 date 90.04.05.15.02.47; author sources; state Exp;
25 branches;
26 next 1.4;
27
28 1.4
29 date 90.03.27.19.15.37; author sources; state Exp;
30 branches;
31 next 1.3;
32
33 1.3
34 date 90.02.09.10.59.36; author sources; state Exp;
35 branches;
36 next 1.2;
37
38 1.2
39 date 90.02.06.13.33.24; author sources; state Exp;
40 branches;
41 next 1.1;
42
43 1.1
44 date 90.02.06.13.32.41; author sources; state Exp;
45 branches;
46 next ;
47
48
49 desc
50 @@
51
52
53 1.8
54 log
55 @endif sugar
56 @
57 text
58 @#ifndef lint
59 static char sccsid[] = "@@(#)spost.c 1.6 (Berkeley) 11/2/85";
60 #endif
61 #ifndef lint
62 static char ident[] = "@@(#)$Id: spost.c,v 1.7 1992/11/04 01:04:35 jromine Exp jromine $";
63 #endif /* lint */
64
65 /* spost.c - feed messages to sendmail */
66 /*
67 * (This is a simpler, faster, replacement for "post" for use when "sendmail"
68 * is the transport system)
69 */
70
71 #include <ctype.h>
72 #include <stdio.h>
73 #include <signal.h>
74 #include "../h/mh.h"
75 #include "../h/addrsbr.h"
76 #include "../h/aliasbr.h"
77 #include "../h/dropsbr.h"
78 #include "../zotnet/tws.h"
79 #ifdef LOCALE
80 #include <locale.h>
81 #endif
82
83 extern char *getfullname (), *getusr ();
84 extern char *sendmail;
85
86
87 #define uptolow(c) ((isalpha(c) && isupper (c)) ? tolower (c) : c)
88
89 #define MAX_SM_FIELD 1476 /* < largest hdr field sendmail will accept */
90 #define FCCS 10 /* max number of fccs allowed */
91
92 /* \f */
93
94 struct swit switches[] = {
95 #define FILTSW 0
96 "filter filterfile", 0,
97 #define NFILTSW 1
98 "nofilter", 0,
99
100 #define FRMTSW 2
101 "format", 0,
102 #define NFRMTSW 3
103 "noformat", 0,
104
105 #define REMVSW 4
106 "remove", 0,
107 #define NREMVSW 5
108 "noremove", 0,
109
110 #define VERBSW 6
111 "verbose", 0,
112 #define NVERBSW 7
113 "noverbose", 0,
114
115 #define WATCSW 8
116 "watch", 0,
117 #define NWATCSW 9
118 "nowatch", 0,
119
120 #define HELPSW 10
121 "help", 4,
122
123 #define DEBUGSW 11
124 "debug", -5,
125
126 #define DISTSW 12
127 "dist", -4, /* interface from dist */
128
129 #define BACKSW 13
130 "backup", 0,
131 #define NBACKSW 14
132 "nobackup", 0,
133
134 #define CHKSW 15
135 "check", -5, /* interface from whom */
136 #define NCHKSW 16
137 "nocheck", -7, /* interface from whom */
138 #define WHOMSW 17
139 "whom", -4, /* interface from whom */
140
141 #define PUSHSW 18 /* fork to sendmail then exit */
142 "push", -4,
143 #define NPUSHSW 19 /* exec sendmail */
144 "nopush", -6,
145
146 #define ALIASW 20
147 "alias aliasfile", 0,
148 #define NALIASW 21
149 "noalias", 0,
150
151 #define WIDTHSW 22
152 "width columns", 0,
153
154 #define LIBSW 23
155 "library directory", -7,
156
157 #define ANNOSW 24
158 "idanno number", -6,
159
160 NULL, 0
161 };
162
163 /* \f */
164
165 struct headers {
166 char *value;
167
168 unsigned int flags;
169 #define HNOP 0x0000 /* just used to keep .set around */
170 #define HBAD 0x0001 /* bad header - don't let it through */
171 #define HADR 0x0002 /* header has an address field */
172 #define HSUB 0x0004 /* Subject: header */
173 #define HTRY 0x0008 /* try to send to addrs on header */
174 #define HBCC 0x0010 /* don't output this header */
175 #define HMNG 0x0020 /* mung this header */
176 #define HNGR 0x0040 /* no groups allowed in this header */
177 #define HFCC 0x0080 /* FCC: type header */
178 #define HNIL 0x0100 /* okay for this header not to have addrs */
179 #define HIGN 0x0200 /* ignore this header */
180
181 unsigned int set;
182 #define MFRM 0x0001 /* we've seen a From: */
183 #define MDAT 0x0002 /* we've seen a Date: */
184 #define MRFM 0x0004 /* we've seen a Resent-From: */
185 #define MVIS 0x0008 /* we've seen sighted addrs */
186 #define MINV 0x0010 /* we've seen blind addrs */
187 #define MRDT 0x0020 /* we've seen a Resent-Date: */
188 };
189
190 /* \f */
191
192 static struct headers NHeaders[] = {
193 "Return-Path", HBAD, 0,
194 "Received", HBAD, 0,
195 "Reply-To", HADR | HNGR, 0,
196 "From", HADR | HNGR, MFRM,
197 "Sender", HADR | HBAD, 0,
198 "Date", HNOP, MDAT,
199 "Subject", HSUB, 0,
200 "To", HADR | HTRY, MVIS,
201 "cc", HADR | HTRY, MVIS,
202 "Bcc", HADR | HTRY | HBCC | HNIL, MINV,
203 "Message-Id", HBAD, 0,
204 "Fcc", HFCC, 0,
205
206 NULL
207 };
208
209 static struct headers RHeaders[] = {
210 "Resent-Reply-To", HADR | HNGR, 0,
211 "Resent-From", HADR | HNGR, MRFM,
212 "Resent-Sender", HADR | HBAD, 0,
213 "Resent-Date", HNOP, MRDT,
214 "Resent-Subject", HSUB, 0,
215 "Resent-To", HADR | HTRY, MVIS,
216 "Resent-cc", HADR | HTRY, MVIS,
217 "Resent-Bcc", HADR | HTRY | HBCC, MINV,
218 "Resent-Message-Id", HBAD, 0,
219 "Resent-Fcc", HFCC, 0,
220 "Reply-To", HADR, 0,
221 "Fcc", HIGN, 0,
222
223 NULL
224 };
225
226 /* \f */
227
228
229 static short fccind = 0; /* index into fccfold[] */
230
231 static int badmsg = 0; /* message has bad semantics */
232 static int verbose = 0; /* spell it out */
233 static int debug = 0; /* debugging post */
234 static int rmflg = 1; /* remove temporary file when done */
235 static int watch = 0; /* watch the delivery process */
236 static int backflg = 0; /* rename input file as *.bak when done */
237 static int whomflg = 0; /* if just checking addresses */
238 static int pushflg = 0; /* if going to fork to sendmail */
239 static int aliasflg = -1; /* if going to process aliases */
240 static int outputlinelen=72;
241
242 static unsigned msgflags = 0; /* what we've seen */
243
244 static enum {
245 normal, resent
246 } msgstate = normal;
247
248 static char tmpfil[] = "/tmp/pstXXXXXX";
249
250 static char from[BUFSIZ]; /* my network address */
251 static char signature[BUFSIZ]; /* my signature */
252 static char *filter = NULL; /* the filter for BCC'ing */
253 static char *subject = NULL; /* the subject field for BCC'ing */
254 static char *fccfold[FCCS]; /* foldernames for FCC'ing */
255
256 static struct headers *hdrtab; /* table for the message we're doing */
257 static FILE *out; /* output (temp) file */
258
259 static putfmt(), start_headers(), finish_headers(), putadr(),
260 insert_fcc();
261 static file(), fcc();
262 static int get_header(), putone();
263 /* \f MAIN */
264
265 /* ARGSUSED */
266
267 main (argc, argv)
268 int argc;
269 char *argv[];
270 {
271 int state,
272 i,
273 pid,
274 compnum;
275 char *cp,
276 *msg = NULL,
277 **argp = argv + 1,
278 *sargv[16],
279 buf[BUFSIZ],
280 name[NAMESZ],
281 *arguments[MAXARGS];
282 FILE * in;
283
284 #ifdef LOCALE
285 setlocale(LC_ALL, "");
286 #endif
287 invo_name = r1bindex (argv[0], '/');
288 mts_init (invo_name);
289 if ((cp = m_find (invo_name)) != NULL) {
290 argp = copyip (brkstring (cp, " ", "\n"), arguments);
291 (void) copyip (argv+1, argp);
292 argp = arguments;
293 }
294
295 /* \f */
296
297 while (cp = *argp++) {
298 if (*cp == '-')
299 switch (smatch (++cp, switches)) {
300 case AMBIGSW:
301 ambigsw (cp, switches);
302 done (1);
303 case UNKWNSW:
304 adios (NULLCP, "-%s unknown", cp);
305 case HELPSW:
306 (void)sprintf (buf, "%s [switches] file", invo_name);
307 help (buf, switches);
308 done (1);
309
310 case DEBUGSW:
311 debug++;
312 continue;
313
314 case DISTSW:
315 msgstate = resent;
316 continue;
317
318 case WHOMSW:
319 whomflg++;
320 continue;
321
322 case FILTSW:
323 if (!(filter = *argp++) || *filter == '-')
324 adios (NULLCP, "missing argument to %s", argp[-2]);
325 continue;
326 case NFILTSW:
327 filter = NULL;
328 continue;
329
330 case REMVSW:
331 rmflg++;
332 continue;
333 case NREMVSW:
334 rmflg = 0;
335 continue;
336
337 case BACKSW:
338 backflg++;
339 continue;
340 case NBACKSW:
341 backflg = 0;
342 continue;
343
344 case VERBSW:
345 verbose++;
346 continue;
347 case NVERBSW:
348 verbose = 0;
349 continue;
350
351 case WATCSW:
352 watch++;
353 continue;
354 case NWATCSW:
355 watch = 0;
356 continue;
357
358 case PUSHSW:
359 pushflg++;
360 continue;
361 case NPUSHSW:
362 pushflg = 0;
363 continue;
364
365 case ALIASW:
366 if (!(cp = *argp++) || *cp == '-')
367 adios (NULLCP, "missing argument to %s", argp[-2]);
368 if (aliasflg < 0)
369 (void) alias (AliasFile);/* load default aka's */
370 aliasflg = 1;
371 if ((state = alias(cp)) != AK_OK)
372 adios (NULLCP, "aliasing error in file %s - %s",
373 cp, akerror(state) );
374 continue;
375 case NALIASW:
376 aliasflg = 0;
377 continue;
378
379 case WIDTHSW:
380 if (!(cp = *argp++) || *cp == '-')
381 adios (NULLCP, "missing argument to %s", argp[-2]);
382 outputlinelen = atoi (cp);
383 if (outputlinelen <= 10)
384 outputlinelen = 72;
385 continue;
386
387 case LIBSW:
388 case ANNOSW:
389 /* -library & -idanno switch ignored */
390 if (!(cp = *argp++) || *cp == '-')
391 adios (NULLCP, "missing argument to %s", argp[-2]);
392 continue;
393 }
394 if (msg)
395 adios (NULLCP, "only one message at a time!");
396 else
397 msg = cp;
398 }
399
400 /* \f */
401
402 if (aliasflg < 0)
403 (void) alias (AliasFile); /* load default aka's */
404
405 if (!msg)
406 adios (NULLCP, "usage: %s [switches] file", invo_name);
407
408 if ((in = fopen (msg, "r")) == NULL)
409 adios (msg, "unable to open");
410
411 start_headers ();
412 if (debug) {
413 verbose++;
414 out = stdout;
415 }
416 else {
417 (void)mktemp (tmpfil);
418 if ((out = fopen (tmpfil, "w")) == NULL)
419 adios (tmpfil, "unable to create");
420 (void)chmod (tmpfil, 0600);
421 }
422
423 hdrtab = (msgstate == normal) ? NHeaders : RHeaders;
424
425 for (compnum = 1, state = FLD;;) {
426 switch (state = m_getfld (state, name, buf, sizeof buf, in)) {
427 case FLD:
428 compnum++;
429 putfmt (name, buf, out);
430 continue;
431
432 case FLDPLUS:
433 compnum++;
434 cp = add (buf, cp);
435 while (state == FLDPLUS) {
436 state = m_getfld (state, name, buf, sizeof buf, in);
437 cp = add (buf, cp);
438 }
439 putfmt (name, cp, out);
440 free (cp);
441 continue;
442
443 case BODY:
444 finish_headers (out);
445 fprintf (out, "\n%s", buf);
446 if(whomflg == 0)
447 while (state == BODY) {
448 state = m_getfld (state, name, buf, sizeof buf, in);
449 fputs (buf, out);
450 }
451 break;
452
453 case FILEEOF:
454 finish_headers (out);
455 break;
456
457 case LENERR:
458 case FMTERR:
459 adios (NULLCP, "message format error in component #%d",
460 compnum);
461
462 default:
463 adios (NULLCP, "getfld() returned %d", state);
464 }
465 break;
466 }
467
468 /* \f */
469
470 (void)fclose (in);
471 if (backflg && !whomflg) {
472 (void) strcpy (buf, m_backup (msg));
473 if (rename (msg, buf) == NOTOK)
474 advise (buf, "unable to rename %s to", msg);
475 }
476
477 if (debug) {
478 done (0);
479 }
480 else
481 (void)fclose (out);
482
483 file (tmpfil);
484
485 /*
486 * re-open the temp file, unlink it and exec sendmail, giving it
487 * the msg temp file as std in.
488 */
489 if ( freopen( tmpfil, "r", stdin) == NULL)
490 adios (tmpfil, "can't reopen for sendmail");
491 if (rmflg)
492 (void)unlink (tmpfil);
493
494 argp = sargv;
495 *argp++ = "send-mail";
496 *argp++ = "-m"; /* send to me too */
497 *argp++ = "-t"; /* read msg for recipients */
498 *argp++ = "-i"; /* don't stop on "." */
499 if (whomflg)
500 *argp++ = "-bv";
501 if (watch || verbose)
502 *argp++ = "-v";
503 *argp = NULL;
504
505 if (pushflg && !(watch || verbose)) {
506 /* fork to a child to run sendmail */
507 for (i=0; (pid = vfork()) == NOTOK && i < 5; i++)
508 sleep(5);
509 switch (pid) {
510 case NOTOK:
511 fprintf (verbose ? stdout : stderr, "%s: can't fork to %s\n",
512 invo_name, sendmail);
513 exit(-1);
514 case OK:
515 /* we're the child .. */
516 break;
517 default:
518 exit(0);
519 }
520 }
521 execv ( sendmail, sargv);
522 adios ( sendmail, "can't exec");
523 }
524
525 /* \f DRAFT GENERATION */
526
527 static putfmt (name, str, out)
528 char *name,
529 *str;
530 FILE * out;
531 {
532 int count,
533 grp,
534 i,
535 keep;
536 char *cp,
537 *pp,
538 *qp,
539 namep[BUFSIZ];
540 struct mailname *mp,
541 *np;
542 struct headers *hdr;
543
544 while (*str == ' ' || *str == '\t')
545 str++;
546
547 if ((i = get_header (name, hdrtab)) == NOTOK) {
548 fprintf (out, "%s: %s", name, str);
549 return;
550 }
551
552 hdr = &hdrtab[i];
553 if (hdr -> flags & HIGN)
554 return;
555 if (hdr -> flags & HBAD) {
556 advise (NULLCP, "illegal header line -- %s:", name);
557 badmsg++;
558 return;
559 }
560 msgflags |= hdr -> set;
561
562 if (hdr -> flags & HSUB)
563 subject = subject ? add (str, add ("\t", subject)) : getcpy (str);
564
565 if (hdr -> flags & HFCC) {
566 if (cp = rindex (str, '\n'))
567 *cp = 0;
568 for (cp = pp = str; cp = index (pp, ','); pp = cp) {
569 *cp++ = 0;
570 insert_fcc (hdr, pp);
571 }
572 insert_fcc (hdr, pp);
573 return;
574 }
575
576 #ifdef notdef
577 if (hdr -> flags & HBCC) {
578 insert_bcc(str);
579 return;
580 }
581 #endif /* notdef */
582
583 if (*str != '\n' && *str != '\0')
584 if (aliasflg && hdr->flags & HTRY) {
585 /* this header contains address(es) that we have to do
586 * alias expansion on. Because of the saved state in
587 * getname we have to put all the addresses into a list.
588 * We then let putadr munch on that list, possibly
589 * expanding aliases.
590 */
591 register struct mailname *f = 0;
592 register struct mailname *mp = 0;
593
594 while (cp = getname( str ) ) {
595 mp = getm( cp, NULLCP, 0, AD_HOST, NULLCP);
596 if (f == 0) {
597 f = mp;
598 mp->m_next = mp;
599 } else {
600 mp->m_next = f->m_next;
601 f->m_next = mp;
602 f = mp;
603 }
604 }
605 f = mp->m_next; mp->m_next = 0;
606 putadr( name, f );
607 } else {
608 fprintf (out, "%s: %s", name, str );
609 }
610 }
611
612 /* \f */
613
614 static
615 start_headers ()
616 {
617 char *cp;
618 char sigbuf[BUFSIZ];
619
620 (void)strcpy( from, getusr() );
621
622 if ((cp = getfullname ()) && *cp) {
623 (void)strcpy (sigbuf, cp);
624 (void)sprintf (signature, "%s <%s>", sigbuf, from);
625 }
626 else
627 (void)sprintf (signature, "%s", from);
628 }
629
630 /* \f */
631
632 static
633 finish_headers (out)
634 FILE * out;
635 {
636 switch (msgstate) {
637 case normal:
638 if (!(msgflags & MDAT))
639 fprintf (out, "Date: %s\n", dtimenow ());
640 if (msgflags & MFRM)
641 fprintf (out, "Sender: %s\n", from);
642 else
643 fprintf (out, "From: %s\n", signature);
644 #ifdef notdef
645 if (!(msgflags & MVIS))
646 fprintf (out, "Bcc: Blind Distribution List: ;\n");
647 #endif /* notdef */
648 break;
649
650 case resent:
651 if (!(msgflags & MRDT))
652 fprintf (out, "Resent-Date: %s\n", dtimenow());
653 if (msgflags & MRFM)
654 fprintf (out, "Resent-Sender: %s\n", from);
655 else
656 fprintf (out, "Resent-From: %s\n", signature);
657 #ifdef notdef
658 if (!(msgflags & MVIS))
659 fprintf (out, "Resent-Bcc: Blind Re-Distribution List: ;\n");
660 #endif /* notdef */
661 break;
662 }
663
664 if (badmsg)
665 adios (NULLCP, "re-format message and try again");
666 }
667
668 /* \f */
669
670 static int
671 get_header (header, table)
672 char *header;
673 struct headers *table;
674 {
675 struct headers *h;
676
677 for (h = table; h -> value; h++)
678 if (uleq (header, h -> value))
679 return (h - table);
680
681 return NOTOK;
682 }
683
684 /* \f */
685
686 /* output the address list for header "name". The address list
687 * is a linked list of mailname structs. "nl" points to the head
688 * of the list. Alias substitution should be done on nl.
689 */
690 static putadr (name, nl)
691 char *name;
692 struct mailname *nl;
693 {
694 register struct mailname *mp, *mp2;
695 register int linepos;
696 register char *cp;
697 int namelen;
698
699 fprintf (out, "%s: ", name);
700 namelen = strlen(name) + 2;
701 linepos = namelen;
702
703 for (mp = nl; mp; ) {
704 if (linepos > MAX_SM_FIELD) {
705 fprintf (out, "\n%s: ", name);
706 linepos = namelen;
707 }
708 if (mp->m_nohost) {
709 /* a local name - see if it's an alias */
710 cp = akvalue(mp->m_mbox);
711 if (cp == mp->m_mbox)
712 /* wasn't an alias - use what the user typed */
713 linepos = putone( mp->m_text, linepos, namelen );
714 else
715 /* an alias - expand it */
716 while (cp = getname(cp) ) {
717 if (linepos > MAX_SM_FIELD) {
718 fprintf (out, "\n%s: ", name);
719 linepos = namelen;
720 }
721 mp2 = getm( cp, NULLCP, 0, AD_HOST, NULLCP);
722 if (akvisible()) {
723 mp2->m_pers = getcpy(mp->m_mbox);
724 linepos = putone( adrformat(mp2), linepos, namelen );
725 } else {
726 linepos = putone( mp2->m_text, linepos, namelen );
727 }
728 mnfree( mp2 );
729 }
730 } else {
731 /* not a local name - use what the user typed */
732 linepos = putone( mp->m_text, linepos, namelen );
733 }
734 mp2 = mp;
735 mp = mp->m_next;
736 mnfree( mp2 );
737 }
738 putc( '\n', out );
739 }
740
741 static int putone ( adr, pos, indent )
742 register char *adr;
743 register int pos;
744 int indent;
745 {
746 register int len;
747 static int linepos;
748
749 len = strlen( adr );
750 if (pos == indent)
751 linepos = pos;
752 else if ( linepos+len > outputlinelen ) {
753 fprintf ( out, ",\n%*s", indent, "");
754 linepos = indent;
755 pos += indent + 2;
756 }
757 else {
758 fputs( ", ", out );
759 linepos += 2;
760 pos += 2;
761 }
762 fputs( adr, out );
763
764 linepos += len;
765 return (pos+len);
766 }
767
768 /* \f */
769
770 static insert_fcc (hdr, pp)
771 struct headers *hdr;
772 char *pp;
773 {
774 char *cp;
775
776 for (cp = pp; isspace (*cp); cp++)
777 continue;
778 for (pp += strlen (pp) - 1; pp > cp && isspace (*pp); pp--)
779 continue;
780 if (pp >= cp)
781 *++pp = 0;
782 if (*cp == 0)
783 return;
784
785 if (fccind >= FCCS)
786 adios (NULLCP, "too many %ss", hdr -> value);
787 fccfold[fccind++] = getcpy (cp);
788 }
789
790 #ifdef notdef
791 /* \f BCC GENERATION */
792
793 static make_bcc_file () {
794 int fd,
795 i,
796 child_id,
797 status;
798 char *vec[6];
799 FILE * in, *out;
800
801 (void)mktemp (bccfil);
802 if ((out = fopen (bccfil, "w")) == NULL)
803 adios (bccfil, "unable to create");
804 (void)chmod (bccfil, 0600);
805
806 fprintf (out, "Date: %s\n", dtimenow ());
807 fprintf (out, "From: %s\n", signature);
808 if (subject)
809 fprintf (out, "Subject: %s", subject);
810 fprintf (out, "BCC:\n\n------- Blind-Carbon-Copy\n\n");
811 (void)fflush (out);
812
813 if (filter == NULL) {
814 if ((fd = open (tmpfil, 0)) == NOTOK)
815 adios (NULLCP, "unable to re-open");
816 cpydgst (fd, fileno (out), tmpfil, bccfil);
817 close (fd);
818 }
819 else {
820 vec[0] = r1bindex (mhlproc, '/');
821
822 for (i = 0; (child_id = vfork ()) == NOTOK && i < 5; i++)
823 sleep (5);
824 switch (child_id) {
825 case NOTOK:
826 adios ("vfork", "unable to");
827
828 case OK:
829 dup2 (fileno (out), 1);
830
831 i = 1;
832 vec[i++] = "-forward";
833 vec[i++] = "-form";
834 vec[i++] = filter;
835 vec[i++] = tmpfil;
836 vec[i] = NULL;
837
838 execvp (mhlproc, vec);
839 adios (mhlproc, "unable to exec");
840
841 default:
842 if (status = pidwait (child_id, OK))
843 admonish (NULL, "%s lost (status=0%o)", vec[0], status);
844 break;
845 }
846 }
847
848 fseek (out, 0L, 2);
849 fprintf (out, "\n------- End of Blind-Carbon-Copy\n");
850 (void)fclose (out);
851 }
852 #endif /* notdef */
853
854 /* \f FCC INTERACTION */
855
856 static file (path)
857 char *path;
858 {
859 int i;
860
861 if (fccind == 0)
862 return;
863
864 for (i = 0; i < fccind; i++)
865 if (whomflg)
866 printf ("Fcc: %s\n", fccfold[i]);
867 else
868 fcc (path, fccfold[i]);
869 }
870
871
872 static fcc (file, folder)
873 char *file,
874 *folder;
875 {
876 int i,
877 child_id,
878 status;
879 char fold[BUFSIZ];
880
881 if (verbose)
882 printf ("%sFcc: %s\n", msgstate == resent ? "Resent-" : "", folder);
883 (void)fflush (stdout);
884
885 for (i = 0; (child_id = vfork ()) == NOTOK && i < 5; i++)
886 sleep (5);
887 switch (child_id) {
888 case NOTOK:
889 if (!verbose)
890 fprintf (stderr, " %sFcc %s: ",
891 msgstate == resent ? "Resent-" : "", folder);
892 fprintf (verbose ? stdout : stderr, "no forks, so not ok\n");
893 break;
894
895 case OK:
896 (void)sprintf (fold, "%s%s",
897 *folder == '+' || *folder == '@@' ? "" : "+", folder);
898 execlp (fileproc, r1bindex (fileproc, '/'),
899 "-link", "-file", file, fold, NULL);
900 _exit (-1);
901
902 default:
903 if (status = pidwait (child_id, OK)) {
904 if (!verbose)
905 fprintf (stderr, " %sFcc %s: ",
906 msgstate == resent ? "Resent-" : "", folder);
907 fprintf (verbose ? stdout : stderr,
908 " errored (0%o)\n", status);
909 }
910 }
911
912 (void)fflush (stdout);
913 }
914
915 /* \f TERMINATION */
916
917 /* VARARGS2 */
918
919 static die (what, fmt, a, b, c, d)
920 char *what,
921 *fmt,
922 *a,
923 *b,
924 *c,
925 *d;
926 {
927 adios (what, fmt, a, b, c, d);
928 }
929 @
930
931
932 1.7
933 log
934 @LOCALE
935 isupper with isalpha
936 @
937 text
938 @d5 2
939 a6 2
940 static char ident[] = "@@(#)$Id: spost.c,v 1.6 1992/01/31 22:28:25 jromine Exp jromine $";
941 #endif lint
942 d524 1
943 a524 1
944 #endif notdef
945 d590 1
946 a590 1
947 #endif notdef
948 d603 1
949 a603 1
950 #endif notdef
951 d795 1
952 a795 1
953 #endif notdef
954 @
955
956
957 1.6
958 log
959 @kerberos
960 @
961 text
962 @d5 1
963 a5 1
964 static char ident[] = "@@(#)$Id: spost.c,v 1.5 1990/04/05 15:02:47 sources Exp jromine $";
965 d22 3
966 d30 1
967 a30 1
968 #define uptolow(c) (isupper (c) ? tolower (c) : c)
969 d227 3
970 @
971
972
973 1.5
974 log
975 @add ID
976 @
977 text
978 @d5 1
979 a5 1
980 static char ident[] = "@@(#)$Id:$";
981 d100 1
982 a100 1
983 NULL, NULL
984 d133 3
985 a135 3
986 "Return-Path", HBAD, NULL,
987 "Received", HBAD, NULL,
988 "Reply-To", HADR | HNGR, NULL,
989 d137 1
990 a137 1
991 "Sender", HADR | HBAD, NULL,
992 d139 1
993 a139 1
994 "Subject", HSUB, NULL,
995 d143 2
996 a144 2
997 "Message-Id", HBAD, NULL,
998 "Fcc", HFCC, NULL,
999 d150 1
1000 a150 1
1001 "Resent-Reply-To", HADR | HNGR, NULL,
1002 d152 1
1003 a152 1
1004 "Resent-Sender", HADR | HBAD, NULL,
1005 d154 1
1006 a154 1
1007 "Resent-Subject", HSUB, NULL,
1008 d158 4
1009 a161 4
1010 "Resent-Message-Id", HBAD, NULL,
1011 "Resent-Fcc", HFCC, NULL,
1012 "Reply-To", HADR, NULL,
1013 "Fcc", HIGN, NULL,
1014 d504 1
1015 a504 1
1016 *cp = NULL;
1017 d506 1
1018 a506 1
1019 *cp++ = NULL;
1020 d718 2
1021 a719 2
1022 *++pp = NULL;
1023 if (*cp == NULL)
1024 @
1025
1026
1027 1.4
1028 log
1029 @let sendmail be defined from mtstailor
1030 @
1031 text
1032 @d4 3
1033 @
1034
1035
1036 1.3
1037 log
1038 @Fixes from Van Jacobson
1039 @
1040 text
1041 @d21 1
1042 a25 1
1043 #define SENDMAIL "/usr/lib/sendmail"
1044 d446 1
1045 a446 1
1046 invo_name, SENDMAIL);
1047 d455 2
1048 a456 2
1049 execv ( SENDMAIL, sargv);
1050 adios ( SENDMAIL, "can't exec");
1051 @
1052
1053
1054 1.2
1055 log
1056 @ANSI Compilance
1057 @
1058 text
1059 @d26 1
1060 d638 4
1061 d651 4
1062 d681 1
1063 d684 3
1064 a686 1
1065 if ( pos+len > outputlinelen ) {
1066 d688 4
1067 a691 2
1068 pos = indent;
1069 } else if ( pos > indent ) {
1070 d693 1
1071 d698 1
1072 @
1073
1074
1075 1.1
1076 log
1077 @Initial revision
1078 @
1079 text
1080 @d195 4
1081 @