aboutsummaryrefslogtreecommitdiff
path: root/devel/cvs-devel/files/patch-freebsdlocal
blob: 1e58286592ebb009a10862612d137b56667a4595 (plain) (blame)
1
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
36
37
38
39
40
41
42
43
44
45
46
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
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
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
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
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
307
308
309
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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
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
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
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
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
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
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
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
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
1064
1065
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
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
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
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
1327
1328
1329
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
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
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
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
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
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
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
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
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
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
Index: FREEBSD-upgrade
diff -u /dev/null src/contrib/cvs/FREEBSD-upgrade:1.10
--- /dev/null	Wed Sep 11 20:31:44 2002
+++ FREEBSD-upgrade	Mon Sep  2 00:58:30 2002
@@ -0,0 +1,58 @@
+FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/FREEBSD-upgrade,v 1.10 2002/09/02 05:58:30 peter Exp $
+
+MAINTAINER=	peter@FreeBSD.org
+
+This directory contains the virgin CVS source on the vendor branch.  Do
+not under any circumstances commit new versions onto the mainline, new
+versions or official-patch versions must be imported.
+
+To prepare a new cvs dist for import, extract it into a fresh directory;
+
+The following generated files were deleted:
+doc/*.ps
+doc/*.info*
+doc/texinfo.tex
+lib/getdate.c
+cvsnt.*
+cvs.spec*
+build.com
+*/*.com
+*/*.dsp
+*/.cvsignore
+.cvsignore
+README.VMS
+
+The following non-freebsd-specific directories were deleted:
+os2
+emx
+windows-NT
+vms
+zlib
+
+It is imported from it's top level directory something like this:
+  cvs -n import src/contrib/cvs CVSHOME v<version>
+
+The -n option is "dont do anything" so you can see what is about to happen
+first.  Remove it when it looks ok.
+
+The initial import was done with:
+  cvs import src/contrib/cvs CVSHOME v1_8_1
+
+When new versions are imported, cvs will give instructions on how to merge
+the local and vendor changes when/if conflicts arise..
+
+The developers can be reached at:  <devel-cvs@cyclic.com>.  Local changes
+that are suitable for public consumption should be submitted for inclusion
+in future releases.
+
+peter@freebsd.org - 20 Aug 1996
+
+Current local changes:
+  - CVS_LOCAL_BRANCH_NUM environment variable support for choosing the
+    magic branch number.  (for CVSup local-commit support)
+  - CVSREADONLYFS environment variable and global option -R to enable
+    no-locking readonly mode (eg: cvs repo is a cdrom or mirror)
+  - the verify message script can edit the submitted log message.
+  - CVSROOT/options file
+  - Variable keyword expansion controls including custom keywords.
+  - $ CVSHeader$ keyword - like Header, but with $CVSROOT stripped off.
Index: contrib/sccs2rcs.in
diff -u src/contrib/cvs/contrib/sccs2rcs.in:1.1.1.2 src/contrib/cvs/contrib/sccs2rcs.in:1.4
--- src/contrib/cvs/contrib/sccs2rcs.in:1.1.1.2	Mon Sep  2 00:49:42 2002
+++ contrib/sccs2rcs.in	Mon Sep  2 00:57:09 2002
@@ -42,6 +42,7 @@
 # ...!harvard!cg-atla!viewlog!kenstir
 #
 # Various hacks made by Brian Berliner before inclusion in CVS contrib area.
+# FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/contrib/sccs2rcs.in,v 1.4 2002/09/02 05:57:09 peter Exp $
 
 
 #we'll assume the user set up the path correctly
Index: diff/diagmeet.note
diff -u src/contrib/cvs/diff/diagmeet.note:1.1.1.1 src/contrib/cvs/diff/diagmeet.note:removed
--- src/contrib/cvs/diff/diagmeet.note:1.1.1.1	Sun Jan 25 21:09:49 1998
+++ diff/diagmeet.note	Wed Sep 11 20:31:44 2002
@@ -1,71 +0,0 @@
-Here is a comparison matrix which shows a case in which
-it is possible for the forward and backward scan in `diag'
-to meet along a nonzero length of diagonal simultaneous
-(so that bdiag[d] and fdiag[d] are not equal)
-even though there is no snake on that diagonal at the meeting point.
-
-
-     85   1   1   1  159  1   1   17
-        1   2   3   4
-60
-    1   2
-1
-    2  	    2   3   4
-71
-    3       3  	4   5
-85
-    4  	3   4	5
-17
-    5  	4   5
-1
-    6       4  	5   6
-183
-    7       5   6   7
-10
-    8  	    6  	7
-1
-    9           6   7  	8
-12
-                7   8   9  10
-13
-       10       8   9  10
-14
-           10   9  10
-17
-       10      10
-1
-   10   9  10
-1
-	8      10      10      10
-183
-    8   7	9       9      	9
-10
-    7   6	8   9   8      	8
-1
-    6   5    		7       7
-1
-            5          	6      	6
-1
-	       	5      	5      	5
-50
-	    5   4      	4      	4
-1
-	            4   3	3
-85
-	    5   4   3   2       2
-1
-	                    2   1
-17
-	    5   4   3   2   1       1
-1
-		                1   0
-     85   1   1   1  159  1   1  17
-
-
-
-
-
-
-
-
-
Index: diff/diff3.c
diff -u src/contrib/cvs/diff/diff3.c:1.1.1.6 src/contrib/cvs/diff/diff3.c:1.5
--- src/contrib/cvs/diff/diff3.c:1.1.1.6	Mon Sep  2 00:50:17 2002
+++ diff/diff3.c	Mon Sep  2 00:57:13 2002
@@ -12,6 +12,9 @@
    GNU General Public License for more details.
 
    */
+/*
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/diff/diff3.c,v 1.5 2002/09/02 05:57:13 peter Exp $
+ */
 
 /* Written by Randy Smith */
 /* Librarification by Tim Pierce */
Index: lib/md5.h
diff -u src/contrib/cvs/lib/md5.h:1.1.1.3 src/contrib/cvs/lib/md5.h:1.2
--- src/contrib/cvs/lib/md5.h:1.1.1.3	Sat Dec 11 06:22:56 1999
+++ lib/md5.h	Sat Dec 11 09:10:02 1999
@@ -1,8 +1,21 @@
 /* See md5.c for explanation and copyright information.  */
 
+/*
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/lib/md5.h,v 1.2 1999/12/11 15:10:02 peter Exp $
+ */
+
 #ifndef MD5_H
 #define MD5_H
 
+#ifdef __FreeBSD__
+#define	cvs_MD5Context	MD5Context
+#define	cvs_MD5Init	MD5Init
+#define	cvs_MD5Update	MD5Update
+#define	cvs_MD5Final	MD5Final
+#define	cvs_MD5Transform MD5Transform
+#include <sys/md5.h>
+#else
+
 /* Unlike previous versions of this code, uint32 need not be exactly
    32 bits, merely 32 bits or more.  Choosing a data type which is 32
    bits instead of 64 is not important; speed is considerably more
@@ -22,5 +35,7 @@
 void cvs_MD5Final PROTO ((unsigned char digest[16],
 			  struct cvs_MD5Context *context));
 void cvs_MD5Transform PROTO ((cvs_uint32 buf[4], const unsigned char in[64]));
+
+#endif
 
 #endif /* !MD5_H */
Index: man/cvs.1
diff -u src/contrib/cvs/man/cvs.1:1.1.1.6 src/contrib/cvs/man/cvs.1:1.19
--- src/contrib/cvs/man/cvs.1:1.1.1.6	Mon Sep  2 00:50:19 2002
+++ man/cvs.1	Mon Sep  2 00:57:13 2002
@@ -1,3 +1,4 @@
+.\" FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/man/cvs.1,v 1.19 2002/09/02 05:57:13 peter Exp $
 .de Id
 .ds Rv \\$3
 .ds Dt \\$4
@@ -235,6 +236,16 @@
 .SM CVSREAD
 environment variable is set.
 .TP
+.B \-R
+Turns on read-only repository mode.  This allows one to check out from a
+read-only repository, such as within an anoncvs server, or from a CDROM
+repository.
+Same effect as if the
+.SM CVSREADONLYFS
+environment variable is set.  Using
+.B \-R
+can also considerably speed up checkout's over NFS.
+.TP
 .B \-v [ --version ]
 Displays version and copyright information for
 .BR cvs .
@@ -245,6 +256,25 @@
 .SM CVSREAD
 environment variable.
 .TP
+.B \-g
+Forces group-write perms on working files.  This option is typically
+used when you have multiple users sharing a single checked out source
+tree, allowing them to operate their shells with a less dangerous umask.
+To use this feature, create a directory to hold the checked-out source
+tree, set it to a private group, and set up the directory such that
+files created under it inherit the group id of the directory.  This occurs 
+automatically with FreeBSD.  With SysV you must typically set the SGID bit
+on the directory.  The users who are to share the checked out tree must
+be placed in that group.  Note that the sharing of a single checked-out
+source tree is very different from giving several users access to a common
+CVS repository.  Access to a common CVS repository already maintains shared
+group-write perms and does not require this option.
+
+To use the option transparently, simply place the line 'cvs -g' in your
+~/.cvsrc file.  Doing this is not recommended unless you firewall all your
+source checkouts within a private group or within a private mode 0700
+directory.
+.TP
 .B \-x
 Encrypt all communication between the client and the server.  As of
 this writing, this is only implemented when using a Kerberos
@@ -297,6 +327,15 @@
 all executions of
 .` "cvs diff"
 ).
