1 /* $OpenBSD: version.c,v 1.26 2017/06/01 08:08:24 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 "cvs.h" 20 #include "remote.h" 21 22 struct cvs_cmd cvs_cmd_version = { 23 CVS_OP_VERSION, 0, "version", 24 { "ve", "ver" }, 25 "Show current CVS version(s)", 26 "", 27 "", 28 NULL, 29 cvs_version 30 }; 31 32 int 33 cvs_version(int argc, char **argv) 34 { 35 if (argc > 1) 36 fatal("version does not take any extra arguments"); 37 38 if (current_cvsroot != NULL && cvsroot_is_remote()) 39 cvs_printf("Client: "); 40 41 cvs_printf("%s\n", CVS_VERSION); 42 43 if (current_cvsroot != NULL && cvsroot_is_remote()) { 44 cvs_client_connect_to_server(); 45 cvs_client_send_request("version"); 46 /* XXX: better way to handle server response? */ 47 cvs_printf("Server: "); 48 cvs_client_get_responses(); 49 } 50 51 return (0); 52 } 53