From 1071fd61f01ffa35c508a44ef40e4bed32ef8b70 Mon Sep 17 00:00:00 2001 From: Xavier Santolaria Date: Mon, 10 Oct 2005 17:51:54 +0000 Subject: - editors remote handler - minor consistency tweaks --- usr.bin/cvs/edit.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++------ usr.bin/cvs/proto.c | 3 ++- 2 files changed, 63 insertions(+), 8 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/cvs/edit.c b/usr.bin/cvs/edit.c index 3f92722e59d..4dfa42081fb 100644 --- a/usr.bin/cvs/edit.c +++ b/usr.bin/cvs/edit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: edit.c,v 1.8 2005/07/25 12:05:43 xsa Exp $ */ +/* $OpenBSD: edit.c,v 1.9 2005/10/10 17:51:53 xsa Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau * All rights reserved. @@ -44,6 +44,8 @@ static int cvs_edit_init(struct cvs_cmd *, int, char **, int *); static int cvs_edit_remote(CVSFILE *, void *); static int cvs_edit_local(CVSFILE *, void *); +static int cvs_editors_remote(CVSFILE *, void *); + struct cvs_cmd cvs_cmd_edit = { CVS_OP_EDIT, CVS_REQ_NOOP, "edit", @@ -69,14 +71,14 @@ struct cvs_cmd cvs_cmd_editors = { "[-lR] [file ...]", "lR", NULL, - 0, + CF_SORT | CF_RECURSE, cvs_edit_init, NULL, - cvs_edit_remote, - cvs_edit_local, + cvs_editors_remote, NULL, NULL, - 0 + NULL, + CVS_CMD_SENDDIR | CVS_CMD_ALLOWSPEC | CVS_CMD_SENDARGS2 }; @@ -138,7 +140,7 @@ cvs_edit_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg) * */ static int -cvs_edit_remote(CVSFILE *file, void *arg) +cvs_edit_remote(CVSFILE *cf, void *arg) { int *mod_count; @@ -153,7 +155,7 @@ cvs_edit_remote(CVSFILE *file, void *arg) * */ static int -cvs_edit_local(CVSFILE *file, void *arg) +cvs_edit_local(CVSFILE *cf, void *arg) { int *mod_count; @@ -161,3 +163,55 @@ cvs_edit_local(CVSFILE *file, void *arg) return (CVS_EX_OK); } + + +/* + * cvs_editors_remote() + * + */ +static int +cvs_editors_remote(CVSFILE *cf, void *arg) +{ + int ret; + struct cvsroot *root; + + ret = 0; + root = CVS_DIR_ROOT(cf); + + if (cf->cf_type == DT_DIR) { + if (cf->cf_cvstat == CVS_FST_UNKNOWN) + ret = cvs_sendreq(root, CVS_REQ_QUESTIONABLE, + cf->cf_name); + else + ret = cvs_senddir(root, cf); + + if (ret == -1) + ret = CVS_EX_PROTO; + + return (ret); + } + + if (cvs_sendentry(root, cf) < 0) + return (CVS_EX_PROTO); + + switch (cf->cf_cvstat) { + case CVS_FST_UNKNOWN: + ret = cvs_sendreq(root, CVS_REQ_QUESTIONABLE, cf->cf_name); + break; + case CVS_FST_UPTODATE: + ret = cvs_sendreq(root, CVS_REQ_UNCHANGED, cf->cf_name); + break; + case CVS_FST_ADDED: + case CVS_FST_MODIFIED: + ret = cvs_sendreq(root, CVS_REQ_ISMODIFIED, cf->cf_name); + break; + default: + break; + } + + + if (ret == -1) + ret = CVS_EX_PROTO; + + return (ret); +} diff --git a/usr.bin/cvs/proto.c b/usr.bin/cvs/proto.c index fc812892174..9be475933dd 100644 --- a/usr.bin/cvs/proto.c +++ b/usr.bin/cvs/proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proto.c,v 1.77 2005/09/05 19:31:21 xsa Exp $ */ +/* $OpenBSD: proto.c,v 1.78 2005/10/10 17:51:53 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -116,6 +116,7 @@ struct cvs_req cvs_requests[] = { { CVS_REQ_TAG, "tag", CVS_REQF_RESP }, { CVS_REQ_ADMIN, "admin", CVS_REQF_RESP }, { CVS_REQ_WATCHERS, "watchers", CVS_REQF_RESP }, + { CVS_REQ_EDITORS, "editors", CVS_REQF_RESP }, }; struct cvs_resp cvs_responses[] = { -- cgit v1.2.3