1 /* This file is part of GDBM test suite.
2 Copyright (C) 2011 Free Software Foundation, Inc.
4 GDBM is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 GDBM is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with GDBM. If not, see <http://www.gnu.org/licenses/>.
24 #define major_number(lib) ((lib) ? gdbm_version_number[0] : GDBM_VERSION_MAJOR)
25 #define minor_number(lib) ((lib) ? gdbm_version_number[1] : GDBM_VERSION_MINOR)
26 #define patch_number(lib) ((lib) ? gdbm_version_number[2] : GDBM_VERSION_PATCH)
29 main (int argc, char **argv)
31 const char *progname = canonical_progname (argv[0]);
36 printf ("%s\n", gdbm_version);
44 if (strcmp (arg, "-help") == 0)
46 printf ("usage: %s [-string] [-lib] [-header] [-major] [-minor] [-patch] [-full]\n", progname);
49 else if (strcmp (arg, "-string") == 0)
50 printf ("%s\n", gdbm_version);
51 else if (strcmp (arg, "-lib") == 0)
53 else if (strcmp (arg, "-header") == 0)
55 else if (strcmp (arg, "-major") == 0)
56 printf ("%d\n", major_number (library));
57 else if (strcmp (arg, "-minor") == 0)
58 printf ("%d\n", minor_number (library));
59 else if (strcmp (arg, "-patch") == 0)
60 printf ("%d\n", patch_number (library));
61 else if (strcmp (arg, "-full") == 0)
63 major_number (library),
64 minor_number (library),
65 patch_number (library));
68 fprintf (stderr, "%s: unknown option %s\n",