=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/rcsprog.c,v retrieving revision 1.7 retrieving revision 1.8 diff -c -r1.7 -r1.8 *** src/usr.bin/rcs/rcsprog.c 2005/09/20 05:03:02 1.7 --- src/usr.bin/rcs/rcsprog.c 2005/09/29 00:20:22 1.8 *************** *** 1,4 **** ! /* $OpenBSD: rcsprog.c,v 1.7 2005/09/20 05:03:02 joris Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: rcsprog.c,v 1.8 2005/09/29 00:20:22 joris Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau * All rights reserved. *************** *** 26,31 **** --- 26,32 ---- #include #include + #include #include #include *************** *** 94,100 **** "[-e users] [-k opt] file ...\n", __progname); } - /* * rcs_main() * --- 95,100 ---- *************** *** 105,114 **** rcs_main(int argc, char **argv) { int i, ch, flags, kflag, lkmode; ! char fpath[MAXPATHLEN]; char *oldfile, *alist, *comment, *elist, *unp, *sp; mode_t fmode; RCSFILE *file; kflag = lkmode = -1; fmode = 0; --- 105,115 ---- rcs_main(int argc, char **argv) { int i, ch, flags, kflag, lkmode; ! char fpath[MAXPATHLEN], filev[MAXPATHLEN]; char *oldfile, *alist, *comment, *elist, *unp, *sp; mode_t fmode; RCSFILE *file; + struct stat st; kflag = lkmode = -1; fmode = 0; *************** *** 181,187 **** * Our RCS API does not append the RCS_FILE_EXT extension * automaticly in rcs_open(), so we add it here. */ ! snprintf(fpath, sizeof(fpath), "%s%s", argv[i], RCS_FILE_EXT); printf("RCS file: %s\n", fpath); file = rcs_open(fpath, flags, fmode); --- 182,201 ---- * Our RCS API does not append the RCS_FILE_EXT extension * automaticly in rcs_open(), so we add it here. */ ! snprintf(filev, sizeof(filev), "%s%s", argv[i], RCS_FILE_EXT); ! if (stat(RCSDIR, &st) != -1) { ! strlcpy(fpath, RCSDIR, sizeof(fpath)); ! strlcat(fpath, "/", sizeof(fpath)); ! strlcat(fpath, filev, sizeof(fpath)); ! } else { ! strlcpy(fpath, filev, sizeof(filev)); ! } ! ! if (stat(fpath, &st) != -1) { ! errno = EEXIST; ! cvs_log(LP_ERRNO, "%s", fpath); ! continue; ! } printf("RCS file: %s\n", fpath); file = rcs_open(fpath, flags, fmode);