+.SP
+Global options are specified using the \fBcvs\fP keyword.  For example,
+the following:
+.SP
+cvs \-q
+.SP
+will mean that all
+.` "cvs"
+commands will behave as thought he \-q global option had been supplied.
 .SH "CVS COMMAND SUMMARY"
 Here are brief descriptions of all the
 .B cvs
@@ -559,6 +598,16 @@
 options of
 .BR checkout " and " export .
 .TP
+.B \-T
+Create/Update CVS/Template by copying it from the (local) repository.
+This option is useful for developers maintaining a local cvs repository
+but commiting to a remote repository.  By maintaining CVS/Template the
+remote commits will still be able to bring up the proper template in the
+commit editor session.
+Available with the
+.BR checkout " and " update
+commands.
+.TP
 .B \-p
 Pipe the files retrieved from the repository to standard output,
 rather than writing them in the current directory.  Available with the
@@ -1046,7 +1095,7 @@
 .` "cvs checkout -rEXPR1 whatever_module"
 to work with you on the experimental change.
 .TP
-\fBdiff\fP [\fB\-kl\fP] [\fIrcsdiff_options\fP] [[\fB\-r\fP \fIrev1\fP | \fB\-D\fP \fIdate1\fP] [\fB\-r\fP \fIrev2\fP | \fB\-D\fP \fIdate2\fP]] [\fIfiles.\|.\|.\fP]
+\fBdiff\fP [\fB\-kl\fP] [\fIrcsdiff_options\fP] [[\fB\-r\fP \fIrev1\fP | \fB\-D\fP \fIdate1\fP | \fB\-j\fP \fIrev1:date1\fP] [\fB\-r\fP \fIrev2\fP | \fB\-D\fP \fIdate2\fP | \fB\-j\fP \fIrev2:date2\fP]] [\fIfiles.\|.\|.\fP]
 .I Requires:
 working directory, repository.
 .br
@@ -1069,11 +1118,16 @@
 repository.
 You can also specify
 .B \-D
-options to diff against a revision in the past.
+options to diff against a revision (on the head branch) in the past, and
+you can also specify
+.B \-j
+options to diff against a revision relative to a branch tag in the past.
 The
 .B \-r
 and
 .B \-D
+and
+.B \-j
 options can be mixed together with at most two options ever specified.
 .SP
 See
@@ -2015,7 +2069,7 @@
 .TP
 #cvs.wfl.\fIpid\fP
 A write lock.
-.SH "ENVIRONMENT VARIABLES"
+.SH "ENVIRONMENT"
 .TP
 .SM CVSROOT
 Should contain the full pathname to the root of the
@@ -2030,9 +2084,7 @@
 .` "cvs \-d \fIcvsroot cvs_command\fP\|.\|.\|."
 You may not need to set
 .SM CVSROOT
-if your \fBcvs\fP binary has the right path compiled in; use
-.` "cvs \-v"
-to display all compiled-in paths.
+if your \fBcvs\fP binary has the right path compiled in.
 .TP
 .SM CVSREAD
 If this is set,
@@ -2043,6 +2095,13 @@
 When this is not set, the default behavior is to permit modification
 of your working files.
 .TP
+.SM CVSREADONLYFS
+If this is set, the
+.B \-R
+option is assumed, and
+.B cvs
+operates in read-only repository mode.
+.TP
 .SM RCSBIN
 Specifies the full pathname where to find
 .SM RCS
@@ -2069,13 +2128,19 @@
 .B cvs
 will ignore all references to remote repositories in the CVS/Root file.
 .TP
+.SM CVS_OPTIONS
+Specifies a set of default options for
+.B cvs.
+These options are interpreted before the startup file (\fI~/.cvsrc\fP) is read
+and can be overridden by explicit command line parameters.
+.TP
 .SM CVS_RSH
 .B cvs
 uses the contents of this variable to determine the name of the
 remote shell command to use when starting a
 .B cvs
 server.  If this variable is not set then
-.` "rsh"
+.` "ssh"
 is used.
 .TP
 .SM CVS_SERVER
Index: man/cvsbug.8
diff -u src/contrib/cvs/man/cvsbug.8:1.1.1.4 src/contrib/cvs/man/cvsbug.8:1.3
--- src/contrib/cvs/man/cvsbug.8:1.1.1.4	Mon Sep  2 00:50:19 2002
+++ man/cvsbug.8	Mon Oct  2 01:43:55 2000
@@ -17,6 +17,7 @@
 .\"    General Public License for more details.
 .\"
 .\" ---------------------------------------------------------------------------
+.\" FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/man/cvsbug.8,v 1.3 2000/10/02 06:43:55 peter Exp $
 .nh
 .TH CVSBUG 8 xVERSIONx "February 1993"
 .SH NAME
Index: src/buffer.c
diff -u src/contrib/cvs/src/buffer.c:1.1.1.4 src/contrib/cvs/src/buffer.c:1.2
--- src/contrib/cvs/src/buffer.c:1.1.1.4	Mon Sep  2 00:49:47 2002
+++ src/buffer.c	Mon Sep  2 02:58:04 2002
@@ -1,5 +1,7 @@
 /* Code for the buffer data structure.  */
 
+/* FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/buffer.c,v 1.2 2002/09/02 07:58:04 peter Exp $ */
+
 #include <assert.h>
 #include "cvs.h"
 #include "buffer.h"
@@ -1378,8 +1380,7 @@
 
     if (buf->input)
     {
-	if (! buf_empty_p (buf)
-	    || getc (bc->fp) != EOF)
+	if (! buf_empty_p (buf))
 	{
 # ifdef SERVER_SUPPORT
 	    if (server_active)
Index: src/checkout.c
diff -u src/contrib/cvs/src/checkout.c:1.1.1.11 src/contrib/cvs/src/checkout.c:1.3
--- src/contrib/cvs/src/checkout.c:1.1.1.11	Mon Sep  2 00:49:47 2002
+++ src/checkout.c	Mon Sep  2 00:57:13 2002
@@ -33,6 +33,10 @@
  * edited by the user, if necessary (when the repository is moved, e.g.)
  */
 
+/*
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/checkout.c,v 1.3 2002/09/02 05:57:13 peter Exp $
+ */
+
 #include <assert.h>
 #include "cvs.h"
 
@@ -50,6 +54,7 @@
     "\t-N\tDon't shorten module paths if -d specified.\n",
     "\t-P\tPrune empty directories.\n",
     "\t-R\tProcess directories recursively.\n",
+    "\t-T\tCreate Template file from local repository for remote commit.\n",
     "\t-c\t\"cat\" the module database.\n",
     "\t-f\tForce a head revision match if tag/date not found.\n",
     "\t-l\tLocal directory only, not recursive\n",
@@ -92,6 +97,7 @@
 static char *join_rev1;
 static char *join_rev2;
 static int join_tags_validated;
+static int pull_template;
 static char *preload_update_dir;
 static char *history_name;
 static enum mtype m_type;
@@ -139,7 +145,7 @@
     else
     {
         m_type = CHECKOUT;
-	valid_options = "+ANnk:d:flRpQqcsr:D:j:P";
+	valid_options = "+ANnk:d:flRpTQqcsr:D:j:P";
 	valid_usage = checkout_usage;
     }
 
@@ -168,6 +174,9 @@
 	    case 'n':
 		run_module_prog = 0;
 		break;
+	    case 'T':
+		pull_template = 1;
+		break;
 	    case 'Q':
 	    case 'q':
 #ifdef SERVER_SUPPORT
@@ -1086,7 +1095,7 @@
 			  force_tag_match, 0 /* !local */ ,
 			  1 /* update -d */ , aflag, checkout_prune_dirs,
 			  pipeout, which, join_rev1, join_rev2,
-			  preload_update_dir, m_type == CHECKOUT);
+			  preload_update_dir, pull_template);
 	goto out;
     }
 
