2002-03-21 12:27:37 +08:00
|
|
|
/* MDB Tools - A library for reading MS Access database file
|
2004-02-14 02:49:51 +08:00
|
|
|
* Copyright (C) 2000-2004 Brian Bruns
|
2002-03-21 12:27:37 +08:00
|
|
|
*
|
2011-08-29 07:53:29 +08:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2002-03-21 12:27:37 +08:00
|
|
|
*
|
2011-08-29 07:53:29 +08:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2002-03-21 12:27:37 +08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-08-29 07:53:29 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-03-21 12:27:37 +08:00
|
|
|
*
|
2011-08-29 07:53:29 +08:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2002-03-21 12:27:37 +08:00
|
|
|
*/
|
2011-08-29 07:53:29 +08:00
|
|
|
|
2002-03-21 12:27:37 +08:00
|
|
|
#include "mdbtools.h"
|
2004-02-14 02:49:51 +08:00
|
|
|
#include "mdbver.h"
|
2003-01-29 07:51:06 +08:00
|
|
|
#include "mdbprivate.h"
|
|
|
|
|
2003-01-21 00:04:24 +08:00
|
|
|
int
|
2002-03-21 12:27:37 +08:00
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
2004-02-14 02:49:51 +08:00
|
|
|
MdbHandle *mdb;
|
|
|
|
int print_mdbver = 0;
|
2002-03-21 12:27:37 +08:00
|
|
|
|
2003-01-29 07:51:06 +08:00
|
|
|
/* setlocale (LC_ALL, ""); */
|
|
|
|
bindtextdomain (PACKAGE, LOCALEDIR);
|
|
|
|
textdomain (PACKAGE);
|
2014-12-29 20:10:01 +08:00
|
|
|
|
|
|
|
GOptionEntry entries[] = {
|
|
|
|
{ "mdbtools", 'M', 0, G_OPTION_ARG_NONE, &print_mdbver, "Show MDBtools version", NULL},
|
|
|
|
{ NULL },
|
|
|
|
};
|
|
|
|
GError *error = NULL;
|
|
|
|
GOptionContext *opt_context;
|
|
|
|
|
|
|
|
opt_context = g_option_context_new("<file> - display MDB file version");
|
|
|
|
g_option_context_add_main_entries(opt_context, entries, NULL /*i18n*/);
|
|
|
|
// g_option_context_set_strict_posix(opt_context, TRUE); /* options first, requires glib 2.44 */
|
|
|
|
if (!g_option_context_parse (opt_context, &argc, &argv, &error))
|
|
|
|
{
|
|
|
|
fprintf(stderr, "option parsing failed: %s\n", error->message);
|
|
|
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
|
|
|
exit (1);
|
2004-02-14 02:49:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (print_mdbver) {
|
|
|
|
fprintf(stdout,"%s\n", MDB_FULL_VERSION);
|
2014-12-29 20:10:01 +08:00
|
|
|
if (argc == 1)
|
|
|
|
exit(0);
|
2004-02-14 02:49:51 +08:00
|
|
|
}
|
|
|
|
|
2014-12-29 20:10:01 +08:00
|
|
|
if (argc != 2) {
|
|
|
|
fputs("Wrong number of arguments.\n\n", stderr);
|
|
|
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
2002-03-21 12:27:37 +08:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2014-12-29 20:10:01 +08:00
|
|
|
if (!(mdb = mdb_open(argv[1], MDB_NOFLAGS))) {
|
|
|
|
fprintf(stderr,_("Error: unable to open file %s\n"), argv[1]);
|
2002-03-21 12:27:37 +08:00
|
|
|
exit(1);
|
|
|
|
}
|
2012-07-08 03:08:25 +08:00
|
|
|
switch(mdb->f->jet_version) {
|
|
|
|
case MDB_VER_JET3:
|
2003-01-02 06:29:39 +08:00
|
|
|
printf("JET3\n");
|
2012-07-08 03:08:25 +08:00
|
|
|
break;
|
|
|
|
case MDB_VER_JET4:
|
2003-01-02 06:29:39 +08:00
|
|
|
printf("JET4\n");
|
2012-07-08 03:08:25 +08:00
|
|
|
break;
|
|
|
|
case MDB_VER_ACCDB_2007:
|
|
|
|
printf("ACE12\n");
|
|
|
|
break;
|
|
|
|
case MDB_VER_ACCDB_2010:
|
|
|
|
printf("ACE14\n");
|
|
|
|
break;
|
2018-03-05 19:39:57 +08:00
|
|
|
case MDB_VER_ACCDB_2013:
|
|
|
|
printf("ACE15\n");
|
|
|
|
break;
|
|
|
|
case MDB_VER_ACCDB_2016:
|
|
|
|
printf("ACE16\n");
|
|
|
|
break;
|
2012-07-08 03:08:25 +08:00
|
|
|
default:
|
2003-01-29 07:51:06 +08:00
|
|
|
printf(_("unknown database version\n"));
|
2012-07-08 03:08:25 +08:00
|
|
|
break;
|
2002-03-21 12:27:37 +08:00
|
|
|
}
|
|
|
|
|
2004-04-14 13:58:52 +08:00
|
|
|
mdb_close(mdb);
|
2014-12-29 20:10:01 +08:00
|
|
|
g_option_context_free(opt_context);
|
2002-08-13 01:37:04 +08:00
|
|
|
|
2012-07-22 08:29:04 +08:00
|
|
|
return 0;
|
2002-03-21 12:27:37 +08:00
|
|
|
}
|
|
|
|
|