diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2005-09-20 05:01:32 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2005-09-20 05:01:32 +0000 |
commit | 9ff7bad6f8ec20e4a9f35aab320187f11d7a4797 (patch) | |
tree | be194b5af08d922447f5daeb1d33bb33e31e313e /usr.bin/rcs/rcsprog.c | |
parent | d45b7aff79cc502a2beefca71005e859576e6e68 (diff) |
- create the correct RCS filename before calling rcs_open().
- don't bail out if we cannot open an RCS file, instead try to continue
with the others (if there are any).
Diffstat (limited to 'usr.bin/rcs/rcsprog.c')
-rw-r--r-- | usr.bin/rcs/rcsprog.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c index 14f10771a9b..a9e8ecfb9af 100644 --- a/usr.bin/rcs/rcsprog.c +++ b/usr.bin/rcs/rcsprog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsprog.c,v 1.5 2005/09/20 04:30:57 joris Exp $ */ +/* $OpenBSD: rcsprog.c,v 1.6 2005/09/20 05:01:31 joris Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -24,7 +24,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/types.h> +#include <sys/param.h> #include <sys/wait.h> #include <ctype.h> @@ -104,6 +104,7 @@ int 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; @@ -175,11 +176,16 @@ rcs_main(int argc, char **argv) } for (i = 0; i < argc; i++) { - printf("RCS file: %s\n", argv[i]); - file = rcs_open(argv[i], flags, fmode); - if (file == NULL) { - return (1); - } + /* + * 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); + if (file == NULL) + continue; /* entries to add to the access list */ if (alist != NULL) { |