@@ -1142,7 +1151,7 @@
     err += do_update (argc - 1, argv + 1, options, tag, date,
 		      force_tag_match, local_specified, 1 /* update -d */,
 		      aflag, checkout_prune_dirs, pipeout, which, join_rev1,
-		      join_rev2, preload_update_dir, m_type == CHECKOUT);
+		      join_rev2, preload_update_dir, pull_template);
 out:
     free (preload_update_dir);
     preload_update_dir = oldupdate;
Index: src/client.c
diff -u src/contrib/cvs/src/client.c:1.1.1.12 src/contrib/cvs/src/client.c:1.8
--- src/contrib/cvs/src/client.c:1.1.1.12	Mon Sep  2 00:49:49 2002
+++ src/client.c	Mon Sep  2 00:57:13 2002
@@ -12,6 +12,10 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.  */
 
+/*
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/client.c,v 1.8 2002/09/02 05:57:13 peter Exp $
+ */
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif /* HAVE_CONFIG_H */
@@ -251,7 +255,7 @@
 	}
 
 	/* Now check the value for root. */
-	if (this_root && current_parsed_root
+	if (CVSroot_cmdline == NULL && this_root && current_parsed_root
 	    && (strcmp (this_root, current_parsed_root->original) != 0))
 	{
 	    /* Don't send this, since the CVSROOTs don't match. */
@@ -4810,7 +4814,7 @@
 	   example in CVS_RSH or other such mechanisms to be devised,
 	   if that is what they want (the manual already tells them
 	   that).  */
-	cvs_rsh = "rsh";
+	cvs_rsh = "ssh";
     if (!cvs_server)
 	cvs_server = "cvs";
 
@@ -4871,7 +4875,7 @@
     int child_pid;
 
     if (!cvs_rsh)
-	cvs_rsh = "rsh";
+	cvs_rsh = "ssh";
     if (!cvs_server)
 	cvs_server = "cvs";
 
@@ -5227,7 +5231,8 @@
     }
     else if (vers->ts_rcs == NULL
 	     || args->force
-	     || strcmp (vers->ts_user, vers->ts_rcs) != 0)
+	     || strcmp (vers->ts_user, vers->ts_rcs) != 0
+	     || (vers->vn_user && *vers->vn_user == '0'))
     {
 	if (args->no_contents
 	    && supported_request ("Is-modified"))
Index: src/commit.c
diff -u src/contrib/cvs/src/commit.c:1.1.1.10 src/contrib/cvs/src/commit.c:1.11
--- src/contrib/cvs/src/commit.c:1.1.1.10	Mon Sep  2 00:49:49 2002
+++ src/commit.c	Mon Sep  2 00:57:13 2002
@@ -12,6 +12,7 @@
  *
  * The call is: cvs commit [options] files...
  *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/commit.c,v 1.11 2002/09/02 05:57:13 peter Exp $
  */
 
 #include <assert.h>
@@ -2129,6 +2130,8 @@
 	    /* branch does not exist.  Stub it.  */
 	    char *head;
 	    char *magicrev;
+
+	    fixbranch(rcsfile, sbranch);
 
 	    head = RCS_getversion (rcsfile, NULL, NULL, 0, (int *) NULL);
 	    magicrev = RCS_magicrev (rcsfile, head);
Index: src/cvs.h
diff -u src/contrib/cvs/src/cvs.h:1.1.1.11 src/contrib/cvs/src/cvs.h:1.15
--- src/contrib/cvs/src/cvs.h:1.1.1.11	Mon Sep  2 00:50:02 2002
+++ src/cvs.h	Mon Sep  2 00:57:13 2002
@@ -9,6 +9,7 @@
 /*
  * basic information used in all source files
  *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/cvs.h,v 1.15 2002/09/02 05:57:13 peter Exp $
  */
 
 
@@ -190,6 +191,7 @@
 #define CVSROOTADM_WRITERS	"writers"
 #define CVSROOTADM_PASSWD	"passwd"
 #define CVSROOTADM_CONFIG	"config"
+#define CVSROOTADM_OPTIONS	"options"
 
 #define CVSNULLREPOS		"Emptydir"	/* an empty directory */
 
@@ -259,6 +261,8 @@
 #define	CVSREAD_ENV	"CVSREAD"	/* make files read-only */
 #define	CVSREAD_DFLT	0		/* writable files by default */
 
+#define	CVSREADONLYFS_ENV "CVSREADONLYFS" /* repository is read-only */
+
 #define	TMPDIR_ENV	"TMPDIR"	/* Temporary directory */
 /* #define	TMPDIR_DFLT		   Set by options.h */
 
@@ -366,6 +370,7 @@
 extern int use_editor;
 extern int cvswrite;
 extern mode_t cvsumask;
+extern char *RCS_citag;
 
 
 
@@ -384,7 +389,9 @@
 
 extern int trace;		/* Show all commands */
 extern int noexec;		/* Don't modify disk anywhere */
+extern int readonlyfs;		/* fail on all write locks; succeed all read locks */
 extern int logoff;		/* Don't write history entry */
+extern int require_real_user;	/* skip CVSROOT/passwd, /etc/passwd users only*/
 
 extern int top_level_admin;
 
@@ -489,6 +496,7 @@
 char *get_homedir PROTO ((void));
 char *cvs_temp_name PROTO ((void));
 FILE *cvs_temp_file PROTO ((char **filename));
+void parseopts PROTO ((const char *root));
 
 int numdots PROTO((const char *s));
 char *increment_revnum PROTO ((const char *));
@@ -525,6 +533,7 @@
 void ParseTag PROTO((char **tagp, char **datep, int *nonbranchp));
 void WriteTag PROTO ((char *dir, char *tag, char *date, int nonbranch,
 		      char *update_dir, char *repository));
+void WriteTemplate PROTO ((char *dir, char *update_dir));
 void cat_module PROTO((int status));
 void check_entries PROTO((char *dir));
 void close_module PROTO((DBM * db));
Index: src/diff.c
diff -u src/contrib/cvs/src/diff.c:1.1.1.9 src/contrib/cvs/src/diff.c:1.17
--- src/contrib/cvs/src/diff.c:1.1.1.9	Mon Sep  2 00:49:50 2002
+++ src/diff.c	Mon Sep  2 00:57:13 2002
@@ -12,6 +12,8 @@
  * 
  * Without any file arguments, runs diff against all the currently modified
  * files.
+ *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/diff.c,v 1.17 2002/09/02 05:57:13 peter Exp $
  */
 
 #include "cvs.h"
@@ -48,6 +50,7 @@
 static char *diff_rev1, *diff_rev2;
 /* Command line dates, from -D option.  Malloc'd.  */
 static char *diff_date1, *diff_date2;
+static char *diff_join1, *diff_join2;
 static char *use_rev1, *use_rev2;
 static int have_rev1_label, have_rev2_label;
 
@@ -268,10 +271,12 @@
     diff_rev2 = NULL;
     diff_date1 = NULL;
     diff_date2 = NULL;
+    diff_join1 = NULL;
+    diff_join2 = NULL;
 
     optind = 0;
     while ((c = getopt_long (argc, argv,
-	       "+abcdefhilnpstuwy0123456789BHNRTC:D:F:I:L:U:W:k:r:",
+	       "+abcdefhilnpstuwy0123456789BHNRTC:D:F:I:L:U:W:k:r:j:",
 			     longopts, &option_index)) != -1)
     {
 	switch (c)
@@ -334,6 +339,27 @@
 		    free (options);
 		options = RCS_check_kflag (optarg);
 		break;
+	    case 'j':
+		{
+		    char *ptr;
+		    char *cpy = strdup(optarg);
+
+		    if ((ptr = strchr(optarg, ':')) != NULL)
+			*ptr++ = 0;
+		    if (diff_rev2 != NULL || diff_date2 != NULL)
+			error (1, 0,
+			   "no more than two revisions/dates can be specified");
+		    if (diff_rev1 != NULL || diff_date1 != NULL) {
+			diff_join2 = cpy;
+			diff_rev2 = optarg;
+			diff_date2 = ptr ? Make_Date(ptr) : NULL;
+		    } else {
+			diff_join1 = cpy;
+			diff_rev1 = optarg;
+			diff_date1 = ptr ? Make_Date(ptr) : NULL;
+		    }
+		}
+		break;
 	    case 'r':
 		if (diff_rev2 != NULL || diff_date2 != NULL)
 		    error (1, 0,
@@ -382,13 +408,18 @@
 	send_option_string (opts);
 	if (options[0] != '\0')
 	    send_arg (options);
-	if (diff_rev1)
+	if (diff_join1)
+	    option_with_arg ("-j", diff_join1);
+	else if (diff_rev1)
 	    option_with_arg ("-r", diff_rev1);
-	if (diff_date1)
+	else if (diff_date1)
 	    client_senddate (diff_date1);
-	if (diff_rev2)
+
+	if (diff_join2)
+	    option_with_arg ("-j", diff_join2);
+	else if (diff_rev2)
 	    option_with_arg ("-r", diff_rev2);
-	if (diff_date2)
+	else if (diff_date2)
 	    client_senddate (diff_date2);
 
 	/* Send the current files unless diffing two revs from the archive */
@@ -401,28 +432,26 @@
 
 	send_to_server ("diff\012", 0);
         err = get_responses_and_close ();
-	free (options);
-	options = NULL;
-	return (err);
-    }
+    } else
 #endif
-
-    if (diff_rev1 != NULL)
-	tag_check_valid (diff_rev1, argc, argv, local, 0, "");
-    if (diff_rev2 != NULL)
-	tag_check_valid (diff_rev2, argc, argv, local, 0, "");
-
-    which = W_LOCAL;
-    if (diff_rev1 != NULL || diff_date1 != NULL)
-	which |= W_REPOS | W_ATTIC;
-
-    wrap_setup ();
-
-    /* start the recursion processor */
-    err = start_recursion (diff_fileproc, diff_filesdoneproc, diff_dirproc,
-			   diff_dirleaveproc, NULL, argc, argv, local,
-			   which, 0, 1, (char *) NULL, 1);
+    {
+	if (diff_rev1 != NULL)
+	    tag_check_valid (diff_rev1, argc, argv, local, 0, "");
+	if (diff_rev2 != NULL)
+	    tag_check_valid (diff_rev2, argc, argv, local, 0, "");
+
+	which = W_LOCAL;
+	if (diff_rev1 != NULL || diff_date1 != NULL)
+	    which |= W_REPOS | W_ATTIC;
+
+	wrap_setup ();
+
+	/* start the recursion processor */
+	err = start_recursion (diff_fileproc, diff_filesdoneproc, diff_dirproc,
+			       diff_dirleaveproc, NULL, argc, argv, local,
+			       which, 0, 1, (char *) NULL, 1);
 
+    }
     /* clean up */
     free (options);
     options = NULL;
@@ -431,6 +460,10 @@
 	free (diff_date1);
     if (diff_date2 != NULL)
 	free (diff_date2);
+    if (diff_join1 != NULL)
+	free (diff_join1);
+    if (diff_join2 != NULL)
+	free (diff_join2);
 
     return (err);
 }
