1 /* $OpenBSD: version.c,v 1.23 2007/01/11 02:35:55 joris Exp $ */ 2 /* 3 * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> 4 * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #include "includes.h" 20 21 #include "cvs.h" 22 #include "log.h" 23 #include "remote.h" 24 25 struct cvs_cmd cvs_cmd_version = { 26 CVS_OP_VERSION, 0, "version", 27 { "ve", "ver" }, 28 "Show current CVS version(s)", 29 "", 30 "", 31 NULL, 32 cvs_version 33 }; 34 35 int 36 cvs_version(int argc, char **argv) 37 { 38 if (current_cvsroot != NULL && 39 current_cvsroot->cr_method != CVS_METHOD_LOCAL) 40 cvs_printf("Client: "); 41 42 cvs_printf("%s\n", CVS_VERSION); 43 44 if (current_cvsroot != NULL && 45 current_cvsroot->cr_method != CVS_METHOD_LOCAL) { 46 cvs_client_connect_to_server(); 47 cvs_client_send_request("version"); 48 /* XXX: better way to handle server response? */ 49 cvs_printf("Server: "); 50 cvs_client_get_responses(); 51 } 52 53 return (0); 54 } 55