1 /*
2 * Copyright (c) 1999, 2000, 2001, 2007
3 * Tama Communications Corporation
4 *
5 * This file is part of GNU GLOBAL.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
24 #include <stdio.h>
25 #ifdef STDC_HEADERS
26 #include <stdlib.h>
27 #endif
28 #ifdef USE_SQLITE3
29 #include "sqlite3.h"
30 #endif
31 #include "version.h"
32
33 static const char *copy = "\
34 Copyright (c) %s Tama Communications Corporation\n\
35 License GPLv3+: GNU GPL version 3 or later <http://www.gnu.org/licenses/gpl.html>\n\
36 This is free software; you are free to change and redistribute it.\n\
37 There is NO WARRANTY, to the extent permitted by law.\n\
38 ";
39 static const char *sysname = "Global";
40 /**
41 * get_version: get version string.
42 */
43 char *
get_version(void)44 get_version(void)
45 {
46 return VERSION;
47 }
48 /**
49 * version: print version information.
50 *
51 * @param[in] name
52 * @param[in] verbose
53 */
54 void
version(const char * name,const int verbose)55 version(const char *name, const int verbose)
56 {
57 if (name == NULL)
58 name = progname;
59 /*
60 * if the -q option is not specified then always verbose
61 * according to the GNU coding standard
62 */
63 if (qflag)
64 fprintf(stdout, "%s\n", VERSION);
65 else {
66 fprintf(stdout, "%s (%s) %s\n", name, sysname, VERSION);
67 fprintf(stdout, "Powered by Berkeley DB 1.85");
68 #ifdef USE_SQLITE3
69 fprintf(stdout, " and SQLite3 %s", sqlite3_version);
70 #endif
71 fprintf(stdout, ".\n");
72 fprintf(stdout, copy, COPYRIGHT_YEAR);
73 }
74 exit(0);
75 }
76