@@ -480,7 +513,7 @@
 		int exists;
 
 		exists = 0;
-		/* special handling for TAG_HEAD */
+		/* special handling for TAG_HEAD XXX */
 		if (diff_rev1 && strcmp (diff_rev1, TAG_HEAD) == 0)
 		{
 		    char *head =
@@ -886,7 +919,7 @@
 
     if (diff_rev1 || diff_date1)
     {
-	/* special handling for TAG_HEAD */
+	/* special handling for TAG_HEAD XXX */
 	if (diff_rev1 && strcmp (diff_rev1, TAG_HEAD) == 0)
 	    use_rev1 = ((vers->vn_rcs == NULL || vers->srcfile == NULL)
 			? NULL
@@ -901,7 +934,7 @@
     }
     if (diff_rev2 || diff_date2)
     {
-	/* special handling for TAG_HEAD */
+	/* special handling for TAG_HEAD XXX */
 	if (diff_rev2 && strcmp (diff_rev2, TAG_HEAD) == 0)
 	    use_rev2 = ((vers->vn_rcs == NULL || vers->srcfile == NULL)
 			? NULL
Index: src/entries.c
diff -u src/contrib/cvs/src/entries.c:1.1.1.7 src/contrib/cvs/src/entries.c:1.2
--- src/contrib/cvs/src/entries.c:1.1.1.7	Fri Aug 10 04:43:20 2001
+++ src/entries.c	Sat Sep 15 00:57:52 2001
@@ -11,6 +11,9 @@
  * the Entries file.
  */
 
+/*
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/entries.c,v 1.2 2001/09/15 05:57:52 dillon Exp $
+ */
 #include "cvs.h"
 #include "getline.h"
 
@@ -631,6 +634,76 @@
     /* put the node into the list */
     addnode (list, p);
     return (p);
+}
+
+static char *root_template;
+
+static int
+get_root_template(char *repository, char *path)
+{
+    if (root_template) {
+	if (strcmp(path, root_template) == 0)
+	    return(0);
+	free(root_template);
+    }
+    if ((root_template = strdup(path)) == NULL)
+	return(-1);
+    return(0);
+}
+
+/*
+ * Write out/Clear the CVS/Template file.
+ */
+void
+WriteTemplate (dir, update_dir)
+    char *dir;
+    char *update_dir;
+{
+    char *tmp = NULL;
+    char *root = NULL;
+    struct stat st1;
+    struct stat st2;
+
+    if (Parse_Info(CVSROOTADM_RCSINFO, "cvs", get_root_template, 1) < 0)
+	return;
+
+    if ((root = Name_Root(dir, update_dir)) == NULL)
+	error (1, errno, "unable to locate cvs root");
+    if (asprintf(&tmp, "%s/%s", dir, CVSADM_TEMPLATE) < 0)
+	error (1, errno, "out of memory");
+
+    if (stat(root_template, &st1) == 0) {
+	if (stat(tmp, &st2) < 0 || st1.st_mtime != st2.st_mtime) {
+	    FILE *fi;
+	    FILE *fo;
+
+	    if ((fi = open_file(root_template, "r")) != NULL) {
+		if ((fo = open_file(tmp, "w")) != NULL) {
+		    int n;
+		    char buf[256];
+
+		    while ((n = fread(buf, 1, sizeof(buf), fi)) > 0)
+			fwrite(buf, 1, n, fo);
+		    fflush(fo);
+		    if (ferror(fi) || ferror(fo)) {
+			fclose(fo);
+			remove(tmp);
+			error (1, errno, "error copying Template");
+		    } else {
+			struct timeval times[2];
+			fclose(fo);
+			times[0].tv_sec = st1.st_mtime;
+			times[0].tv_usec = 0;
+			times[1] = times[0];
+			utimes(tmp, times);
+		    }
+		} 
+		fclose(fi);
+	    }
+	}
+    }
+    free(tmp);
+    free(root);
 }
 
 /*
Index: src/filesubr.c
diff -u src/contrib/cvs/src/filesubr.c:1.1.1.9 src/contrib/cvs/src/filesubr.c:1.9
--- src/contrib/cvs/src/filesubr.c:1.1.1.9	Mon Sep  2 00:49:51 2002
+++ src/filesubr.c	Mon Sep  2 00:57:13 2002
@@ -17,6 +17,10 @@
    definitions under operating systems (like, say, Windows NT) with different
    file system semantics.  */
 
+/*
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/filesubr.c,v 1.9 2002/09/02 05:57:13 peter Exp $
+ */
+
 #include <assert.h>
 #include "cvs.h"
 
@@ -864,8 +868,8 @@
 {
     char *file = NULL;
     char *tfile;
-    int buflen = 128;
-    int link_name_len;
+    int buflen = BUFSIZ;
+    int linklen;
 
     if (!islink (link))
 	return NULL;
@@ -876,15 +880,15 @@
     do
     {
 	file = xrealloc (file, buflen);
-	link_name_len = readlink (link, file, buflen - 1);
+	errno = 0;
+	linklen = readlink (link, file, buflen - 1);
 	buflen *= 2;
     }
-    while (link_name_len < 0 && errno == ENAMETOOLONG);
+    while (linklen == -1 && errno == ENAMETOOLONG);
 
-    if (link_name_len < 0)
+    if (linklen == -1)
 	error (1, errno, "cannot readlink %s", link);
-
-    file[link_name_len] = '\0';
+    file[linklen] = '\0';
 
     tfile = xstrdup (file);
     free (file);
Index: src/import.c
diff -u src/contrib/cvs/src/import.c:1.1.1.11 src/contrib/cvs/src/import.c:1.10
--- src/contrib/cvs/src/import.c:1.1.1.11	Mon Sep  2 00:49:52 2002
+++ src/import.c	Mon Sep  2 00:57:13 2002
@@ -14,6 +14,8 @@
  *	VendorReleTag	Tag for this particular release
  *
  * Additional arguments specify more Vendor Release Tags.
+ *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/import.c,v 1.10 2002/09/02 05:57:13 peter Exp $
  */
 
 #include "cvs.h"
Index: src/lock.c
diff -u src/contrib/cvs/src/lock.c:1.1.1.9 src/contrib/cvs/src/lock.c:1.10
--- src/contrib/cvs/src/lock.c:1.1.1.9	Mon Sep  2 00:49:52 2002
+++ src/lock.c	Mon Sep  2 00:57:13 2002
@@ -8,6 +8,8 @@
  * Set Lock
  * 
  * Lock file support for CVS.
+ *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/lock.c,v 1.10 2002/09/02 05:57:13 peter Exp $
  */
 
 /* The node Concurrency in doc/cvs.texinfo has a brief introduction to
@@ -403,7 +405,7 @@
 	(void) fprintf (stderr, "%s-> Reader_Lock(%s)\n", CLIENT_SERVER_STR,
                         xrepository);
 
-    if (noexec)
+    if (noexec || readonlyfs)
 	return (0);
 
     /* we only do one directory at a time for read locks! */
@@ -477,6 +479,11 @@
 
     if (noexec)
 	return (0);
+
+    if (readonlyfs) {
+	error (0, 0, "write lock failed - read-only repository");
+	return (1);
+    }
 
     /* We only know how to do one list at a time */
     if (locklist != (List *) NULL)
Index: src/login.c
diff -u src/contrib/cvs/src/login.c:1.1.1.7 src/contrib/cvs/src/login.c:1.6
--- src/contrib/cvs/src/login.c:1.1.1.7	Mon Sep  2 00:49:53 2002
+++ src/login.c	Mon Sep  2 00:57:13 2002
@@ -5,6 +5,8 @@
  * specified in the README file that comes with CVS.
  * 
  * Allow user to log in for an authenticating server.
+ *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/login.c,v 1.6 2002/09/02 05:57:13 peter Exp $
  */
 
 #include "cvs.h"
Index: src/logmsg.c
diff -u src/contrib/cvs/src/logmsg.c:1.1.1.8 src/contrib/cvs/src/logmsg.c:1.10
--- src/contrib/cvs/src/logmsg.c:1.1.1.8	Mon Sep  2 00:49:53 2002
+++ src/logmsg.c	Mon Sep  2 00:57:13 2002
@@ -4,6 +4,8 @@
  * 
  * You may distribute under the terms of the GNU General Public License as
  * specified in the README file that comes with the CVS source distribution.
+ *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/logmsg.c,v 1.10 2002/09/02 05:57:13 peter Exp $
  */
 
 #include <assert.h>
@@ -222,6 +224,8 @@
 	    (*messagep)[strlen (*messagep) - 1] != '\n')
 	    (void) fprintf (fp, "\n");
     }
+    else
+	(void) fprintf (fp, "\n");
 
     if (repository != NULL)
 	/* tack templates on if necessary */
Index: src/main.c
diff -u src/contrib/cvs/src/main.c:1.1.1.11 src/contrib/cvs/src/main.c:1.21
--- src/contrib/cvs/src/main.c:1.1.1.11	Mon Sep  2 00:49:53 2002
+++ src/main.c	Mon Sep  2 00:57:13 2002
@@ -10,10 +10,12 @@
  * Credit to Dick Grune, Vrije Universiteit, Amsterdam, for writing
  * the shell-script CVS system that this is based on.
  *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/main.c,v 1.21 2002/09/02 05:57:13 peter Exp $
  */
 
 #include <assert.h>
 #include "cvs.h"
+#include "prepend_args.h"
 
 #ifdef HAVE_WINSOCK_H
 #include <winsock.h>
@@ -41,6 +43,8 @@
 int quiet = 0;
 int trace = 0;
 int noexec = 0;
+int readonlyfs = 0;
+int require_real_user = 0;
 int logoff = 0;
 
 /* Set if we should be writing CVSADM directories at top level.  At
@@ -247,9 +251,11 @@
     "    -q           Cause CVS to be somewhat quiet.\n",
     "    -r           Make checked-out files read-only.\n",
     "    -w           Make checked-out files read-write (default).\n",
+    "    -g           Force group-write perms on checked-out files.\n",
     "    -l           Turn history logging off.\n",
     "    -n           Do not execute anything that will change the disk.\n",
     "    -t           Show trace of program execution -- try with -n.\n",
+    "    -R           Assume repository is read-only, such as CDROM\n",
     "    -v           CVS version and copyright.\n",
     "    -T tmpdir    Use 'tmpdir' for temporary files.\n",
     "    -e editor    Use 'editor' for editing log information.\n",
@@ -407,7 +413,7 @@
     int help = 0;		/* Has the user asked for help?  This
 				   lets us support the `cvs -H cmd'
 				   convention to give help for cmd. */
-    static const char short_options[] = "+Qqrwtnlvb:T:e:d:Hfz:s:xa";
+    static const char short_options[] = "+QqgrwtnRlvb:T:e:d:Hfz:s:xaU";
     static struct option long_options[] =
     {
         {"help", 0, NULL, 'H'},
@@ -470,6 +476,12 @@
     }
     if (getenv (CVSREAD_ENV) != NULL)
 	cvswrite = 0;
+    if (getenv (CVSREADONLYFS_ENV) != NULL) {
+	readonlyfs = 1;
+	logoff = 1;
+    }
+
+    prepend_default_options (getenv ("CVS_OPTIONS"), &argc, &argv);
 
     /* Set this to 0 to force getopt initialization.  getopt() sets
        this to 1 internally.  */
@@ -532,9 +544,20 @@
 	    case 'w':
 		cvswrite = 1;
 		break;
+	    case 'g':
+		/*
+		 * force full group write perms (used for shared checked-out
+		 * source trees, see manual page)
+		 */
+		umask(umask(077) & 007);
+		break;
 	    case 't':
 		trace = 1;
 		break;
+	    case 'R':
+		readonlyfs = 1;
+		logoff = 1;
+		break;
 	    case 'n':
 		noexec = 1;
 	    case 'l':			/* Fall through */
@@ -620,6 +643,11 @@
                    We will issue an error later if stream
                    authentication is not supported.  */
 		break;
+	    case 'U':
+#ifdef SERVER_SUPPORT
+		require_real_user = 1;
+#endif
+		break;
 	    case '?':
 	    default:
                 usage (usg);
@@ -744,6 +772,12 @@
 	    (void) putenv (env);
 	    /* do not free env, as putenv has control of it */
 	}
+	{
+	    char *env;
+	    env = xmalloc (sizeof "CVS_PID=" + 32); /* XXX pid < 10^32 */
+	    (void) sprintf (env, "CVS_PID=%ld", (long) getpid ());
+	    (void) putenv (env);
+	}
 #endif
 
 #ifndef DONT_USE_SIGNALS
@@ -969,6 +1003,9 @@
 		   if we didn't, then there would be no way to check in a new
 		   CVSROOT/config file to fix the broken one!  */
 		parse_config (current_parsed_root->directory);
+
+		/* Now is a convenient time to read CVSROOT/options */
+		parseopts(current_parsed_root->directory);
 	    }
 
 #ifdef CLIENT_SUPPORT
