=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/rcsprog.c,v retrieving revision 1.128 retrieving revision 1.129 diff -c -r1.128 -r1.129 *** src/usr.bin/rcs/rcsprog.c 2006/05/27 05:49:14 1.128 --- src/usr.bin/rcs/rcsprog.c 2006/05/28 18:55:55 1.129 *************** *** 1,4 **** ! /* $OpenBSD: rcsprog.c,v 1.128 2006/05/27 05:49:14 ray Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: rcsprog.c,v 1.129 2006/05/28 18:55:55 ray Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau * All rights reserved. *************** *** 175,187 **** int rcs_main(int argc, char **argv) { ! int fd, ofd; int i, j, ch, flags, kflag, lkmode; ! char fpath[MAXPATHLEN], ofpath[MAXPATHLEN]; char *logstr, *logmsg, *nflag, *descfile; char *alist, *comment, *elist, *lrev, *urev, *orange; mode_t fmode; ! RCSFILE *file, *oldfile; RCSNUM *logrev; struct rcs_access *acp; time_t rcs_mtime = -1; --- 175,188 ---- int rcs_main(int argc, char **argv) { ! int fd; int i, j, ch, flags, kflag, lkmode; ! const char *oldfilename; ! char fpath[MAXPATHLEN]; char *logstr, *logmsg, *nflag, *descfile; char *alist, *comment, *elist, *lrev, *urev, *orange; mode_t fmode; ! RCSFILE *file; RCSNUM *logrev; struct rcs_access *acp; time_t rcs_mtime = -1; *************** *** 192,215 **** flags = RCS_RDWR|RCS_PARSE_FULLY; lrev = urev = descfile = nflag = NULL; logstr = alist = comment = elist = orange = NULL; /* match GNU */ if (1 < argc && argv[1][0] != '-') warnx("warning: No options were given; " "this usage is obsolescent."); - ofd = -1; while ((ch = rcs_getopt(argc, argv, RCSPROG_OPTSTRING)) != -1) { switch (ch) { case 'A': ! /* XXX - Should we process this after all flags? */ ! ofd = rcs_choosefile(rcs_optarg, ofpath, ! sizeof(ofpath)); ! if (ofd < 0) { ! if (!(flags & RCS_CREATE)) ! warnx("%s", ofpath); ! exit(1); ! } rcsflags |= CO_ACLAPPEND; break; case 'a': --- 193,209 ---- flags = RCS_RDWR|RCS_PARSE_FULLY; lrev = urev = descfile = nflag = NULL; logstr = alist = comment = elist = orange = NULL; + oldfilename = NULL; /* match GNU */ if (1 < argc && argv[1][0] != '-') warnx("warning: No options were given; " "this usage is obsolescent."); while ((ch = rcs_getopt(argc, argv, RCSPROG_OPTSTRING)) != -1) { switch (ch) { case 'A': ! oldfilename = rcs_optarg; rcsflags |= CO_ACLAPPEND; break; case 'a': *************** *** 357,363 **** /* entries to add from */ if (rcsflags & CO_ACLAPPEND) { ! /* XXX */ if ((oldfile = rcs_open(ofpath, ofd, RCS_READ)) == NULL) exit(1); --- 351,366 ---- /* entries to add from */ if (rcsflags & CO_ACLAPPEND) { ! RCSFILE *oldfile; ! int ofd; ! char ofpath[MAXPATHLEN]; ! ! ofd = rcs_choosefile(oldfilename, ofpath, sizeof(ofpath)); ! if (ofd < 0) { ! if (!(flags & RCS_CREATE)) ! warnx("%s", ofpath); ! exit(1); ! } if ((oldfile = rcs_open(ofpath, ofd, RCS_READ)) == NULL) exit(1); *************** *** 365,371 **** rcs_access_add(file, acp->ra_name); rcs_close(oldfile); ! ofd = -1; } /* entries to add to the access list */ --- 368,374 ---- rcs_access_add(file, acp->ra_name); rcs_close(oldfile); ! (void)close(ofd); } /* entries to add to the access list */ *************** *** 508,516 **** if (orange != NULL) xfree(orange); - - if (ofd != -1) - (void)close(ofd); return (0); } --- 511,516 ----