diff options
-rw-r--r-- | usr.bin/cvs/cvs.1 | 14 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.c | 16 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.h | 3 | ||||
-rw-r--r-- | usr.bin/cvs/repository.c | 5 |
4 files changed, 31 insertions, 7 deletions
diff --git a/usr.bin/cvs/cvs.1 b/usr.bin/cvs/cvs.1 index f4242efaedb..dcbe02110d3 100644 --- a/usr.bin/cvs/cvs.1 +++ b/usr.bin/cvs/cvs.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: cvs.1,v 1.100 2006/11/28 08:47:55 xsa Exp $ +.\" $OpenBSD: cvs.1,v 1.101 2006/12/11 07:59:18 xsa Exp $ .\" .\" Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> .\" Copyright (c) 2004-2006 Xavier Santolaria <xsa@openbsd.org> @@ -33,7 +33,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl flnQqrtvVw +.Op Fl flnQqRrtvVw .Op Fl d Ar root .Op Fl e Ar editor .Xo @@ -104,6 +104,11 @@ Only error messages will be displayed. .It Fl q Be quiet about reporting. This is the default. +.It Fl R +Permit checkout from a read-only repository. +See also +.Ev CVSREADONLYFS , +below. .It Fl r Extract files in read-only mode. .It Fl s Ar var Ns = Ns Ar val @@ -1712,6 +1717,11 @@ and If set, .Nm extracts files in read-only mode. +.It Ev CVSREADONLYFS +Permit checkout from a read-only repository. +See also +.Fl R , +above. .It Ev CVSROOT When set, this variable should contain the string pointing to the root directory of the CVS repository. diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c index 733e5c4c181..e42b776c44b 100644 --- a/usr.bin/cvs/cvs.c +++ b/usr.bin/cvs/cvs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.c,v 1.110 2006/11/28 13:31:19 xsa Exp $ */ +/* $OpenBSD: cvs.c,v 1.111 2006/12/11 07:59:18 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -44,6 +44,7 @@ int cvs_readrc = 1; /* read .cvsrc on startup */ int cvs_trace = 0; int cvs_nolog = 0; int cvs_readonly = 0; +int cvs_readonlyfs = 0; int cvs_nocase = 0; /* set to 1 to disable filename case sensitivity */ int cvs_noexec = 0; /* set to 1 to disable disk operations (-n option) */ int cvs_error = -1; /* set to the correct error code on failure */ @@ -111,7 +112,7 @@ void usage(void) { fprintf(stderr, - "Usage: %s [-flnQqrtvVw] [-d root] [-e editor] [-s var=val] " + "Usage: %s [-flnQqRrtvVw] [-d root] [-e editor] [-s var=val] " "[-T tmpdir] [-z level] command [...]\n", __progname); } @@ -144,6 +145,11 @@ main(int argc, char **argv) if ((envstr = getenv("CVSREAD")) != NULL) cvs_readonly = 1; + if ((envstr = getenv("CVSREADONLYFS")) != NULL) { + cvs_readonlyfs = 1; + cvs_nolog = 1; + } + if ((cvs_homedir = getenv("HOME")) == NULL) { if ((pw = getpwuid(getuid())) == NULL) fatal("getpwuid failed"); @@ -289,7 +295,7 @@ cvs_getopt(int argc, char **argv) int ret; char *ep; - while ((ret = getopt(argc, argv, "b:d:e:fHlnQqrs:T:tvVwz:")) != -1) { + while ((ret = getopt(argc, argv, "b:d:e:fHlnQqRrs:T:tvVwz:")) != -1) { switch (ret) { case 'b': /* @@ -322,6 +328,10 @@ cvs_getopt(int argc, char **argv) * Be quiet. This is the default in OpenCVS. */ break; + case 'R': + cvs_readonlyfs = 1; + cvs_nolog = 1; + break; case 'r': cvs_readonly = 1; break; diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h index 9d207c6762e..ba3b77f98ce 100644 --- a/usr.bin/cvs/cvs.h +++ b/usr.bin/cvs/cvs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.h,v 1.123 2006/11/27 14:19:53 xsa Exp $ */ +/* $OpenBSD: cvs.h,v 1.124 2006/12/11 07:59:18 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -287,6 +287,7 @@ extern int cvs_cmdop; extern int cvs_nocase; extern int cvs_noexec; extern int cvs_readonly; +extern int cvs_readonlyfs; extern int cvs_error; extern int cvs_server_active; diff --git a/usr.bin/cvs/repository.c b/usr.bin/cvs/repository.c index 2afaf0cc3cb..d2cd6958903 100644 --- a/usr.bin/cvs/repository.c +++ b/usr.bin/cvs/repository.c @@ -1,4 +1,4 @@ -/* $OpenBSD: repository.c,v 1.6 2006/11/28 14:49:58 xsa Exp $ */ +/* $OpenBSD: repository.c,v 1.7 2006/12/11 07:59:18 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -47,6 +47,9 @@ cvs_repository_lock(const char *repo) char fpath[MAXPATHLEN]; struct passwd *pw; + if (cvs_noexec == 1 || cvs_readonlyfs == 1) + return; + cvs_log(LP_TRACE, "cvs_repository_lock(%s)", repo); if (cvs_path_cat(repo, CVS_LOCK, fpath, sizeof(fpath)) >= sizeof(fpath)) |