@@ -1153,4 +1190,62 @@
     for (; *cpp; cpp++)
 	(void) fprintf (stderr, *cpp);
     error_exit ();
+}
+
+void
+parseopts(root)
+    const char *root;
+{
+    char path[PATH_MAX];
+    int save_errno;
+    char buf[1024];
+    const char *p;
+    char *q;
+    FILE *fp;
+
+    if (root == NULL) {
+	printf("no CVSROOT in parseopts\n");
+	return;
+    }
+    p = strchr (root, ':');
+    if (p)
+	p++;
+    else
+	p = root;
+    if (p == NULL) {
+	printf("mangled CVSROOT in parseopts\n");
+	return;
+    }
+    (void) sprintf (path, "%s/%s/%s", p, CVSROOTADM, CVSROOTADM_OPTIONS);
+    if ((fp = fopen(path, "r")) != NULL) {
+	while (fgets(buf, sizeof buf, fp) != NULL) {
+	    if (buf[0] == '#')
+		continue;
+	    q = strrchr(buf, '\n');
+	    if (q)
+		*q = '\0';
+
+	    if (!strncmp(buf, "tag=", 4)) {
+		char *what;
+		char *rcs_localid;
+
+		rcs_localid = buf + 4;
+		RCS_setlocalid(rcs_localid);
+	    }
+	    if (!strncmp(buf, "tagexpand=", 10)) {
+		char *what;
+		char *rcs_incexc;
+
+		rcs_incexc = buf + 10;
+		RCS_setincexc(rcs_incexc);
+	    }
+	    /*
+	     * OpenBSD has a "umask=" and "dlimit=" command, we silently
+	     * ignore them here since they are not much use to us.  cvsumask
+	     * defaults to 002 already, and the dlimit (data size limit)
+	     * should really be handled elsewhere (eg: login.conf).
+	     */
+	}
+	fclose(fp);
+    }
 }
