-
Notifications
You must be signed in to change notification settings - Fork 0
/
co.c
executable file
·784 lines (697 loc) · 22.6 KB
/
co.c
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
/* Copyright (C) 1982, 1988, 1989 Walter Tichy
Copyright 1990 by Paul Eggert
Distributed under license by the Free Software Foundation, Inc.
This file is part of RCS.
RCS 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 1, or (at your option)
any later version.
RCS 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 RCS; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
Report problems and direct all questions to:
rcs-bugs@cs.purdue.edu
*/
/*
* RCS checkout operation
*/
/*****************************************************************************
* check out revisions from RCS files
*****************************************************************************
*/
/* $Log: co.c,v $
* Revision 5.10 1991/01/30 14:21:32 apratt
* CI with RCS version 5
*
* Revision 5.9 91/01/30 12:02:34 apratt
* Changed RCS5AKP1 to RCS5AP1
*
* Revision 5.8 91/01/29 17:45:24 apratt
* Added RCS5AKP1 to usage message
*
* Revision 5.7 91/01/11 12:45:34 apratt
* First version that compiles.
*
* Revision 5.6 90/12/04 05:18:38 eggert
* checked in with -k by apratt at 91.01.10.13.14.50.
*
* Revision 5.6 1990/12/04 05:18:38 eggert
* Don't checkaccesslist() unless necessary.
* Use -I for prompts and -q for diagnostics.
*
* Revision 5.5 1990/11/01 05:03:26 eggert
* Fix -j. Add -I.
*
* Revision 5.4 1990/10/04 06:30:11 eggert
* Accumulate exit status across files.
*
* Revision 5.3 1990/09/11 02:41:09 eggert
* co -kv yields a readonly working file.
*
* Revision 5.2 1990/09/04 08:02:13 eggert
* Standardize yes-or-no procedure.
*
* Revision 5.0 1990/08/22 08:10:02 eggert
* Permit multiple locks by same user. Add setuid support.
* Remove compile-time limits; use malloc instead.
* Permit dates past 1999/12/31. Switch to GMT.
* Make lock and temp files faster and safer.
* Ansify and Posixate. Add -k, -V. Remove snooping. Tune.
*
* Revision 4.7 89/05/01 15:11:41 narten
* changed copyright header to reflect current distribution rules
*
* Revision 4.6 88/08/09 19:12:15 eggert
* Fix "co -d" core dump; rawdate wasn't always initialized.
* Use execv(), not system(); fix putchar('\0') and diagnose() botches; remove lint
*
* Revision 4.5 87/12/18 11:35:40 narten
* lint cleanups (from Guy Harris)
*
* Revision 4.4 87/10/18 10:20:53 narten
* Updating version numbers changes relative to 1.1, are actually
* relative to 4.2
*
* Revision 1.3 87/09/24 13:58:30 narten
* Sources now pass through lint (if you ignore printf/sprintf/fprintf
* warnings)
*
* Revision 1.2 87/03/27 14:21:38 jenkins
* Port to suns
*
* Revision 4.2 83/12/05 13:39:48 wft
* made rewriteflag external.
*
* Revision 4.1 83/05/10 16:52:55 wft
* Added option -u and -f.
* Added handling of default branch.
* Replaced getpwuid() with getcaller().
* Removed calls to stat(); now done by pairfilenames().
* Changed and renamed rmoldfile() to rmworkfile().
* Replaced catchints() calls with restoreints(), unlink()--link() with rename();
*
* Revision 3.7 83/02/15 15:27:07 wft
* Added call to fastcopy() to copy remainder of RCS file.
*
* Revision 3.6 83/01/15 14:37:50 wft
* Added ignoring of interrupts while RCS file is renamed; this avoids
* deletion of RCS files during the unlink/link window.
*
* Revision 3.5 82/12/08 21:40:11 wft
* changed processing of -d to use DATEFORM; removed actual from
* call to preparejoin; re-fixed printing of done at the end.
*
* Revision 3.4 82/12/04 18:40:00 wft
* Replaced getdelta() with gettree(), SNOOPDIR with SNOOPFILE.
* Fixed printing of "done".
*
* Revision 3.3 82/11/28 22:23:11 wft
* Replaced getlogin() with getpwuid(), flcose() with ffclose(),
* %02d with %.2d, mode generation for working file with WORKMODE.
* Fixed nil printing. Fixed -j combined with -l and -p, and exit
* for non-existing revisions in preparejoin().
*
* Revision 3.2 82/10/18 20:47:21 wft
* Mode of working file is now maintained even for co -l, but write permission
* is removed.
* The working file inherits its mode from the RCS file, plus write permission
* for the owner. The write permission is not given if locking is strict and
* co does not lock.
* An existing working file without write permission is deleted automatically.
* Otherwise, co asks (empty answer: abort co).
* Call to getfullRCSname() added, check for write error added, call
* for getlogin() fixed.
*
* Revision 3.1 82/10/13 16:01:30 wft
* fixed type of variables receiving from getc() (char -> int).
* removed unused variables.
*/
#include "rcsbase.h"
static const char *getancestor P((const char*,const char*));
static int buildjoin P((const char*));
static int creatempty P((void));
static int fixworkmode P((const char*));
static int preparejoin P((void));
static int rmlock P((const struct hshentry*));
static int rmworkfile P((void));
static void cleanup P((void));
static const char quietarg[] = "-q";
static const char *join, *versionarg;
static const char *joinlist[joinlength];/* revisions to be joined */
static int exitstatus;
static int forceflag, tostdout;
static int lastjoin; /* index of last element in joinlist */
static int lockflag; /* -1 -> unlock, 0 -> do nothing, 1 -> lock */
static struct hshentries *gendeltas; /* deltas to be generated */
static struct hshentry *targetdelta; /* final delta to be generated */
mainProg(coId, "co", "$Id: co.c,v 5.10 1991/01/30 14:21:32 apratt Exp $")
{
static const char cmdusage[] =
"\nRCS5AP1 as modified for TOS by Allan Pratt, atari!apratt\nco usage: co -{flpqru}[rev] -ddate -jjoinlist -sstate -w[login] -Vn file ...";
const char *author, *date, *rev, *state;
const char *neworkfilename;
int changelock; /* 1 if a lock has been changed, -1 if error */
int expmode, r;
struct buf numericrev; /* expanded revision number */
char finaldate[datesize];
initid();
catchints();
author = date = rev = state = nil;
bufautobegin(&numericrev);
expmode = -1;
versionarg = nil;
while (--argc,++argv, argc>=1 && ((*argv)[0] == '-')) {
switch ((*argv)[1]) {
case 'r':
revno: if ((*argv)[2]!='\0') {
if (rev) warn("redefinition of revision number");
rev = (*argv)+2;
}
break;
case 'f':
forceflag=true;
goto revno;
case 'l':
if (lockflag < 0) {
warn("-l overrides -u.");
}
lockflag = 1;
goto revno;
case 'u':
if (0 < lockflag) {
warn("-l overrides -u.");
}
lockflag = -1;
goto revno;
case 'p':
tostdout=true;
goto revno;
case 'I':
interactiveflag = true;
goto revno;
case 'q':
quietflag=true;
goto revno;
case 'd':
if (date)
redefined('d');
str2date(*argv+2, finaldate);
date=finaldate;
break;
case 'j':
if ((*argv)[2]!='\0'){
if (join) redefined('j');
join = (*argv)+2;
}
break;
case 's':
if ((*argv)[2]!='\0'){
if (state) redefined('s');
state = (*argv)+2;
}
break;
case 'w':
if (author) redefined('w');
if ((*argv)[2]!='\0')
author = (*argv)+2;
else
author = getcaller();
break;
case 'V':
if (versionarg) redefined('V');
versionarg = *argv;
setRCSversion(versionarg);
break;
case 'k': /* set keyword expand mode */
if (0 <= expmode) redefined('k');
if (0 <= (expmode = str2expmode(*argv+2)))
break;
/* fall into */
default:
faterror("unknown option: %s%s", *argv, cmdusage);
};
} /* end of option processing */
if (argc<1) faterror("no input file%s", cmdusage);
/* now handle all filenames */
do {
finptr=frewrite=NULL;
fcopy = foutptr = NULL;
ffree();
if (!pairfilenames(argc, argv, lockflag?rcswriteopen:rcsreadopen, true, tostdout))
continue;
/* now RCSfilename contains the name of the RCS file, and finptr
* the file descriptor. If tostdout is false, workfilename contains
* the name of the working file, otherwise undefined (not nil!).
* Also, RCSstat has been set.
*/
diagnose("%s --> %s\n", RCSfilename,tostdout?"stdout":workfilename);
if (!tostdout) {
if (!getworkstat()) continue; /* give up */
if (!initeditfiles(workfilename)) {
if (errno == EACCES)
error("%s: parent directory isn't writable",
workfilename
);
else
eerror(resultfile);
continue;
}
}
if (0 <= expmode)
Expand = expmode;
if (0 < lockflag && Expand == VAL_EXPAND) {
error("cannot combine -kv and -l");
continue;
}
gettree(); /* reads in the delta tree */
if (Head==nil) {
/* no revisions; create empty file */
diagnose("no revisions present; generating empty revision 0.0\n");
if (!tostdout)
if (!creatempty()) continue;
/* Can't reserve a delta, so don't call addlock */
} else {
if (rev!=nil) {
/* expand symbolic revision number */
if (!expandsym(rev, &numericrev))
continue;
} else
switch (lockflag<0 ? findlock(false,&targetdelta) : 0) {
default:
continue;
case 0:
bufscpy(&numericrev, Dbranch?Dbranch:"");
break;
case 1:
bufscpy(&numericrev, targetdelta->num);
break;
}
/* get numbers of deltas to be generated */
if (!(targetdelta=genrevs(numericrev.string,date,author,state,&gendeltas)))
continue;
/* check reservations */
changelock = 0;
if (lockflag) {
changelock =
lockflag<0 ? rmlock(targetdelta) : addlock(targetdelta);
if (changelock) {
if (changelock<0 || !checkaccesslist())
continue;
} else {
ffclose(frewrite); frewrite=NULL;
seteid();
ignoreints();
r = unlink(newRCSfilename);
keepdirtemp(newRCSfilename);
restoreints();
setrid();
if (r != 0) {
eerror(RCSfilename);
continue;
}
}
}
if (join && !preparejoin()) continue;
diagnose("revision %s%s\n",targetdelta->num,
0<lockflag ? " (locked)" :
lockflag<0 ? " (unlocked)" : "");
/* remove old working file if necessary */
if (!tostdout)
if (!rmworkfile()) continue;
/* prepare for rewriting the RCS file */
if (changelock) {
putadmin(frewrite);
puttree(Head,frewrite);
aprintf(frewrite, "\n\n%s%c",Kdesc,nextc);
foutptr = frewrite;
}
/* skip description */
getdesc(false); /* don't echo*/
locker_expansion = 0 < lockflag;
if (!(neworkfilename=buildrevision(gendeltas,targetdelta,
tostdout,Expand!=OLD_EXPAND)))
continue;
if (changelock && !nerror) {
/* rewrite the rest of the RCSfile */
fastcopy(finptr,frewrite);
ffclose(finptr); finptr=NULL; /*Help the file system.*/
ffclose(frewrite); frewrite=NULL;
seteid();
if ((r = chmod(newRCSfilename, RCSstat.st_mode & ~(S_IWUSR|S_IWGRP|S_IWOTH))) == 0) {
ignoreints();
r = re_name(newRCSfilename,RCSfilename);
keepdirtemp(newRCSfilename);
restoreints();
}
setrid();
if (r != 0) {
eerror(RCSfilename);
error("saved in %s", newRCSfilename);
dirtempunlink();
break;
}
}
if (join) {
if (!buildjoin(neworkfilename)) continue;
}
if (!tostdout) {
if (!fixworkmode(neworkfilename))
continue;
ignoreints();
r = re_name(neworkfilename,workfilename);
keepdirtemp(neworkfilename);
restoreints();
if (r != 0) {
eerror(workfilename);
error("see %s", neworkfilename);
continue;
}
}
}
if (!tostdout) diagnose("done\n");
} while (cleanup(),
++argv, --argc >=1);
tempunlink();
exitmain(exitstatus);
} /* end of main (co) */
static void
cleanup()
{
if (nerror) exitstatus = EXIT_FAILURE;
if (finptr) ffclose(finptr);
if (frewrite) ffclose(frewrite);
dirtempunlink();
}
#if lint
# define exiterr coExit
#endif
exiting void
exiterr()
{
dirtempunlink();
tempunlink();
_exit(EXIT_FAILURE);
}
/*****************************************************************
* The following routines are auxiliary routines
*****************************************************************/
static int
rmworkfile()
/* Function: prepares to remove workfilename, if it exists, and if
* it is read-only.
* Otherwise (file writable):
* if !quietmode asks the user whether to really delete it (default: fail);
* otherwise failure.
* Returns 0 on failure to get permission, -1 if there's nothing to remove,
* 1 if there is a file to remove.
*/
{
if (haveworkstat) /* File doesn't exist; set by pairfilenames*/
return -1;
if (workstat.st_mode&(S_IWUSR|S_IWGRP|S_IWOTH) && !forceflag) {
/* File is writable */
if (!yesorno(false, "writable %s exists; remove it? [ny](n): ",
workfilename
)) {
error(!quietflag && ttystdin()
? "checkout aborted"
: "writable %s exists; checkout aborted", workfilename);
return 0;
}
}
/* Actual unlink is done later by caller. */
return 1;
}
static int
fixworkmode(f)
const char *f;
{
if (
chmod(f, WORKMODE(RCSstat.st_mode,
!(Expand==VAL_EXPAND || lockflag<=0 && StrictLocks)
)) < 0
) {
eerror(workfilename);
return false;
}
return true;
}
static int
creatempty()
/* Function: creates an empty working file.
* First, removes an existing working file with rmworkfile().
*/
{
int fdesc; /* file descriptor */
int s;
if (!(s = rmworkfile()))
return false;
if (0 < s && unlink(workfilename) != 0) {
eerror(workfilename);
return false;
}
fdesc=creat(workfilename,0);
if (fdesc < 0)
efaterror(workfilename);
VOID close(fdesc); /* empty file */
return fixworkmode(workfilename);
}
static int
rmlock(delta)
const struct hshentry *delta;
/* Function: removes the lock held by caller on delta.
* Returns -1 if someone else holds the lock,
* 0 if there is no lock on delta,
* and 1 if a lock was found and removed.
*/
{ register struct lock * next, * trail;
const char *num;
struct lock dummy;
int whomatch, nummatch;
num=delta->num;
dummy.nextlock=next=Locks;
trail = &dummy;
while (next!=nil) {
whomatch = strcmp(getcaller(), next->login);
nummatch=strcmp(num,next->delta->num);
if ((whomatch==0) && (nummatch==0)) break;
/*found a lock on delta by caller*/
if ((whomatch!=0)&&(nummatch==0)) {
error("revision %s locked by %s; use co -r or rcs -u",num,next->login);
return -1;
}
trail=next;
next=next->nextlock;
}
if (next!=nil) {
/*found one; delete it */
trail->nextlock=next->nextlock;
Locks=dummy.nextlock;
next->delta->lockedby=nil; /* reset locked-by */
return 1; /*success*/
} else return 0; /*no lock on delta*/
}
/*****************************************************************
* The rest of the routines are for handling joins
*****************************************************************/
static const char *
addjoin(joinrev)
char *joinrev;
/* Add joinrev's number to joinlist, yielding address of char past joinrev,
* or nil if no such revision exists.
*/
{
register char *j;
register const struct hshentry *d;
char terminator;
struct buf numrev;
struct hshentries *joindeltas;
j = joinrev;
for (;;) {
switch (*j++) {
default:
continue;
case 0:
case ' ': case '\t': case '\n':
case ':': case ',': case ';':
break;
}
break;
}
terminator = *--j;
*j = 0;
bufautobegin(&numrev);
d = 0;
if (expandsym(joinrev, &numrev))
d = genrevs(numrev.string,(char*)nil,(char*)nil,(char*)nil,&joindeltas);
bufautoend(&numrev);
*j = terminator;
if (d) {
joinlist[++lastjoin] = d->num;
return j;
}
return nil;
}
static int
preparejoin()
/* Function: Parses a join list pointed to by join and places pointers to the
* revision numbers into joinlist.
*/
{
register const char *j;
j=join;
lastjoin= -1;
for (;;) {
while ((*j==' ')||(*j=='\t')||(*j==',')) j++;
if (*j=='\0') break;
if (lastjoin>=joinlength-2) {
error("too many joins");
return(false);
}
if (!(j = addjoin(j))) return false;
while ((*j==' ') || (*j=='\t')) j++;
if (*j == ':') {
j++;
while((*j==' ') || (*j=='\t')) j++;
if (*j!='\0') {
if (!(j = addjoin(j))) return false;
} else {
error("join pair incomplete");
return false;
}
} else {
if (lastjoin==0) { /* first pair */
/* common ancestor missing */
joinlist[1]=joinlist[0];
lastjoin=1;
/*derive common ancestor*/
if (!(joinlist[0] = getancestor(targetdelta->num,joinlist[1])))
return false;
} else {
error("join pair incomplete");
return false;
}
}
}
if (lastjoin<1) {
error("empty join");
return false;
} else return true;
}
static const char *
getancestor(r1, r2)
const char *r1, *r2;
/* Yield the common ancestor of r1 and r2 if successful, nil otherwise.
* Work reliably only if r1 and r2 are not branch numbers.
*/
{
static struct buf t1, t2;
unsigned l1, l2, l3;
const char *r;
l1 = countnumflds(r1);
l2 = countnumflds(r2);
if ((2<l1 || 2<l2) && cmpnum(r1,r2)!=0) {
/* not on main trunk or identical */
l3 = 0;
while (cmpnumfld(r1, r2, l3+1)==0 && cmpnumfld(r1, r2, l3+2)==0)
l3 += 2;
/* This will terminate since r1 and r2 are not the same; see above. */
if (l3==0) {
/* no common prefix; common ancestor on main trunk */
VOID partialno(&t1, r1, l1>2 ? (unsigned)2 : l1);
VOID partialno(&t2, r2, l2>2 ? (unsigned)2 : l2);
r = cmpnum(t1.string,t2.string)<0 ? t1.string : t2.string;
if (cmpnum(r,r1)!=0 && cmpnum(r,r2)!=0)
return r;
} else if (cmpnumfld(r1, r2, l3+1)!=0)
return partialno(&t1,r1,l3);
}
error("common ancestor of %s and %s undefined", r1, r2);
return nil;
}
static int
buildjoin(initialfile)
const char *initialfile;
/* Function: merge pairs of elements in joinlist into initialfile
* If tostdout is set, copy result to stdout.
* All unlinking of initialfile, rev2, and rev3 should be done by *tempunlink().
*/
{
struct buf commarg;
struct buf subs;
const char *rev2, *rev3;
int i;
int status;
const char *cov[8], *mergev[12];
const char **p;
bufautobegin(&commarg);
bufautobegin(&subs);
rev2 = maketemp(0);
rev3 = maketemp(3); /* buildrevision() may use 1 and 2 */
cov[0] = nil;
/* cov[1] setup below */
cov[2] = CO;
/* cov[3] setup below */
p = &cov[4];
if (versionarg) *p++ = versionarg;
*p++ = quietarg;
*p++ = RCSfilename;
*p = nil;
mergev[0] = nil;
mergev[1] = nil;
mergev[2] = MERGE;
mergev[3] = mergev[5] = "-L";
/* rest of mergev setup below */
i=0;
while (i<lastjoin) {
/*prepare marker for merge*/
if (i==0)
bufscpy(&subs, targetdelta->num);
else {
bufscat(&subs, ",");
bufscat(&subs, joinlist[i-2]);
bufscat(&subs, ":");
bufscat(&subs, joinlist[i-1]);
}
diagnose("revision %s\n",joinlist[i]);
bufscpy(&commarg, "-p");
bufscat(&commarg, joinlist[i]);
cov[1] = rev2;
cov[3] = commarg.string;
if (runv(cov))
goto badmerge;
diagnose("revision %s\n",joinlist[i+1]);
bufscpy(&commarg, "-p");
bufscat(&commarg, joinlist[i+1]);
cov[1] = rev3;
cov[3] = commarg.string;
if (runv(cov))
goto badmerge;
diagnose("merging...\n");
mergev[4] = subs.string;
mergev[6] = joinlist[i+1];
p = &mergev[7];
if (quietflag) *p++ = quietarg;
if (lastjoin<=i+2 && tostdout) *p++ = "-p";
*p++ = initialfile;
*p++ = rev2;
*p++ = rev3;
*p = nil;
status = runv(mergev);
if (!WIFEXITED(status) || 1<WEXITSTATUS(status))
goto badmerge;
i=i+2;
}
bufautoend(&commarg);
bufautoend(&subs);
return true;
badmerge:
nerror++;
bufautoend(&commarg);
bufautoend(&subs);
return false;
}