summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/cvs/add.c8
-rw-r--r--usr.bin/cvs/admin.c6
-rw-r--r--usr.bin/cvs/annotate.c9
-rw-r--r--usr.bin/cvs/checkout.c4
-rw-r--r--usr.bin/cvs/commit.c8
-rw-r--r--usr.bin/cvs/cvs.c4
-rw-r--r--usr.bin/cvs/cvs.h4
-rw-r--r--usr.bin/cvs/diff.c9
-rw-r--r--usr.bin/cvs/edit.c14
-rw-r--r--usr.bin/cvs/file.c15
-rw-r--r--usr.bin/cvs/getlog.c9
-rw-r--r--usr.bin/cvs/import.c4
-rw-r--r--usr.bin/cvs/init.c7
-rw-r--r--usr.bin/cvs/release.c6
-rw-r--r--usr.bin/cvs/remove.c6
-rw-r--r--usr.bin/cvs/root.c20
-rw-r--r--usr.bin/cvs/status.c6
-rw-r--r--usr.bin/cvs/tag.c4
-rw-r--r--usr.bin/cvs/update.c6
-rw-r--r--usr.bin/cvs/util.c8
-rw-r--r--usr.bin/cvs/version.c8
-rw-r--r--usr.bin/cvs/watch.c10
22 files changed, 93 insertions, 82 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index 2008635d91b..329531110fc 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add.c,v 1.113 2016/10/13 20:51:25 fcambus Exp $ */
+/* $OpenBSD: add.c,v 1.114 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -91,7 +91,7 @@ cvs_add(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_add_remote;
flags = 0;
@@ -118,7 +118,7 @@ cvs_add(int argc, char **argv)
(added_files == 1) ? "this file" : "these files");
}
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_senddir(".");
cvs_client_send_files(argv, argc);
cvs_client_send_request("add");
@@ -364,7 +364,7 @@ add_directory(struct cvs_file *cf)
}
}
- if (added == 1 && current_cvsroot->cr_method == CVS_METHOD_LOCAL) {
+ if (added == 1 && cvsroot_is_local()) {
(void)xsnprintf(msg, sizeof(msg),
"Directory %s added to the repository", cf->file_rpath);
diff --git a/usr.bin/cvs/admin.c b/usr.bin/cvs/admin.c
index 89d10a8f0dd..81e6095fa04 100644
--- a/usr.bin/cvs/admin.c
+++ b/usr.bin/cvs/admin.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: admin.c,v 1.67 2016/10/13 20:51:25 fcambus Exp $ */
+/* $OpenBSD: admin.c,v 1.68 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
@@ -144,7 +144,7 @@ cvs_admin(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
@@ -200,7 +200,7 @@ cvs_admin(int argc, char **argv)
cvs_file_run(argc, argv, &cr);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
cvs_client_send_request("admin");
diff --git a/usr.bin/cvs/annotate.c b/usr.bin/cvs/annotate.c
index 4c84cfc1d02..b177f9d25a6 100644
--- a/usr.bin/cvs/annotate.c
+++ b/usr.bin/cvs/annotate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: annotate.c,v 1.68 2017/05/31 16:14:37 joris Exp $ */
+/* $OpenBSD: annotate.c,v 1.69 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2007 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -104,7 +104,7 @@ cvs_annotate(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
@@ -130,15 +130,14 @@ cvs_annotate(int argc, char **argv)
cr.flags = flags;
- if (cvs_cmdop == CVS_OP_ANNOTATE ||
- current_cvsroot->cr_method == CVS_METHOD_LOCAL) {
+ if (cvs_cmdop == CVS_OP_ANNOTATE || cvsroot_is_local()) {
if (argc > 0)
cvs_file_run(argc, argv, &cr);
else
cvs_file_run(1, &arg, &cr);
}
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index 182a2f5df66..8fa45fede5d 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.170 2015/11/05 09:48:21 nicm Exp $ */
+/* $OpenBSD: checkout.c,v 1.171 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -243,7 +243,7 @@ checkout_check_repository(int argc, char **argv)
build_dirs = print_stdout ? 0 : 1;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
if (cvs_specified_tag != NULL)
diff --git a/usr.bin/cvs/commit.c b/usr.bin/cvs/commit.c
index d15aaec8d1c..c2b39832062 100644
--- a/usr.bin/cvs/commit.c
+++ b/usr.bin/cvs/commit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commit.c,v 1.157 2017/05/31 16:48:16 joris Exp $ */
+/* $OpenBSD: commit.c,v 1.158 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -135,7 +135,7 @@ cvs_commit(int argc, char **argv)
if (RB_EMPTY(&files_affected))
return (0);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
if (logmsg == NULL) {
logmsg = cvs_logmsg_create(NULL, &files_added,
&files_removed, &files_modified);
@@ -308,7 +308,7 @@ cvs_commit_check_files(struct cvs_file *cf)
cvs_log(LP_TRACE, "cvs_commit_check_files(%s)", cf->file_path);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL)
+ if (cvsroot_is_remote())
cvs_remote_classify_file(cf);
else
cvs_file_classify(cf, cvs_directory_tag);
@@ -355,7 +355,7 @@ cvs_commit_check_files(struct cvs_file *cf)
return;
}
- if (current_cvsroot->cr_method == CVS_METHOD_LOCAL) {
+ if (cvsroot_is_local()) {
tag = cvs_directory_tag;
if (cf->file_ent != NULL)
tag = cf->file_ent->ce_tag;
diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c
index dc2836e6c0a..01f129e9d96 100644
--- a/usr.bin/cvs/cvs.c
+++ b/usr.bin/cvs/cvs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.c,v 1.158 2016/09/04 16:39:50 tb Exp $ */
+/* $OpenBSD: cvs.c,v 1.159 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2006, 2007 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -294,7 +294,7 @@ main(int argc, char **argv)
fatal("or set the CVSROOT environment variable.");
}
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cmdp->cmd(cmd_argc, cmd_argv);
cvs_cleanup();
return (0);
diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h
index a123c4885ac..63e0f1e0c03 100644
--- a/usr.bin/cvs/cvs.h
+++ b/usr.bin/cvs/cvs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.h,v 1.183 2017/05/28 17:11:34 joris Exp $ */
+/* $OpenBSD: cvs.h,v 1.184 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -372,6 +372,8 @@ void cvs_write_tagfile(const char *, char *, char *);
/* root.c */
struct cvsroot *cvsroot_get(const char *);
+int cvsroot_is_local(void);
+int cvsroot_is_remote(void);
/* logmsg.c */
char *cvs_logmsg_read(const char *);
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index d9b3c83452a..79af5b07f3f 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.162 2016/10/13 20:51:25 fcambus Exp $ */
+/* $OpenBSD: diff.c,v 1.163 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2008 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
@@ -216,7 +216,7 @@ cvs_diff(int argc, char **argv)
flags |= CR_REPO;
}
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
@@ -277,15 +277,14 @@ cvs_diff(int argc, char **argv)
diff_rev1 = diff_rev2 = NULL;
- if (cvs_cmdop == CVS_OP_DIFF ||
- current_cvsroot->cr_method == CVS_METHOD_LOCAL) {
+ if (cvs_cmdop == CVS_OP_DIFF || cvsroot_is_local()) {
if (argc > 0)
cvs_file_run(argc, argv, &cr);
else
cvs_file_run(1, &arg, &cr);
}
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
diff --git a/usr.bin/cvs/edit.c b/usr.bin/cvs/edit.c
index 65fc5802b92..4c1399da8e0 100644
--- a/usr.bin/cvs/edit.c
+++ b/usr.bin/cvs/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.52 2016/10/13 20:51:25 fcambus Exp $ */
+/* $OpenBSD: edit.c,v 1.53 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2006, 2007 Xavier Santolaria <xsa@openbsd.org>
*
@@ -121,7 +121,7 @@ cvs_edit(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
@@ -135,7 +135,7 @@ cvs_edit(int argc, char **argv)
cvs_file_run(argc, argv, &cr);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
cvs_client_send_request("edit");
@@ -176,7 +176,7 @@ cvs_editors(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
@@ -190,7 +190,7 @@ cvs_editors(int argc, char **argv)
cvs_file_run(argc, argv, &cr);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
cvs_client_send_request("editors");
@@ -231,7 +231,7 @@ cvs_unedit(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
@@ -245,7 +245,7 @@ cvs_unedit(int argc, char **argv)
cvs_file_run(argc, argv, &cr);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
cvs_client_send_request("unedit");
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 54b2a59c6a4..c9e39b222ed 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.271 2017/05/29 17:18:56 joris Exp $ */
+/* $OpenBSD: file.c,v 1.272 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -252,8 +252,7 @@ cvs_file_get_cf(const char *d, const char *f, const char *fpath, int fd,
if (cf->fd != -1)
cf->file_flags |= FILE_ON_DISK;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL ||
- cvs_server_active == 1)
+ if (cvsroot_is_remote() || cvs_server_active == 1)
cvs_validate_directory(cf->file_path);
return (cf);
@@ -301,7 +300,7 @@ cvs_file_walklist(struct cvs_flisthead *fl, struct cvs_recursion *cr)
goto next;
}
}
- } else if (current_cvsroot->cr_method == CVS_METHOD_LOCAL) {
+ } else if (cvsroot_is_local()) {
/*
* During checkout -p, do not use any locally
* available directories.
@@ -361,8 +360,7 @@ cvs_file_walklist(struct cvs_flisthead *fl, struct cvs_recursion *cr)
cvs_directory_tag =
xstrdup(cvs_specified_tag);
- if (current_cvsroot->cr_method ==
- CVS_METHOD_LOCAL) {
+ if (cvsroot_is_local()) {
cvs_get_repository_path(cf->file_wd,
repo, PATH_MAX);
cvs_repository_lock(repo,
@@ -587,7 +585,7 @@ cvs_file_walkdir(struct cvs_file *cf, struct cvs_recursion *cr)
}
walkrepo:
- if (current_cvsroot->cr_method == CVS_METHOD_LOCAL) {
+ if (cvsroot_is_local()) {
cvs_get_repository_path(cf->file_path, repo, PATH_MAX);
cvs_repository_lock(repo, (cmdp->cmd_flags & CVS_LOCK_REPO));
}
@@ -606,8 +604,7 @@ walkrepo:
cvs_file_walklist(&fl, cr);
cvs_file_freelist(&fl);
- if (current_cvsroot->cr_method == CVS_METHOD_LOCAL &&
- (cmdp->cmd_flags & CVS_LOCK_REPO))
+ if (cvsroot_is_local() && (cmdp->cmd_flags & CVS_LOCK_REPO))
cvs_repository_unlock(repo);
if (cvs_directory_tag != NULL && cmdp->cmd_flags & CVS_USE_WDIR) {
diff --git a/usr.bin/cvs/getlog.c b/usr.bin/cvs/getlog.c
index 35902c8a640..1bc8249d2f0 100644
--- a/usr.bin/cvs/getlog.c
+++ b/usr.bin/cvs/getlog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getlog.c,v 1.100 2016/10/15 22:20:17 millert Exp $ */
+/* $OpenBSD: getlog.c,v 1.101 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
@@ -135,7 +135,7 @@ cvs_getlog(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
@@ -175,15 +175,14 @@ cvs_getlog(int argc, char **argv)
cr.flags = flags;
- if (cvs_cmdop == CVS_OP_LOG ||
- current_cvsroot->cr_method == CVS_METHOD_LOCAL) {
+ if (cvs_cmdop == CVS_OP_LOG || cvsroot_is_local()) {
if (argc > 0)
cvs_file_run(argc, argv, &cr);
else
cvs_file_run(1, &arg, &cr);
}
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c
index cf74ad73f80..4c2d239740b 100644
--- a/usr.bin/cvs/import.c
+++ b/usr.bin/cvs/import.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: import.c,v 1.107 2017/05/28 17:11:34 joris Exp $ */
+/* $OpenBSD: import.c,v 1.108 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -127,7 +127,7 @@ cvs_import(int argc, char **argv)
logmsg = cvs_logmsg_create(NULL, NULL, NULL, NULL);
}
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cvs_client_send_request("Argument -b%s", IMPORT_DEFAULT_BRANCH);
diff --git a/usr.bin/cvs/init.c b/usr.bin/cvs/init.c
index 54e37079070..ff863dcd68b 100644
--- a/usr.bin/cvs/init.c
+++ b/usr.bin/cvs/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.39 2015/01/16 06:40:07 deraadt Exp $ */
+/* $OpenBSD: init.c,v 1.40 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -86,12 +86,13 @@ cvs_init(int argc, char **argv)
if (argc > 1)
fatal("init does not take any extra arguments");
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cvs_client_send_request("init %s", current_cvsroot->cr_dir);
cvs_client_get_responses();
- } else
+ } else {
cvs_init_local();
+ }
return (0);
}
diff --git a/usr.bin/cvs/release.c b/usr.bin/cvs/release.c
index 9544791cb07..e965ad66713 100644
--- a/usr.bin/cvs/release.c
+++ b/usr.bin/cvs/release.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: release.c,v 1.42 2015/01/16 06:40:07 deraadt Exp $ */
+/* $OpenBSD: release.c,v 1.43 2017/06/01 08:08:24 joris Exp $ */
/*-
* Copyright (c) 2005-2007 Xavier Santolaria <xsa@openbsd.org>
*
@@ -68,7 +68,7 @@ cvs_release(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
@@ -81,7 +81,7 @@ cvs_release(int argc, char **argv)
cvs_file_run(argc, argv, &cr);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
cvs_client_send_request("release");
diff --git a/usr.bin/cvs/remove.c b/usr.bin/cvs/remove.c
index dc46064e214..92d39adc410 100644
--- a/usr.bin/cvs/remove.c
+++ b/usr.bin/cvs/remove.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remove.c,v 1.83 2015/11/05 09:48:21 nicm Exp $ */
+/* $OpenBSD: remove.c,v 1.84 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
*
@@ -81,7 +81,7 @@ cvs_remove(int argc, char **argv)
cvs_file_run(1, &arg, &cr);
}
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
@@ -96,7 +96,7 @@ cvs_remove(int argc, char **argv)
else
cvs_file_run(1, &arg, &cr);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
cvs_client_send_request("remove");
diff --git a/usr.bin/cvs/root.c b/usr.bin/cvs/root.c
index 1143ea9f280..1f444a48981 100644
--- a/usr.bin/cvs/root.c
+++ b/usr.bin/cvs/root.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: root.c,v 1.48 2015/01/16 06:40:07 deraadt Exp $ */
+/* $OpenBSD: root.c,v 1.49 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -204,3 +204,21 @@ cvsroot_get(const char *dir)
return cvsroot_parse(line);
}
+
+int
+cvsroot_is_local(void)
+{
+ if (current_cvsroot == NULL)
+ fatal("cvsroot_is_local: no CVSROOT");
+
+ return (current_cvsroot->cr_method == CVS_METHOD_LOCAL);
+}
+
+int
+cvsroot_is_remote(void)
+{
+ if (current_cvsroot == NULL)
+ fatal("cvsroot_is_remote: no CVSROOT");
+
+ return (current_cvsroot->cr_method != CVS_METHOD_LOCAL);
+}
diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c
index ed212edba88..a3662801792 100644
--- a/usr.bin/cvs/status.c
+++ b/usr.bin/cvs/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.99 2017/05/28 16:58:54 joris Exp $ */
+/* $OpenBSD: status.c,v 1.100 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005-2008 Xavier Santolaria <xsa@openbsd.org>
@@ -87,7 +87,7 @@ cvs_status(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- if (current_cvsroot->cr_method == CVS_METHOD_LOCAL) {
+ if (cvsroot_is_local()) {
flags |= CR_REPO;
cr.fileproc = cvs_status_local;
} else {
@@ -106,7 +106,7 @@ cvs_status(int argc, char **argv)
else
cvs_file_run(1, &arg, &cr);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
cvs_client_send_request("status");
diff --git a/usr.bin/cvs/tag.c b/usr.bin/cvs/tag.c
index 41fa84be8c4..a118827eb21 100644
--- a/usr.bin/cvs/tag.c
+++ b/usr.bin/cvs/tag.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tag.c,v 1.86 2017/05/31 16:13:25 joris Exp $ */
+/* $OpenBSD: tag.c,v 1.87 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
*
@@ -156,7 +156,7 @@ cvs_tag(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index 5fc1f3743d3..f5cd21c85fc 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.175 2017/05/29 17:18:56 joris Exp $ */
+/* $OpenBSD: update.c,v 1.176 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -142,7 +142,7 @@ cvs_update(int argc, char **argv)
argc -= optind;
argv += optind;
- if (current_cvsroot->cr_method == CVS_METHOD_LOCAL) {
+ if (cvsroot_is_local()) {
cr.enterdir = cvs_update_enterdir;
cr.leavedir = prune_dirs ? cvs_update_leavedir : NULL;
cr.fileproc = cvs_update_local;
@@ -180,7 +180,7 @@ cvs_update(int argc, char **argv)
else
cvs_file_run(1, &arg, &cr);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
cvs_client_send_request("update");
diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c
index 3ae2dd366e7..757c07a8663 100644
--- a/usr.bin/cvs/util.c
+++ b/usr.bin/cvs/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.159 2016/10/13 20:51:25 fcambus Exp $ */
+/* $OpenBSD: util.c,v 1.160 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
@@ -574,8 +574,7 @@ cvs_mkpath(const char *path, char *tag)
hd.h_data = NULL;
hash_table_enter(&created_directories, &hd);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL ||
- cvs_server_active == 1)
+ if (cvsroot_is_remote() || cvs_server_active == 1)
cvs_validate_directory(path);
dir = xstrdup(path);
@@ -663,8 +662,7 @@ cvs_mkdir(const char *path, mode_t mode)
size_t len;
char *sp, *dp, *dir, rpath[PATH_MAX];
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL ||
- cvs_server_active == 1)
+ if (cvsroot_is_remote() || cvs_server_active == 1)
cvs_validate_directory(path);
dir = xstrdup(path);
diff --git a/usr.bin/cvs/version.c b/usr.bin/cvs/version.c
index 32f4e9ddac6..11b3ba1f925 100644
--- a/usr.bin/cvs/version.c
+++ b/usr.bin/cvs/version.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: version.c,v 1.25 2007/05/02 16:26:50 xsa Exp $ */
+/* $OpenBSD: version.c,v 1.26 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -35,14 +35,12 @@ cvs_version(int argc, char **argv)
if (argc > 1)
fatal("version does not take any extra arguments");
- if (current_cvsroot != NULL &&
- current_cvsroot->cr_method != CVS_METHOD_LOCAL)
+ if (current_cvsroot != NULL && cvsroot_is_remote())
cvs_printf("Client: ");
cvs_printf("%s\n", CVS_VERSION);
- if (current_cvsroot != NULL &&
- current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (current_cvsroot != NULL && cvsroot_is_remote()) {
cvs_client_connect_to_server();
cvs_client_send_request("version");
/* XXX: better way to handle server response? */
diff --git a/usr.bin/cvs/watch.c b/usr.bin/cvs/watch.c
index 77e3893e89b..5cc28ac9a78 100644
--- a/usr.bin/cvs/watch.c
+++ b/usr.bin/cvs/watch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: watch.c,v 1.22 2011/12/27 13:59:01 nicm Exp $ */
+/* $OpenBSD: watch.c,v 1.23 2017/06/01 08:08:24 joris Exp $ */
/*
* Copyright (c) 2005-2007 Xavier Santolaria <xsa@openbsd.org>
*
@@ -119,7 +119,7 @@ cvs_watch(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
@@ -147,7 +147,7 @@ cvs_watch(int argc, char **argv)
cvs_file_run(argc, argv, &cr);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
@@ -195,7 +195,7 @@ cvs_watchers(int argc, char **argv)
cr.enterdir = NULL;
cr.leavedir = NULL;
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_connect_to_server();
cr.fileproc = cvs_client_sendfile;
@@ -209,7 +209,7 @@ cvs_watchers(int argc, char **argv)
cvs_file_run(argc, argv, &cr);
- if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
+ if (cvsroot_is_remote()) {
cvs_client_send_files(argv, argc);
cvs_client_senddir(".");
cvs_client_send_request("watchers");