Index: src/mkmodules.c
diff -u src/contrib/cvs/src/mkmodules.c:1.1.1.11 src/contrib/cvs/src/mkmodules.c:1.12
--- src/contrib/cvs/src/mkmodules.c:1.1.1.11	Mon Sep  2 00:49:54 2002
+++ src/mkmodules.c	Mon Sep  2 00:57:13 2002
@@ -3,7 +3,10 @@
  * Copyright (c) 1989-1992, Brian Berliner
  * 
  * You may distribute under the terms of the GNU General Public License as
- * specified in the README file that comes with the CVS kit.  */
+ * specified in the README file that comes with the CVS kit.
+ *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/mkmodules.c,v 1.12 2002/09/02 05:57:13 peter Exp $
+ */
 
 #include "cvs.h"
 #include "savecwd.h"
Index: src/rcs.c
diff -u src/contrib/cvs/src/rcs.c:1.1.1.11 src/contrib/cvs/src/rcs.c:1.23
--- src/contrib/cvs/src/rcs.c:1.1.1.11	Mon Sep  2 00:49:56 2002
+++ src/rcs.c	Mon Sep  2 00:57:13 2002
@@ -6,6 +6,8 @@
  * 
  * The routines contained in this file do all the rcs file parsing and
  * manipulation
+ *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/rcs.c,v 1.23 2002/09/02 05:57:13 peter Exp $
  */
 
 #include <assert.h>
@@ -130,6 +132,8 @@
    evaluates its arguments multiple times.  */
 #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp ((a), (b)) == 0)
 
+static char * getfullCVSname PROTO ((char *, char **));
+
 /*
  * We don't want to use isspace() from the C library because:
  *
@@ -2496,13 +2500,25 @@
     char *rev;
 {
     int rev_num;
-    char *xrev, *test_branch;
+    char *xrev, *test_branch, *local_branch_num;
 
     xrev = xmalloc (strlen (rev) + 14); /* enough for .0.number */
     check_rev = xrev;
 
+    local_branch_num = getenv("CVS_LOCAL_BRANCH_NUM");
+    if (local_branch_num)
+    {
+      rev_num = atoi(local_branch_num);
+      if (rev_num < 2)
+	rev_num = 2;
+      else
+	rev_num &= ~1;
+    }
+    else
+      rev_num = 2;
+
     /* only look at even numbered branches */
-    for (rev_num = 2; ; rev_num += 2)
+    for ( ; ; rev_num += 2)
     {
 	/* see if the physical branch exists */
 	(void) sprintf (xrev, "%s.%d", rev, rev_num);
@@ -2999,8 +3015,10 @@
 	p = findnode (rcs->versions, "1.1.1.1");
 	if (p)
 	{
+	    char *date_1_1 = vers->date;
+
 	    vers = (RCSVers *) p->data;
-	    if (RCS_datecmp (vers->date, date) != 0)
+	    if (RCS_datecmp (vers->date, date_1_1) != 0)
 		return xstrdup ("1.1");
 	}
     }
@@ -3464,27 +3482,31 @@
 {
     const char *string;
     size_t len;
+    int expandit;
 };
 #define KEYWORD_INIT(s) (s), sizeof (s) - 1
-static const struct rcs_keyword keywords[] =
+static struct rcs_keyword keywords[] =
 {
-    { KEYWORD_INIT ("Author") },
-    { KEYWORD_INIT ("Date") },
-    { KEYWORD_INIT ("Header") },
-    { KEYWORD_INIT ("Id") },
-    { KEYWORD_INIT ("Locker") },
-    { KEYWORD_INIT ("Log") },
-    { KEYWORD_INIT ("Name") },
-    { KEYWORD_INIT ("RCSfile") },
-    { KEYWORD_INIT ("Revision") },
-    { KEYWORD_INIT ("Source") },
-    { KEYWORD_INIT ("State") },
-    { NULL, 0 }
+    { KEYWORD_INIT ("Author"), 1 },
+    { KEYWORD_INIT ("Date"), 1 },
+    { KEYWORD_INIT ("CVSHeader"), 1 },
+    { KEYWORD_INIT ("Header"), 1 },
+    { KEYWORD_INIT ("Id"), 1 },
+    { KEYWORD_INIT ("Locker"), 1 },
+    { KEYWORD_INIT ("Log"), 1 },
+    { KEYWORD_INIT ("Name"), 1 },
+    { KEYWORD_INIT ("RCSfile"), 1 },
+    { KEYWORD_INIT ("Revision"), 1 },
+    { KEYWORD_INIT ("Source"), 1 },
+    { KEYWORD_INIT ("State"), 1 },
+    { NULL, 0, 0 },
+    { NULL, 0, 0 }
 };
 enum keyword
 {
     KEYWORD_AUTHOR = 0,
     KEYWORD_DATE,
+    KEYWORD_CVSHEADER,
     KEYWORD_HEADER,
     KEYWORD_ID,
     KEYWORD_LOCKER,
@@ -3493,8 +3515,10 @@
     KEYWORD_RCSFILE,
     KEYWORD_REVISION,
     KEYWORD_SOURCE,
-    KEYWORD_STATE
+    KEYWORD_STATE,
+    KEYWORD_LOCALID
 };
+enum keyword keyword_local = KEYWORD_ID;
 
 /* Convert an RCS date string into a readable string.  This is like
    the RCS date2str function.  */
