version 1.21, 2006/05/27 03:30:31 |
version 1.22, 2006/11/14 09:47:52 |
|
|
/* $OpenBSD$ */ |
/* $OpenBSD$ */ |
/* |
/* |
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> |
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> |
* All rights reserved. |
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> |
* |
* |
* Redistribution and use in source and binary forms, with or without |
* Permission to use, copy, modify, and distribute this software for any |
* modification, are permitted provided that the following conditions |
* purpose with or without fee is hereby granted, provided that the above |
* are met: |
* copyright notice and this permission notice appear in all copies. |
* |
* |
* 1. Redistributions of source code must retain the above copyright |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
* notice, this list of conditions and the following disclaimer. |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
* 2. The name of the author may not be used to endorse or promote products |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
* derived from this software without specific prior written permission. |
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
* |
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
|
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
*/ |
*/ |
|
|
#include "includes.h" |
#include "includes.h" |
|
|
#include "cvs.h" |
#include "cvs.h" |
#include "log.h" |
#include "log.h" |
#include "proto.h" |
#include "remote.h" |
|
|
static int cvs_version_pre_exec(struct cvsroot *); |
|
|
|
struct cvs_cmd cvs_cmd_version = { |
struct cvs_cmd cvs_cmd_version = { |
CVS_OP_VERSION, CVS_REQ_VERSION, "version", |
CVS_OP_VERSION, 0, "version", |
{ "ve", "ver" }, |
{ "ve", "ver" }, |
"Show current CVS version(s)", |
"Show current CVS version(s)", |
"", |
"", |
"", |
"", |
NULL, |
NULL, |
0, |
cvs_version |
NULL, |
|
cvs_version_pre_exec, |
|
NULL, |
|
NULL, |
|
NULL, |
|
NULL, |
|
0 |
|
}; |
}; |
|
|
|
int |
static int |
cvs_version(int argc, char **argv) |
cvs_version_pre_exec(struct cvsroot *root) |
|
{ |
{ |
if (root != NULL && root->cr_method != CVS_METHOD_LOCAL) |
if (current_cvsroot != NULL && |
printf("Client: "); |
current_cvsroot->cr_method != CVS_METHOD_LOCAL) |
|
cvs_printf("Client: "); |
|
|
cvs_printf("%s\n", CVS_VERSION); |
cvs_printf("%s\n", CVS_VERSION); |
|
|
if (root != NULL && root->cr_method != CVS_METHOD_LOCAL) { |
if (current_cvsroot != NULL && |
cvs_printf("Server: %s\n", root->cr_version == NULL ? |
current_cvsroot->cr_method != CVS_METHOD_LOCAL) { |
"(unknown)" : root->cr_version); |
cvs_client_send_request("version"); |
|
/* XXX: better way to handle server response? */ |
|
cvs_printf("Server: "); |
|
cvs_client_get_responses(); |
} |
} |
|
|
return (0); |
return (0); |