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