@@ -3672,7 +3696,8 @@
 	slen = s - srch;
 	for (keyword = keywords; keyword->string != NULL; keyword++)
 	{
-	    if (keyword->len == slen
+	    if (keyword->expandit
+		&& keyword->len == slen
 		&& strncmp (keyword->string, srch, slen) == 0)
 	    {
 		break;
@@ -3719,15 +3744,25 @@
 		free_value = 1;
 		break;
 
+	    case KEYWORD_CVSHEADER:
 	    case KEYWORD_HEADER:
 	    case KEYWORD_ID:
+	    case KEYWORD_LOCALID:
 		{
 		    char *path;
 		    int free_path;
 		    char *date;
+		    char *old_path;
 
-		    if (kw == KEYWORD_HEADER)
+		    old_path = NULL;
+		    if (kw == KEYWORD_HEADER ||
+			    (kw == KEYWORD_LOCALID &&
+			     keyword_local == KEYWORD_HEADER))
 			path = rcs->path;
+		    else if (kw == KEYWORD_CVSHEADER ||
+			     (kw == KEYWORD_LOCALID &&
+			      keyword_local == KEYWORD_CVSHEADER))
+			path = getfullCVSname(rcs->path, &old_path);
 		    else
 			path = last_component (rcs->path);
 		    path = escape_keyword_value (path, &free_path);
@@ -3747,6 +3782,8 @@
 			     locker != NULL ? locker : "");
 		    if (free_path)
 			free (path);
+		    if (old_path)
+			free (old_path);
 		    free (date);
 		    free_value = 1;
 		}
@@ -8563,4 +8600,106 @@
 	}
     }
     return label;
+}
+
+void
+RCS_setlocalid (arg)
+    const char *arg;
+{
+    char *copy, *next, *key;
+
+    copy = xstrdup(arg);
+    next = copy;
+    key = strtok(next, "=");
+
+    keywords[KEYWORD_LOCALID].string = xstrdup(key);
+    keywords[KEYWORD_LOCALID].len = strlen(key);
+    keywords[KEYWORD_LOCALID].expandit = 1;
+
+    /* options? */
+    while (key = strtok(NULL, ",")) {
+	if (!strcmp(key, keywords[KEYWORD_ID].string))
+	    keyword_local = KEYWORD_ID;
+	else if (!strcmp(key, keywords[KEYWORD_HEADER].string))
+	    keyword_local = KEYWORD_HEADER;
+	else if (!strcmp(key, keywords[KEYWORD_CVSHEADER].string))
+	    keyword_local = KEYWORD_CVSHEADER;
+	else
+	    error(1, 0, "Unknown LocalId mode: %s", key);
+    }
+    free(copy);
+}
+
+void
+RCS_setincexc (arg)
+    const char *arg;
+{
+    char *key;
+    char *copy, *next;
+    int include = 0;
+    struct rcs_keyword *keyword;
+
+    copy = xstrdup(arg);
+    next = copy;
+    switch (*next++) {
+	case 'e':
+	    include = 0;
+	    break;
+	case 'i':
+	    include = 1;
+	    break;
+	default:
+	    free(copy);
+	    return;
+    }
+
+    if (include)
+	for (keyword = keywords; keyword->string != NULL; keyword++)
+	{
+	    keyword->expandit = 0;
+	}
+
+    key = strtok(next, ",");
+    while (key) {
+	for (keyword = keywords; keyword->string != NULL; keyword++) {
+	    if (strcmp (keyword->string, key) == 0)
+		keyword->expandit = include;
+	}
+	key = strtok(NULL, ",");
+    }
+    free(copy);
+    return;
+}
+
+#define ATTIC "/" CVSATTIC
+static char *
+getfullCVSname(CVSname, pathstore)
+    char *CVSname, **pathstore;
+{
+    if (current_parsed_root->directory) {
+	int rootlen;
+	char *c = NULL;
+	int alen = sizeof(ATTIC) - 1;
+
+	*pathstore = xstrdup(CVSname);
+	if ((c = strrchr(*pathstore, '/')) != NULL) {
+	    if (c - *pathstore >= alen) {
+		if (!strncmp(c - alen, ATTIC, alen)) {
+		    while (*c != '\0') {
+			*(c - alen) = *c;
+			c++;
+		    }
+		    *(c - alen) = '\0';
+		}
+	    }
+	}
+
+	rootlen = strlen(current_parsed_root->directory);
+	if (!strncmp(*pathstore, current_parsed_root->directory, rootlen) &&
+	    (*pathstore)[rootlen] == '/')
+	    CVSname = (*pathstore + rootlen + 1);
+	else
+	    CVSname = (*pathstore);
+    }
+    return CVSname;
 }
Index: src/rcs.h
diff -u src/contrib/cvs/src/rcs.h:1.1.1.9 src/contrib/cvs/src/rcs.h:1.9
--- src/contrib/cvs/src/rcs.h:1.1.1.9	Fri Aug 10 04:43:21 2001
+++ src/rcs.h	Fri Aug 10 04:53:06 2001
@@ -6,6 +6,8 @@
  * specified in the README file that comes with the CVS source distribution.
  * 
  * RCS source control definitions needed by rcs.c and friends
+ *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/rcs.h,v 1.9 2001/08/10 09:53:06 peter Exp $
  */
 
 /* Strings which indicate a conflict if they occur at the start of a line.  */
@@ -240,6 +242,8 @@
 void RCS_deltas PROTO ((RCSNode *, FILE *, struct rcsbuffer *, char *,
 			enum rcs_delta_op, char **, size_t *,
 			char **, size_t *));
+void RCS_setincexc PROTO ((const char *arg));
+void RCS_setlocalid PROTO ((const char *arg));
 char *make_file_label PROTO ((char *, char *, RCSNode *));
 
 extern int preserve_perms;
Index: src/rcscmds.c
diff -u src/contrib/cvs/src/rcscmds.c:1.1.1.8 src/contrib/cvs/src/rcscmds.c:1.8
--- src/contrib/cvs/src/rcscmds.c:1.1.1.8	Fri Aug 10 04:43:21 2001
+++ src/rcscmds.c	Fri Aug 10 04:53:06 2001
@@ -7,6 +7,8 @@
  * 
  * The functions in this file provide an interface for performing 
  * operations directly on RCS files. 
+ *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/rcscmds.c,v 1.8 2001/08/10 09:53:06 peter Exp $
  */
 
 #include "cvs.h"
Index: src/recurse.c
diff -u src/contrib/cvs/src/recurse.c:1.1.1.10 src/contrib/cvs/src/recurse.c:1.9
--- src/contrib/cvs/src/recurse.c:1.1.1.10	Mon Sep  2 00:49:57 2002
+++ src/recurse.c	Mon Sep  2 00:57:14 2002
@@ -6,6 +6,7 @@
  * 
  * General recursion handler
  * 
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/recurse.c,v 1.9 2002/09/02 05:57:14 peter Exp $
  */
 
 #include "cvs.h"
Index: src/server.c
diff -u src/contrib/cvs/src/server.c:1.1.1.11 src/contrib/cvs/src/server.c:1.16
--- src/contrib/cvs/src/server.c:1.1.1.11	Mon Sep  2 00:49:59 2002
+++ src/server.c	Mon Sep  2 00:57:14 2002
@@ -8,6 +8,10 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.  */
 
+/*
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/server.c,v 1.16 2002/09/02 05:57:14 peter Exp $
+ */
+
 #include <assert.h>
 #include "cvs.h"
 #include "watch.h"
@@ -782,6 +786,9 @@
        nothing.  But for rsh, we need to do it now.  */
     parse_config (current_parsed_root->directory);
 
+    /* Now is a good time to read CVSROOT/options too. */
+    parseopts(current_parsed_root->directory);
+
     path = malloc (strlen (current_parsed_root->directory)
 		   + sizeof (CVSROOTADM)
 		   + 2);
@@ -5561,7 +5568,10 @@
        password file.  If so, that's enough to authenticate with.  If
        not, we'll check /etc/passwd. */
 
-    rc = check_repository_password (username, password, repository,
+    if (require_real_user)
+	rc = 0;		/* "not found" */
+    else
+	rc = check_repository_password (username, password, repository,
 				    &host_user);
 
     if (rc == 2)
Index: src/update.c
diff -u src/contrib/cvs/src/update.c:1.1.1.11 src/contrib/cvs/src/update.c:1.10
--- src/contrib/cvs/src/update.c:1.1.1.11	Mon Sep  2 00:50:00 2002
+++ src/update.c	Mon Sep  2 00:57:14 2002
@@ -31,6 +31,8 @@
  * versions, these are updated too.  If the -d option was specified, new
  * directories added to the repository are automatically created and updated
  * as well.
+ *
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/update.c,v 1.10 2002/09/02 05:57:14 peter Exp $
  */
 
 #include "cvs.h"
@@ -96,10 +98,10 @@
 static int aflag = 0;
 static int toss_local_changes = 0;
 static int force_tag_match = 1;
+static int pull_template = 0;
 static int update_build_dirs = 0;
 static int update_prune_dirs = 0;
 static int pipeout = 0;
-static int dotemplate = 0;
 #ifdef SERVER_SUPPORT
 static int patches = 0;
 static int rcs_diff_patches = 0;
@@ -124,6 +126,7 @@
     "\t-j rev\tMerge in changes made between current revision and rev.\n",
     "\t-I ign\tMore files to ignore (! to reset).\n",
     "\t-W spec\tWrappers specification line.\n",
+    "\t-T\tCreate CVS/Template.\n",
     "(Specify the --help global option for a list of other help options)\n",
     NULL
 };
