1*43c1707eStholo/* 2*43c1707eStholo * Copyright (c) 1994 david d `zoo' zuhn 3*43c1707eStholo * Copyright (c) 1994 Free Software Foundation, Inc. 4*43c1707eStholo * Copyright (c) 1992, Brian Berliner and Jeff Polk 5*43c1707eStholo * Copyright (c) 1989-1992, Brian Berliner 6*43c1707eStholo * 7*43c1707eStholo * You may distribute under the terms of the GNU General Public License as 8*43c1707eStholo * specified in the README file that comes with this CVS source distribution. 9*43c1707eStholo * 10*43c1707eStholo * version.c - the CVS version number 11*43c1707eStholo */ 12*43c1707eStholo 13*43c1707eStholo#include "cvs.h" 14*43c1707eStholo 15*43c1707eStholochar *version_string = "Concurrent Versions System (CVS) @VERSION@"; 16*43c1707eStholo 17*43c1707eStholo#ifdef CLIENT_SUPPORT 18*43c1707eStholo#ifdef SERVER_SUPPORT 19*43c1707eStholochar *config_string = " (client/server)\n"; 20*43c1707eStholo#else 21*43c1707eStholochar *config_string = " (client)\n"; 22*43c1707eStholo#endif 23*43c1707eStholo#else 24*43c1707eStholo#ifdef SERVER_SUPPORT 25*43c1707eStholochar *config_string = " (server)\n"; 26*43c1707eStholo#else 27*43c1707eStholochar *config_string = "\n"; 28*43c1707eStholo#endif 29*43c1707eStholo#endif 30*43c1707eStholo 31*43c1707eStholo 32*43c1707eStholo 33*43c1707eStholostatic const char *const version_usage[] = 34*43c1707eStholo{ 35*43c1707eStholo "Usage: %s %s\n", 36*43c1707eStholo NULL 37*43c1707eStholo}; 38*43c1707eStholo 39*43c1707eStholo 40*43c1707eStholo 41*43c1707eStholo/* 42*43c1707eStholo * Output a version string for the client and server. 43*43c1707eStholo * 44*43c1707eStholo * This function will output the simple version number (for the '--version' 45*43c1707eStholo * option) or the version numbers of the client and server (using the 'version' 46*43c1707eStholo * command). 47*43c1707eStholo */ 48*43c1707eStholoint 49*43c1707eStholoversion (argc, argv) 50*43c1707eStholo int argc; 51*43c1707eStholo char **argv; 52*43c1707eStholo{ 53*43c1707eStholo int err = 0; 54*43c1707eStholo 55*43c1707eStholo if (argc == -1) 56*43c1707eStholo usage (version_usage); 57*43c1707eStholo 58*43c1707eStholo#ifdef CLIENT_SUPPORT 59*43c1707eStholo if (current_parsed_root && current_parsed_root->isremote) 60*43c1707eStholo (void) fputs ("Client: ", stdout); 61*43c1707eStholo#endif 62*43c1707eStholo 63*43c1707eStholo /* Having the year here is a good idea, so people have 64*43c1707eStholo some idea of how long ago their version of CVS was 65*43c1707eStholo released. */ 66*43c1707eStholo (void) fputs (version_string, stdout); 67*43c1707eStholo (void) fputs (config_string, stdout); 68*43c1707eStholo 69*43c1707eStholo#ifdef CLIENT_SUPPORT 70*43c1707eStholo if (current_parsed_root && current_parsed_root->isremote) 71*43c1707eStholo { 72*43c1707eStholo (void) fputs ("Server: ", stdout); 73*43c1707eStholo start_server (); 74*43c1707eStholo if (supported_request ("version")) 75*43c1707eStholo send_to_server ("version\012", 0); 76*43c1707eStholo else 77*43c1707eStholo { 78*43c1707eStholo send_to_server ("noop\012", 0); 79*43c1707eStholo fputs ("(unknown)\n", stdout); 80*43c1707eStholo } 81*43c1707eStholo err = get_responses_and_close (); 82*43c1707eStholo } 83*43c1707eStholo#endif 84*43c1707eStholo return err; 85*43c1707eStholo} 86*43c1707eStholo 87