Implement CLOCK_MONOTONIC using getnanouptime(), which in DragonFly is
[dragonfly.git] / contrib / cvs-1.12.9 / 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 (int argc, char **argv)
48 {
49     int err = 0;
50
51     if (argc == -1)
52         usage (version_usage);
53
54 #ifdef CLIENT_SUPPORT
55     if (current_parsed_root && current_parsed_root->isremote)
56         (void) fputs ("Client: ", stdout);
57 #endif
58
59     /* Having the year here is a good idea, so people have
60        some idea of how long ago their version of CVS was
61        released.  */
62     (void) fputs (PACKAGE_STRING, stdout);
63     (void) fputs (config_string, stdout);
64
65 #ifdef CLIENT_SUPPORT
66     if (current_parsed_root && current_parsed_root->isremote)
67     {
68         (void) fputs ("Server: ", stdout);
69         start_server ();
70         if (supported_request ("version"))
71             send_to_server ("version\012", 0);
72         else
73         {
74             send_to_server ("noop\012", 0);
75             fputs ("(unknown)\n", stdout);
76         }
77         err = get_responses_and_close ();
78     }
79 #endif
80     return err;
81 }
82