@@ -139,6 +142,7 @@
     int c, err;
     int local = 0;			/* recursive by default */
     int which;				/* where to look for files and dirs */
+    int xpull_template = 0;
 
     if (argc == -1)
 	usage (update_usage);
@@ -148,7 +152,7 @@
 
     /* parse the args */
     optind = 0;
-    while ((c = getopt (argc, argv, "+ApCPflRQqduk:r:D:j:I:W:")) != -1)
+    while ((c = getopt (argc, argv, "+ApCPflRQTqduk:r:D:j:I:W:")) != -1)
     {
 	switch (c)
 	{
@@ -186,6 +190,9 @@
 			   "-q or -Q must be specified before \"%s\"",
 			   command_name);
 		break;
+	    case 'T':
+		xpull_template = 1;
+		break;
 	    case 'd':
 		update_build_dirs = 1;
 		break;
@@ -410,7 +417,8 @@
     /* call the command line interface */
     err = do_update (argc, argv, options, tag, date, force_tag_match,
 		     local, update_build_dirs, aflag, update_prune_dirs,
-		     pipeout, which, join_rev1, join_rev2, (char *) NULL, 1);
+		     pipeout, which, join_rev1, join_rev2, (char *) NULL,
+		     xpull_template);
 
     /* free the space Make_Date allocated if necessary */
     if (date != NULL)
@@ -425,7 +433,7 @@
 int
 do_update (argc, argv, xoptions, xtag, xdate, xforce, local, xbuild, xaflag,
 	   xprune, xpipeout, which, xjoin_rev1, xjoin_rev2, preload_update_dir,
-	   xdotemplate)
+	   xpull_template)
     int argc;
     char **argv;
     char *xoptions;
@@ -441,7 +449,7 @@
     char *xjoin_rev1;
     char *xjoin_rev2;
     char *preload_update_dir;
-    int xdotemplate;
+    int xpull_template;
 {
     int err = 0;
     char *cp;
@@ -455,7 +463,7 @@
     aflag = xaflag;
     update_prune_dirs = xprune;
     pipeout = xpipeout;
-    dotemplate = xdotemplate;
+    pull_template = xpull_template;
 
     /* setup the join support */
     join_rev1 = xjoin_rev1;
@@ -595,7 +603,7 @@
 	&& tag != NULL
 	&& finfo->rcs != NULL)
     {
-	char *rev = RCS_getversion (finfo->rcs, tag, NULL, 1, NULL);
+	char *rev = RCS_getversion (finfo->rcs, tag, date, 1, NULL);
 	if (rev != NULL
 	    && !RCS_nodeisbranch (finfo->rcs, tag))
 	    nonbranch = 1;
@@ -966,7 +974,7 @@
 			     via WriteTag.  */
 			  0,
 			  0,
-			  dotemplate);
+			  pull_template);
 	    rewrite_tag = 1;
 	    nonbranch = 0;
 	    Subdir_Register (entries, (char *) NULL, dir);
@@ -1023,6 +1031,12 @@
 	    WriteTag (dir, tag, date, 0, update_dir, repository);
 	    rewrite_tag = 1;
 	    nonbranch = 0;
+	}
+
+	/* keep the CVS/Template file current */
+	if (pull_template) 
+	{
+	    WriteTemplate (dir, update_dir);
 	}
 
 	/* initialize the ignore list for this directory */
Index: src/update.h
diff -u src/contrib/cvs/src/update.h:1.1.1.3 src/contrib/cvs/src/update.h:1.2
--- src/contrib/cvs/src/update.h:1.1.1.3	Fri Aug 10 04:43:21 2001
+++ src/update.h	Sat Sep 15 00:57:52 2001
@@ -10,10 +10,14 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.  */
 
+/*
+ * FreeBSD: /cvs/cvsup/ncvs/src/contrib/cvs/src/update.h,v 1.2 2001/09/15 05:57:52 dillon Exp $
+ */
+
 int do_update PROTO((int argc, char *argv[], char *xoptions, char *xtag,
 	       char *xdate, int xforce, int local, int xbuild,
 	       int xaflag, int xprune, int xpipeout, int which,
 	       char *xjoin_rev1, char *xjoin_rev2, char *preload_update_dir,
-	       int xdotemplate));
+	       int xpull_template));
 int joining PROTO((void));
 extern int isemptydir PROTO ((char *dir, int might_not_exist));
Index: src/prepend_args.c
diff -u /dev/null src/gnu/usr.bin/cvs/cvs/prepend_args.c:1.3
--- /dev/null	Wed Sep 11 20:31:52 2002
+++ src/prepend_args.c	Mon Sep  2 01:09:03 2002
@@ -0,0 +1,86 @@
+/* prepend_args.c - utilility programs for manpiulating argv[]
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
+
+/* FreeBSD: /cvs/cvsup/ncvs/src/gnu/usr.bin/cvs/cvs/prepend_args.c,v 1.3 2002/09/02 06:09:03 peter Exp $ */
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include "cvs.h"
+#include "prepend_args.h"
+
+
+/* Find the white-space-separated options specified by OPTIONS, and
+   using BUF to store copies of these options, set ARGV[0], ARGV[1],
+   etc. to the option copies.  Return the number N of options found.
+   Do not set ARGV[N] to NULL.  If ARGV is NULL, do not store ARGV[0]
+   etc.  Backslash can be used to escape whitespace (and backslashes).  */
+static int
+prepend_args (options, buf, argv)
+     char const *options;
+     char *buf;
+     char **argv;
+{
+  char const *o = options;
+  char *b = buf;
+  int n = 0;
+
+  for (;;)
+    {
+      while (isspace ((unsigned char) *o))
+	o++;
+      if (!*o)
+	return n;
+      if (argv)
+	argv[n] = b;
+      n++;
+
+      do
+	if ((*b++ = *o++) == '\\' && *o)
+	  b[-1] = *o++;
+      while (*o && ! isspace ((unsigned char) *o));
+
+      *b++ = '\0';
+    }
+}
+
+/* Prepend the whitespace-separated options in OPTIONS to the argument
+   vector of a main program with argument count *PARGC and argument
+   vector *PARGV.  */
+void
+prepend_default_options (options, pargc, pargv)
+     char const *options;
+     int *pargc;
+     char ***pargv;
+{
+  if (options)
+    {
+      char *buf = xmalloc (strlen (options) + 1);
+      int prepended = prepend_args (options, buf, (char **) NULL);
+      int argc = *pargc;
+      char * const *argv = *pargv;
+      char **pp = (char **) xmalloc ((prepended + argc + 1) * sizeof *pp);
+      *pargc = prepended + argc;
+      *pargv = pp;
+      *pp++ = *argv++;
+      pp += prepend_args (options, buf, pp);
+      while ((*pp++ = *argv++))
+	continue;
+    }
+}
Index: src/prepend_args.h
diff -u /dev/null src/gnu/usr.bin/cvs/cvs/prepend_args.h:1.2
--- /dev/null	Wed Sep 11 20:31:52 2002
+++ src/prepend_args.h	Mon Sep  2 01:09:03 2002
@@ -0,0 +1,26 @@
+/* prepend_args.h - utilility programs for manpiulating argv[]
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
+
+/* FreeBSD: /cvs/cvsup/ncvs/src/gnu/usr.bin/cvs/cvs/prepend_args.h,v 1.2 2002/09/02 06:09:03 peter Exp $ */
+
+/* This code, taken from GNU Grep, originally used the "PARAM" macro, as the
+   current GNU coding standards requires.  Older GNU code used the "PROTO"
+   macro, before the GNU coding standards replaced it.  We use the older
+   form here to keep from having to include another file in cvs/src/main.c.  */
+
+void prepend_default_options PROTO ((char const *, int *, char ***));