xref: /386bsd/usr/src/usr.bin/mail/x (revision a2142627)
1# 1 "collect.c"
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36static char sccsid[] = "@(#)collect.c	5.24 (Berkeley) 4/1/91";
37
38
39
40
41
42
43
44
45
46# 1 "rcv.h" 1
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89# 1 "def.h" 1
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125# 1 "/usr/include/sys/param.h" 1 3
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170# 1 "/usr/include/sys/types.h" 1 3
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209typedef	unsigned char	u_char;
210typedef	unsigned short	u_short;
211typedef	unsigned int	u_int;
212typedef	unsigned long	u_long;
213typedef	unsigned short	ushort;
214
215typedef	char *	caddr_t;
216typedef	long	daddr_t;
217typedef	short	dev_t;
218typedef	u_long	ino_t;
219typedef	long	off_t;
220typedef	u_short	nlink_t;
221typedef	long	swblk_t;
222typedef	long	segsz_t;
223typedef	u_short	uid_t;
224typedef	u_short	gid_t;
225typedef	short	pid_t;
226typedef	u_short	mode_t;
227typedef u_long	fixpt_t;
228
229
230typedef	struct	_uquad	{ u_long val[2]; } u_quad;
231typedef	struct	_quad	{   long val[2]; } quad;
232typedef	long *	qaddr_t;
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248# 1 "/usr/include/machine/ansi.h" 1 3
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306# 78 "/usr/include/sys/types.h" 2 3
307
308
309# 1 "/usr/include/machine/types.h" 1 3
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348typedef struct _physadr {
349	int r[1];
350} *physadr;
351
352typedef struct label_t {
353	int val[6];
354} label_t;
355
356typedef	u_long	vm_offset_t;
357typedef	u_long	vm_size_t;
358
359
360
361
362
363
364
365# 80 "/usr/include/sys/types.h" 2 3
366
367
368
369
370typedef	unsigned long			clock_t;
371
372
373
374
375typedef	unsigned int			size_t;
376
377
378
379
380typedef	long				time_t;
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397typedef long	fd_mask;
398
399
400
401
402
403
404typedef	struct fd_set {
405	fd_mask	fds_bits[(((256 )+(( (sizeof(fd_mask) * 8		)	)-1))/( (sizeof(fd_mask) * 8		)	)) ];
406} fd_set;
407
408
409
410
411
412
413# 141 "/usr/include/sys/types.h" 3
414
415
416
417
418# 45 "/usr/include/sys/param.h" 2 3
419
420
421
422
423
424
425
426
427
428
429# 1 "/usr/include/sys/syslimits.h" 1 3
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484# 55 "/usr/include/sys/param.h" 2 3
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508# 1 "/usr/include/sys/signal.h" 1 3
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551# 1 "/usr/include/machine/trap.h" 1 3
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648# 43 "/usr/include/sys/signal.h" 2 3
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697# 1 "/usr/include/sys/cdefs.h" 1 3
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756# 76 "/usr/include/sys/cdefs.h" 3
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776# 91 "/usr/include/sys/signal.h" 2 3
777
778
779
780typedef	void (*sig_t) (int)		;
781
782
783typedef void (*__sighandler_t) (int)		;
784typedef unsigned int sigset_t;
785
786
787int	sigaddset (sigset_t *, int)		;
788int	sigdelset (sigset_t *, int)		;
789int	sigemptyset (sigset_t *)		;
790int	sigfillset (sigset_t *)		;
791int	sigismember (const sigset_t *, int)		;
792
793
794
795
796
797
798
799
800struct	sigaction {
801	__sighandler_t  sa_handler;
802	sigset_t sa_mask;
803	int	sa_flags;
804};
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823struct	sigvec {
824	void	(*sv_handler)();
825	int	sv_mask;
826	int	sv_flags;
827};
828
829
830
831
832
833
834
835struct	sigaltstack {
836	char	*ss_base;
837	int	ss_len;
838	int	ss_onstack;
839};
840
841
842
843
844struct	sigstack {
845	char	*ss_sp;
846	int	ss_onstack;
847};
848
849
850
851
852
853
854
855
856struct	sigcontext {
857	int	sc_onstack;
858	int	sc_mask;
859	int	sc_sp;
860	int	sc_fp;
861	int	sc_ap;
862	int	sc_pc;
863	int	sc_ps;
864};
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883__sighandler_t signal (int, __sighandler_t)		;
884int	raise (int)		;
885
886int	kill (pid_t, int)		;
887int	sigaction (int, const struct sigaction *, struct sigaction *)		;
888int	sigpending (sigset_t *)		;
889int	sigprocmask (int, const sigset_t *, sigset_t *)		;
890int	sigsuspend (const sigset_t *)		;
891
892
893int	killpg (pid_t, int)		;
894void	psignal (unsigned, const char *)		;
895int	sigblock (int)		;
896int	siginterrupt (int, int)		;
897int	sigpause (int)		;
898int	sigreturn (struct sigcontext *)		;
899int	sigsetmask (int)		;
900int	sigstack (const struct sigstack *, struct sigstack *)		;
901int	sigvec (int, struct sigvec *, struct sigvec *)		;
902
903
904
905
906
907# 78 "/usr/include/sys/param.h" 2 3
908
909
910
911# 1 "/usr/include/machine/param.h" 1 3
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063# 81 "/usr/include/sys/param.h" 2 3
1064
1065# 1 "/usr/include/machine/endian.h" 1 3
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111unsigned long	htonl (unsigned long)		;
1112unsigned short	htons (unsigned short)		;
1113unsigned long	ntohl (unsigned long)		;
1114unsigned short	ntohs (unsigned short)		;
1115
1116
1117
1118
1119
1120# 66 "/usr/include/machine/endian.h" 3
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130# 82 "/usr/include/sys/param.h" 2 3
1131
1132# 1 "/usr/include/machine/limits.h" 1 3
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192# 83 "/usr/include/sys/param.h" 2 3
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326# 36 "def.h" 2
1327
1328
1329# 1 "/usr/include/stdio.h" 1 3
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383typedef long fpos_t;
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394struct __sbuf {
1395	unsigned char *_base;
1396	int	_size;
1397};
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423typedef	struct __sFILE {
1424	unsigned char *_p;
1425	int	_r;
1426	int	_w;
1427	short	_flags;
1428	short	_file;
1429	struct	__sbuf _bf;
1430	int	_lbfsize;
1431
1432
1433	void	*_cookie;
1434	int	(*_close) (void *)		;
1435	int	(*_read)  (void *, char *, int)		;
1436	fpos_t	(*_seek)  (void *, fpos_t, int)		;
1437	int	(*_write) (void *, const char *, int)		;
1438
1439
1440	struct	__sbuf _ub;
1441	unsigned char *_up;
1442	int	_ur;
1443
1444
1445	unsigned char _ubuf[3];
1446	unsigned char _nbuf[1];
1447
1448
1449	struct	__sbuf _lb;
1450
1451
1452	int	_blksize;
1453	int	_offset;
1454} FILE;
1455
1456
1457extern FILE __sF[];
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525void	 clearerr (FILE *)		;
1526int	 fclose (FILE *)		;
1527int	 feof (FILE *)		;
1528int	 ferror (FILE *)		;
1529int	 fflush (FILE *)		;
1530int	 fgetc (FILE *)		;
1531int	 fgetpos (FILE *, fpos_t *)		;
1532char	*fgets (char *, size_t, FILE *)		;
1533FILE	*fopen (const char *, const char *)		;
1534int	 fprintf (FILE *, const char *, ...)		;
1535int	 fputc (int, FILE *)		;
1536int	 fputs (const char *, FILE *)		;
1537int	 fread (void *, size_t, size_t, FILE *)		;
1538FILE	*freopen (const char *, const char *, FILE *)		;
1539int	 fscanf (FILE *, const char *, ...)		;
1540int	 fseek (FILE *, long, int)		;
1541int	 fsetpos (FILE *, const fpos_t *)		;
1542long	 ftell (const FILE *)		;
1543int	 fwrite (const void *, size_t, size_t, FILE *)		;
1544int	 getc (FILE *)		;
1545int	 getchar (void)		;
1546char	*gets (char *)		;
1547
1548extern int sys_nerr;
1549extern char *sys_errlist[];
1550
1551void	 perror (const char *)		;
1552int	 printf (const char *, ...)		;
1553int	 putc (int, FILE *)		;
1554int	 putchar (int)		;
1555int	 puts (const char *)		;
1556int	 remove (const char *)		;
1557int	 rename  (const char *, const char *)		;
1558void	 rewind (FILE *)		;
1559int	 scanf (const char *, ...)		;
1560void	 setbuf (FILE *, char *)		;
1561int	 setvbuf (FILE *, char *, int, size_t)		;
1562int	 sprintf (char *, const char *, ...)		;
1563int	 sscanf (char *, const char *, ...)		;
1564FILE	*tmpfile (void)		;
1565char	*tmpnam (char *)		;
1566int	 ungetc (int, FILE *)		;
1567int	 vfprintf (FILE *, const char *, char *			)		;
1568int	 vprintf (const char *, char *			)		;
1569int	 vsprintf (char *, const char *, char *			)		;
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580char	*ctermid (char *)		;
1581FILE	*fdopen (int, const char *)		;
1582int	 fileno (FILE *)		;
1583
1584
1585
1586
1587
1588
1589
1590
1591char	*fgetline (FILE *, size_t *)		;
1592int	 fpurge (FILE *)		;
1593int	 getw (FILE *)		;
1594int	 pclose (FILE *)		;
1595FILE	*popen (const char *, const char *)		;
1596int	 putw (int, FILE *)		;
1597void	 setbuffer (FILE *, char *, int)		;
1598int	 setlinebuf (FILE *)		;
1599char	*tempnam (const char *, const char *)		;
1600int	 snprintf (char *, size_t, const char *, ...)		;
1601int	 vsnprintf (char *, size_t, const char *, char *			)		;
1602int	 vscanf (const char *, char *			)		;
1603int	 vsscanf (const char *, const char *, char *			)		;
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617FILE	*funopen (const void *,
1618		int (*)(void *, char *, int),
1619		int (*)(void *, const char *, int),
1620		fpos_t (*)(void *, fpos_t, int),
1621		int (*)(void *))		;
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631int	__srget (FILE *)		;
1632int	__svfscanf (FILE *, const char *, char *			)		;
1633int	__swbuf (int, FILE *)		;
1634
1635
1636
1637
1638
1639
1640
1641
1642static inline int __sputc(int _c, FILE *_p) {
1643	if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
1644		return (*_p->_p++ = _c);
1645	else
1646		return (__swbuf(_c, _p));
1647}
1648# 331 "/usr/include/stdio.h" 3
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672# 38 "def.h" 2
1673
1674# 1 "/usr/include/sgtty.h" 1 3
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713# 1 "/usr/include/sys/ioctl.h" 1 3
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756struct winsize {
1757	unsigned short	ws_row;
1758	unsigned short	ws_col;
1759	unsigned short	ws_xpixel;
1760	unsigned short	ws_ypixel;
1761};
1762
1763
1764
1765
1766struct ttysize {
1767	unsigned short	ts_lines;
1768	unsigned short	ts_cols;
1769	unsigned short	ts_xxx;
1770	unsigned short	ts_yyy;
1771};
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918int	ioctl (int, unsigned long, ...)		;
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935# 1 "/usr/include/sys/ioctl_compat.h" 1 3
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978# 1 "/usr/include/sys/ttychars.h" 1 3
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022struct ttychars {
2023	char	tc_erase;
2024	char	tc_kill;
2025	char	tc_intrc;
2026	char	tc_quitc;
2027	char	tc_startc;
2028	char	tc_stopc;
2029	char	tc_eofc;
2030	char	tc_brkc;
2031	char	tc_suspc;
2032	char	tc_dsuspc;
2033	char	tc_rprntc;
2034	char	tc_flushc;
2035	char	tc_werasc;
2036	char	tc_lnextc;
2037};
2038
2039# 1 "/usr/include/sys/ttydefaults.h" 1 3
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131# 61 "/usr/include/sys/ttychars.h" 2 3
2132
2133
2134
2135# 43 "/usr/include/sys/ioctl_compat.h" 2 3
2136
2137# 1 "/usr/include/sys/ttydev.h" 1 3
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198# 44 "/usr/include/sys/ioctl_compat.h" 2 3
2199
2200
2201
2202struct tchars {
2203	char	t_intrc;
2204	char	t_quitc;
2205	char	t_startc;
2206	char	t_stopc;
2207	char	t_eofc;
2208	char	t_brkc;
2209};
2210
2211struct ltchars {
2212	char	t_suspc;
2213	char	t_dsuspc;
2214	char	t_rprntc;
2215	char	t_flushc;
2216	char	t_werasc;
2217	char	t_lnextc;
2218};
2219
2220
2221
2222
2223
2224
2225struct sgttyb {
2226	char	sg_ispeed;
2227	char	sg_ospeed;
2228	char	sg_erase;
2229	char	sg_kill;
2230	short	sg_flags;
2231};
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323# 222 "/usr/include/sys/ioctl.h" 2 3
2324
2325
2326
2327# 39 "/usr/include/sgtty.h" 2 3
2328
2329# 39 "def.h" 2
2330
2331# 1 "/usr/include/ctype.h" 1 3
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380extern char	_ctype_[];
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405# 40 "def.h" 2
2406
2407# 1 "/usr/include/string.h" 1 3
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459void	*memchr (const void *, int, size_t)		;
2460int	 memcmp (const void *, const void *, size_t)		;
2461void	*memcpy (void *, const void *, size_t)		;
2462void	*memmove (void *, const void *, size_t)		;
2463void	*memset (void *, int, size_t)		;
2464char	*strcat (char *, const char *)		;
2465char	*strchr (const char *, int)		;
2466int	 strcmp (const char *, const char *)		;
2467int	 strcoll (const char *, const char *)		;
2468char	*strcpy (char *, const char *)		;
2469size_t	 strcspn (const char *, const char *)		;
2470char	*strerror (int)		;
2471size_t	 strlen (const char *)		;
2472char	*strncat (char *, const char *, size_t)		;
2473int	 strncmp (const char *, const char *, size_t)		;
2474char	*strncpy (char *, const char *, size_t)		;
2475char	*strpbrk (const char *, const char *)		;
2476char	*strrchr (const char *, int)		;
2477size_t	 strspn (const char *, const char *)		;
2478char	*strstr (const char *, const char *)		;
2479char	*strtok (char *, const char *)		;
2480size_t	 strxfrm (char *, const char *, size_t)		;
2481
2482
2483
2484int	 bcmp (const void *, const void *, size_t)		;
2485void	 bcopy (const void *, void *, size_t)		;
2486void	 bzero (void *, size_t)		;
2487int	 ffs (int)		;
2488char	*index (const char *, int)		;
2489void	*memccpy (void *, const void *, int, size_t)		;
2490char	*rindex (const char *, int)		;
2491int	 strcasecmp (const char *, const char *)		;
2492char	*strdup (const char *)		;
2493void	 strmode (int, char *)		;
2494int	 strncasecmp (const char *, const char *, size_t)		;
2495char	*strsep (char **, const char *)		;
2496void	 swab (const void *, void *, size_t)		;
2497
2498
2499
2500
2501# 41 "def.h" 2
2502
2503# 1 "pathnames.h" 1
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539# 1 "/usr/include/paths.h" 1 3
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604# 36 "pathnames.h" 2
2605
2606
2607
2608
2609
2610
2611
2612
2613# 42 "def.h" 2
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636struct message {
2637	short	m_flag;
2638	short	m_block;
2639	short	m_offset;
2640	long	m_size;
2641	short	m_lines;
2642};
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673struct cmd {
2674	char	*c_name;
2675	int	(*c_func)();
2676	short	c_argtype;
2677	short	c_msgflag;
2678	short	c_msgmask;
2679};
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716struct headline {
2717	char	*l_from;
2718	char	*l_tty;
2719	char	*l_date;
2720};
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738struct header {
2739	struct name *h_to;
2740	char *h_subject;
2741	struct name *h_cc;
2742	struct name *h_bcc;
2743	struct name *h_smopts;
2744};
2745
2746
2747
2748
2749
2750
2751
2752struct name {
2753	struct	name *n_flink;
2754	struct	name *n_blink;
2755	short	n_type;
2756	char	*n_name;
2757};
2758
2759
2760
2761
2762
2763
2764
2765struct var {
2766	struct	var *v_link;
2767	char	*v_name;
2768	char	*v_value;
2769};
2770
2771struct group {
2772	struct	group *ge_link;
2773	char	*ge_name;
2774};
2775
2776struct grouphead {
2777	struct	grouphead *g_link;
2778	char	*g_name;
2779	struct	group *g_list;
2780};
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791struct ignoretab {
2792	int i_count;
2793	struct ignore {
2794		struct ignore *i_link;
2795		char *i_field;
2796	} *i_head[	59		];
2797};
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847FILE	*Fopen();
2848FILE	*Fdopen();
2849FILE	*Popen();
2850FILE	*collect();
2851FILE	*infix();
2852FILE	*run_editor();
2853FILE	*setinput();
2854char	**unpack();
2855char	*calloc();
2856char	*copy();
2857char	*copyin();
2858char	*detract();
2859char	*expand();
2860char	*getdeadletter();
2861char	*gets();
2862char	*hfield();
2863char	*name1();
2864char	*nameof();
2865char	*nextword();
2866char	*getenv();
2867char	*getname();
2868char	*fgets();
2869char	*ishfield();
2870char	*malloc();
2871char	*mktemp();
2872char	*readtty();
2873char	*reedit();
2874char	*salloc();
2875char	*savestr();
2876char	*skin();
2877char	*snarf();
2878char	*username();
2879char	*value();
2880char	*vcopy();
2881char	*yankword();
2882off_t	fsize();
2883uid_t	getuid();
2884struct	cmd	*lex();
2885struct	grouphead	*findgroup();
2886struct	name	*nalloc();
2887struct	name	*cat();
2888struct	name	*delname();
2889struct	name	*elide();
2890struct	name	*extract();
2891struct	name	*gexpand();
2892struct	name	*outof();
2893struct	name	*put();
2894struct	name	*usermap();
2895struct	var	*lookup();
2896# 43 "rcv.h" 2
2897
2898# 1 "glob.h" 1
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939int	msgCount;
2940int	rcvmode;
2941int	sawcom;
2942char	*Tflag;
2943int	senderr;
2944int	edit;
2945int	readonly;
2946int	noreset;
2947int	sourcing;
2948int	loading;
2949int	cond;
2950FILE	*itf;
2951FILE	*otf;
2952int	image;
2953FILE	*input;
2954char	mailname[1024	 	];
2955char	prevfile[1024	 	];
2956char	*homedir;
2957char	*myname;
2958off_t	mailsize;
2959int	lexnumber;
2960char	lexstring[1024		];
2961int	regretp;
2962int	regretstack[2			];
2963char	*string_stack[2			];
2964int	numberstack[2			];
2965struct	message	*dot;
2966struct	message	*message;
2967struct	var	*variables[	59		];
2968struct	grouphead	*groups[	59		];
2969struct	ignoretab	ignore[2];
2970
2971struct	ignoretab	saveignore[2];
2972
2973struct	ignoretab	ignoreall[2];
2974char	**altnames;
2975int	debug;
2976int	screenwidth;
2977int	screenheight;
2978
2979int	realscreenheight;
2980
2981# 1 "/usr/include/setjmp.h" 1 3
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040typedef int sigjmp_buf[10  + 1];
3041
3042
3043typedef int jmp_buf[10 ];
3044
3045
3046
3047
3048int	setjmp (jmp_buf)		;
3049void	longjmp (jmp_buf, int)		;
3050
3051
3052
3053
3054
3055int	sigsetjmp (sigjmp_buf, int)		;
3056void	siglongjmp (sigjmp_buf, int)		;
3057
3058
3059
3060int	_setjmp (jmp_buf)		;
3061void	_longjmp (jmp_buf, int)		;
3062void	longjmperror (void)		;
3063
3064
3065
3066
3067# 83 "glob.h" 2
3068
3069
3070jmp_buf	srbuf;
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081struct strings {
3082	char	*s_topFree;
3083	char	*s_nextFree;
3084	unsigned s_nleft;
3085} stringdope[25			];
3086# 44 "rcv.h" 2
3087
3088# 45 "collect.c" 2
3089
3090# 1 "/usr/include/sys/stat.h" 1 3
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126struct stat
3127{
3128	dev_t	st_dev;
3129	ino_t	st_ino;
3130	mode_t	st_mode;
3131	nlink_t	st_nlink;
3132	uid_t	st_uid;
3133	gid_t	st_gid;
3134	dev_t	st_rdev;
3135	off_t	st_size;
3136	time_t	st_atime;
3137	long	st_spare1;
3138	time_t	st_mtime;
3139	long	st_spare2;
3140	time_t	st_ctime;
3141	long	st_spare3;
3142	long	st_blksize;
3143	long	st_blocks;
3144	u_long	st_flags;
3145	u_long	st_gen;
3146};
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207mode_t	umask (mode_t)		;
3208int	chmod (const char *, mode_t)		;
3209int	fstat (int, struct stat *)		;
3210int	mkdir (const char *, mode_t)		;
3211int	mkfifo (const char *, mode_t)		;
3212int	stat (const char *, struct stat *)		;
3213
3214int	fchmod (int, mode_t)		;
3215int	lstat (const char *, struct stat *)		;
3216
3217
3218
3219# 46 "collect.c" 2
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233static	sig_t	saveint;
3234static	sig_t	savehup;
3235static	sig_t	savetstp;
3236static	sig_t	savettou;
3237static	sig_t	savettin;
3238static	FILE	*collf;
3239static	int	hadintr;
3240
3241static	jmp_buf	colljmp;
3242static	int	colljmp_p;
3243static	jmp_buf	collabort;
3244
3245FILE *
3246collect(hp, printheaders)
3247	struct header *hp;
3248{
3249	FILE *fbuf;
3250	int lc, cc, escape, eofcount;
3251	register int c, t;
3252	char linebuf[1024				], *cp;
3253	extern char tempMail[];
3254	char getsub;
3255	int omask;
3256	void collint(), collhup(), collstop();
3257
3258	collf = 0 ;
3259
3260
3261
3262
3263	omask = sigblock((1 << ((2	)-1))  | (1 << ((1	)-1)) );
3264	if ((saveint = signal(2	, 	((__sighandler_t) 1) )) != 	((__sighandler_t) 1) )
3265		signal(2	, collint);
3266	if ((savehup = signal(1	, 	((__sighandler_t) 1) )) != 	((__sighandler_t) 1) )
3267		signal(1	, collhup);
3268	savetstp = signal(18	, collstop);
3269	savettou = signal(22	, collstop);
3270	savettin = signal(21	, collstop);
3271	if (setjmp(collabort) || setjmp(colljmp)) {
3272		rm(tempMail);
3273		goto err;
3274	}
3275	sigsetmask(omask & ~((1 << ((2	)-1))  | (1 << ((1	)-1)) ));
3276
3277	noreset++;
3278	if ((collf = Fopen(tempMail, "w+")) == 0 ) {
3279		perror(tempMail);
3280		goto err;
3281	}
3282	unlink(tempMail);
3283
3284
3285
3286
3287
3288
3289	t = 1		|2		|4		|16		;
3290	getsub = 0;
3291	if (hp->h_subject == 	((char *) 0)	 && value("interactive") != 	((char *) 0)	 &&
3292	    (value("ask") != 	((char *) 0)	 || value("asksub") != 	((char *) 0)	))
3293		t &= ~16		, getsub++;
3294	if (printheaders) {
3295		puthead(hp, (&__sF[1]) , t);
3296		fflush((&__sF[1]) );
3297	}
3298	if ((cp = value("escape")) != 	((char *) 0)	)
3299		escape = *cp;
3300	else
3301		escape = 	'~'		;
3302	eofcount = 0;
3303	hadintr = 0;
3304
3305	if (!setjmp(colljmp)) {
3306		if (getsub)
3307			grabh(hp, 2		);
3308	} else {
3309
3310
3311
3312
3313
3314cont:
3315		if (hadintr) {
3316			fflush((&__sF[1]) );
3317			fprintf((&__sF[2]) ,
3318			"\n(Interrupt -- one more to kill letter)\n");
3319		} else {
3320			printf("(continue)\n");
3321			fflush((&__sF[1]) );
3322		}
3323	}
3324	for (;;) {
3325		colljmp_p = 1;
3326		c = readline((&__sF[0]) , linebuf, 1024				);
3327		colljmp_p = 0;
3328		if (c < 0) {
3329			if (value("interactive") != 	((char *) 0)	 &&
3330			    value("ignoreeof") != 	((char *) 0)	 && ++eofcount < 25) {
3331				printf("Use \".\" to terminate letter\n");
3332				continue;
3333			}
3334			break;
3335		}
3336		eofcount = 0;
3337		hadintr = 0;
3338		if (linebuf[0] == '.' && linebuf[1] == '\0' &&
3339		    value("interactive") != 	((char *) 0)	 &&
3340		    (value("dot") != 	((char *) 0)	 || value("ignoreeof") != 	((char *) 0)	))
3341			break;
3342		if (linebuf[0] != escape || value("interactive") == 	((char *) 0)	) {
3343			if (putline(collf, linebuf) < 0)
3344				goto err;
3345			continue;
3346		}
3347		c = linebuf[1];
3348		switch (c) {
3349		default:
3350
3351
3352
3353
3354			if (c == escape) {
3355				if (putline(collf, &linebuf[1]) < 0)
3356					goto err;
3357				else
3358					break;
3359			}
3360			printf("Unknown tilde escape.\n");
3361			break;
3362		case 'C':
3363
3364
3365
3366			core();
3367			break;
3368		case '!':
3369
3370
3371
3372
3373			shell(&linebuf[2]);
3374			break;
3375		case ':':
3376
3377
3378
3379			execute(&linebuf[2], 1);
3380			goto cont;
3381		case '.':
3382
3383
3384
3385			goto out;
3386		case 'q':
3387
3388
3389
3390
3391			hadintr++;
3392			collint(2	);
3393			exit(1);
3394		case 'h':
3395
3396
3397
3398			grabh(hp, 1		|2		|4		|8		);
3399			goto cont;
3400		case 't':
3401
3402
3403
3404			hp->h_to = cat(hp->h_to, extract(&linebuf[2], 1		));
3405			break;
3406		case 's':
3407
3408
3409
3410			cp = &linebuf[2];
3411			while (((_ctype_ + 1)[*cp] & 0x08 ) )
3412				cp++;
3413			hp->h_subject = savestr(cp);
3414			break;
3415		case 'c':
3416
3417
3418
3419			hp->h_cc = cat(hp->h_cc, extract(&linebuf[2], 4		));
3420			break;
3421		case 'b':
3422
3423
3424
3425			hp->h_bcc = cat(hp->h_bcc, extract(&linebuf[2], 8		));
3426			break;
3427		case 'd':
3428			strcpy(linebuf + 2, getdeadletter());
3429
3430		case 'r':
3431
3432
3433
3434
3435
3436			cp = &linebuf[2];
3437			while (((_ctype_ + 1)[*cp] & 0x08 ) )
3438				cp++;
3439			if (*cp == '\0') {
3440				printf("Interpolate what file?\n");
3441				break;
3442			}
3443			cp = expand(cp);
3444			if (cp == 	((char *) 0)	)
3445				break;
3446			if (isdir(cp)) {
3447				printf("%s: Directory\n", cp);
3448				break;
3449			}
3450			if ((fbuf = Fopen(cp, "r")) == 0 ) {
3451				perror(cp);
3452				break;
3453			}
3454			printf("\"%s\" ", cp);
3455			fflush((&__sF[1]) );
3456			lc = 0;
3457			cc = 0;
3458			while (readline(fbuf, linebuf, 1024				) >= 0) {
3459				lc++;
3460				if ((t = putline(collf, linebuf)) < 0) {
3461					Fclose(fbuf);
3462					goto err;
3463				}
3464				cc += t;
3465			}
3466			Fclose(fbuf);
3467			printf("%d/%d\n", lc, cc);
3468			break;
3469		case 'w':
3470
3471
3472
3473			cp = &linebuf[2];
3474			while (*cp == ' ' || *cp == '\t')
3475				cp++;
3476			if (*cp == '\0') {
3477				fprintf((&__sF[2]) , "Write what file!?\n");
3478				break;
3479			}
3480			if ((cp = expand(cp)) == 	((char *) 0)	)
3481				break;
3482			rewind(collf);
3483			exwrite(cp, collf, 1);
3484			break;
3485		case 'm':
3486		case 'M':
3487		case 'f':
3488		case 'F':
3489
3490
3491
3492
3493
3494
3495			if (forward(linebuf + 2, collf, c) < 0)
3496				goto err;
3497			goto cont;
3498		case '?':
3499			if ((fbuf = Fopen("/usr/share/misc/mail.tildehelp" , "r")) == 0 ) {
3500				perror("/usr/share/misc/mail.tildehelp" );
3501				break;
3502			}
3503			while ((t = (--(fbuf)->_r < 0 ? __srget(fbuf) : (int)(*(fbuf)->_p++))  ) != (-1) )
3504				(void) __sputc(t,  (&__sF[1]) )  ;
3505			Fclose(fbuf);
3506			break;
3507		case 'p':
3508
3509
3510
3511
3512			rewind(collf);
3513			printf("-------\nMessage contains:\n");
3514			puthead(hp, (&__sF[1]) , 1		|2		|4		|8		|16		);
3515			while ((t = (--(collf)->_r < 0 ? __srget(collf) : (int)(*(collf)->_p++))  ) != (-1) )
3516				(void) __sputc(t,  (&__sF[1]) )  ;
3517			goto cont;
3518		case '|':
3519
3520
3521
3522
3523			rewind(collf);
3524			mespipe(collf, &linebuf[2]);
3525			goto cont;
3526		case 'v':
3527		case 'e':
3528
3529
3530
3531
3532
3533			rewind(collf);
3534			mesedit(collf, c);
3535			goto cont;
3536		}
3537	}
3538	goto out;
3539err:
3540	if (collf != 0 ) {
3541		Fclose(collf);
3542		collf = 0 ;
3543	}
3544out:
3545	if (collf != 0 )
3546		rewind(collf);
3547	noreset--;
3548	sigblock((1 << ((2	)-1))  | (1 << ((1	)-1)) );
3549	signal(2	, saveint);
3550	signal(1	, savehup);
3551	signal(18	, savetstp);
3552	signal(22	, savettou);
3553	signal(21	, savettin);
3554	sigsetmask(omask);
3555	return collf;
3556}
3557
3558
3559
3560
3561
3562exwrite(name, fp, f)
3563	char name[];
3564	FILE *fp;
3565{
3566	register FILE *of;
3567	register int c;
3568	long cc;
3569	int lc;
3570	struct stat junk;
3571
3572	if (f) {
3573		printf("\"%s\" ", name);
3574		fflush((&__sF[1]) );
3575	}
3576	if (stat(name, &junk) >= 0 && (junk.st_mode &  0170000		) ==  0100000		) {
3577		if (!f)
3578			fprintf((&__sF[2]) , "%s: ", name);
3579		fprintf((&__sF[2]) , "File exists\n");
3580		return(-1);
3581	}
3582	if ((of = Fopen(name, "w")) == 0 ) {
3583		perror(	((char *) 0)	);
3584		return(-1);
3585	}
3586	lc = 0;
3587	cc = 0;
3588	while ((c = (--(fp)->_r < 0 ? __srget(fp) : (int)(*(fp)->_p++))  ) != (-1) ) {
3589		cc++;
3590		if (c == '\n')
3591			lc++;
3592		(void) __sputc(c,  of) ;
3593		if ((((of)->_flags & 0x0040		) != 0)  ) {
3594			perror(name);
3595			Fclose(of);
3596			return(-1);
3597		}
3598	}
3599	Fclose(of);
3600	printf("%d/%ld\n", lc, cc);
3601	fflush((&__sF[1]) );
3602	return(0);
3603}
3604
3605
3606
3607
3608
3609mesedit(fp, c)
3610	FILE *fp;
3611{
3612	sig_t sigint = signal(2	, 	((__sighandler_t) 1) );
3613	FILE *nf = run_editor(fp, (off_t)-1, c, 0);
3614
3615	if (nf != 0 ) {
3616		fseek(nf, (off_t)0, 2);
3617		collf = nf;
3618		Fclose(fp);
3619	}
3620	(void) signal(2	, sigint);
3621}
3622
3623
3624
3625
3626
3627
3628
3629mespipe(fp, cmd)
3630	FILE *fp;
3631	char cmd[];
3632{
3633	FILE *nf;
3634	sig_t sigint = signal(2	, 	((__sighandler_t) 1) );
3635	extern char tempEdit[];
3636
3637	if ((nf = Fopen(tempEdit, "w+")) == 0 ) {
3638		perror(tempEdit);
3639		goto out;
3640	}
3641	(void) unlink(tempEdit);
3642
3643
3644
3645
3646	if (run_command(cmd, 0, ((fp)->_file)  , ((nf)->_file)  , 	((char *) 0)	) < 0) {
3647		(void) Fclose(nf);
3648		goto out;
3649	}
3650	if (fsize(nf) == 0) {
3651		fprintf((&__sF[2]) , "No bytes from \"%s\" !?\n", cmd);
3652		(void) Fclose(nf);
3653		goto out;
3654	}
3655
3656
3657
3658	(void) fseek(nf, 0L, 2);
3659	collf = nf;
3660	(void) Fclose(fp);
3661out:
3662	(void) signal(2	, sigint);
3663}
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673forward(ms, fp, f)
3674	char ms[];
3675	FILE *fp;
3676{
3677	register int *msgvec;
3678	extern char tempMail[];
3679	struct ignoretab *ig;
3680	char *tabst;
3681
3682	msgvec = (int *) salloc((msgCount+1) * sizeof *msgvec);
3683	if (msgvec == (int *) 	((char *) 0)	)
3684		return(0);
3685	if (getmsglist(ms, msgvec, 0) < 0)
3686		return(0);
3687	if (*msgvec == 0) {
3688		*msgvec = first(0, 	((1<<1)		|	(1<<2)		) );
3689		if (*msgvec == 0 ) {
3690			printf("No appropriate messages\n");
3691			return(0);
3692		}
3693		msgvec[1] = 0 ;
3694	}
3695	if (f == 'f' || f == 'F')
3696		tabst = 	((char *) 0)	;
3697	else if ((tabst = value("indentprefix")) == 	((char *) 0)	)
3698		tabst = "\t";
3699	ig = ((_ctype_ + 1)[f] & 0x01 )  ? 0  : ignore;
3700	printf("Interpolating:");
3701	for (; *msgvec != 0; msgvec++) {
3702		struct message *mp = message + *msgvec - 1;
3703
3704		touch(mp);
3705		printf(" %d", *msgvec);
3706		if (send(mp, fp, ig, tabst) < 0) {
3707			perror(tempMail);
3708			return(-1);
3709		}
3710	}
3711	printf("\n");
3712	return(0);
3713}
3714
3715
3716
3717
3718
3719void
3720collstop(s)
3721{
3722	sig_t old_action = signal(s, 	((__sighandler_t) 0) );
3723
3724	sigsetmask(sigblock(0) & ~(1 << ((s)-1)) );
3725	kill(0, s);
3726	sigblock((1 << ((s)-1)) );
3727	signal(s, old_action);
3728	if (colljmp_p) {
3729		colljmp_p = 0;
3730		hadintr = 0;
3731		longjmp(colljmp, 1);
3732	}
3733}
3734
3735
3736
3737
3738
3739
3740void
3741collint(s)
3742{
3743
3744
3745
3746	if (!hadintr) {
3747		if (value("ignore") != 	((char *) 0)	) {
3748			puts("@");
3749			fflush((&__sF[1]) );
3750			((void)(((&__sF[0]) )->_flags &= ~(0x0040		|0x0020		)))  ;
3751			return;
3752		}
3753		hadintr = 1;
3754		longjmp(colljmp, 1);
3755	}
3756	rewind(collf);
3757	if (value("nosave") == 	((char *) 0)	)
3758		savedeadletter(collf);
3759	longjmp(collabort, 1);
3760}
3761
3762
3763void
3764collhup(s)
3765{
3766	rewind(collf);
3767	savedeadletter(collf);
3768
3769
3770
3771
3772	exit(1);
3773}
3774
3775savedeadletter(fp)
3776	register FILE *fp;
3777{
3778	register FILE *dbuf;
3779	register int c;
3780	char *cp;
3781
3782	if (fsize(fp) == 0)
3783		return;
3784	cp = getdeadletter();
3785	c = umask(077);
3786	dbuf = Fopen(cp, "a");
3787	(void) umask(c);
3788	if (dbuf == 0 )
3789		return;
3790	while ((c = (--(fp)->_r < 0 ? __srget(fp) : (int)(*(fp)->_p++))  ) != (-1) )
3791		(void) __sputc(c,  dbuf) ;
3792	Fclose(dbuf);
3793	rewind(fp);
3794}
3795