2002-03-21 04:27:37 +00:00
|
|
|
/* MDB Tools - A library for reading MS Access database file
|
2004-02-13 18:49:51 +00:00
|
|
|
* Copyright (C) 2000-2004 Brian Bruns
|
2002-03-21 04:27:37 +00:00
|
|
|
*
|
2011-08-28 19:53:29 -04: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 04:27:37 +00:00
|
|
|
*
|
2011-08-28 19:53:29 -04:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2002-03-21 04:27:37 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-08-28 19:53:29 -04:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
2002-03-21 04:27:37 +00:00
|
|
|
*
|
2011-08-28 19:53:29 -04: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 04:27:37 +00:00
|
|
|
*/
|
2011-08-28 19:53:29 -04:00
|
|
|
|
2002-03-21 04:27:37 +00:00
|
|
|
#include "mdbtools.h"
|
2004-02-13 18:49:51 +00:00
|
|
|
#include "mdbver.h"
|
2003-01-28 23:51:06 +00:00
|
|
|
#include "mdbprivate.h"
|
|
|
|
|
#include <locale.h>
|
|
|
|
|
|
|
|
|
|
#ifdef DMALLOC
|
|
|
|
|
#include "dmalloc.h"
|
|
|
|
|
#endif
|
2002-03-21 04:27:37 +00:00
|
|
|
|
2003-01-20 16:04:24 +00:00
|
|
|
int
|
2002-03-21 04:27:37 +00:00
|
|
|
main(int argc, char **argv)
|
|
|
|
|
{
|
2004-02-13 18:49:51 +00:00
|
|
|
MdbHandle *mdb;
|
|
|
|
|
int print_mdbver = 0;
|
|
|
|
|
int opt;
|
2002-03-21 04:27:37 +00:00
|
|
|
|
2003-01-28 23:51:06 +00:00
|
|
|
/* setlocale (LC_ALL, ""); */
|
|
|
|
|
bindtextdomain (PACKAGE, LOCALEDIR);
|
|
|
|
|
textdomain (PACKAGE);
|
2004-02-13 18:49:51 +00:00
|
|
|
while ((opt=getopt(argc, argv, "M"))!=-1) {
|
|
|
|
|
switch (opt) {
|
|
|
|
|
case 'M':
|
|
|
|
|
print_mdbver = 1;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (print_mdbver) {
|
|
|
|
|
fprintf(stdout,"%s\n", MDB_FULL_VERSION);
|
|
|
|
|
if (argc-optind < 1) exit(0);
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-21 04:27:37 +00:00
|
|
|
/*
|
|
|
|
|
** optind is now the position of the first non-option arg,
|
|
|
|
|
** see getopt(3)
|
|
|
|
|
*/
|
2004-02-13 18:49:51 +00:00
|
|
|
if (argc-optind < 1) {
|
|
|
|
|
fprintf(stderr,_("Usage: %s [-M] <file>\n"),argv[0]);
|
2002-03-21 04:27:37 +00:00
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
2004-04-13 20:06:04 +00:00
|
|
|
if (!(mdb = mdb_open(argv[optind], MDB_NOFLAGS))) {
|
2004-02-13 18:49:51 +00:00
|
|
|
fprintf(stderr,_("Error: unable to open file %s\n"),argv[optind]);
|
2002-03-21 04:27:37 +00:00
|
|
|
exit(1);
|
|
|
|
|
}
|
2012-07-07 21:08:25 +02:00
|
|
|
switch(mdb->f->jet_version) {
|
|
|
|
|
case MDB_VER_JET3:
|
2003-01-01 22:29:39 +00:00
|
|
|
printf("JET3\n");
|
2012-07-07 21:08:25 +02:00
|
|
|
break;
|
|
|
|
|
case MDB_VER_JET4:
|
2003-01-01 22:29:39 +00:00
|
|
|
printf("JET4\n");
|
2012-07-07 21:08:25 +02:00
|
|
|
break;
|
|
|
|
|
case MDB_VER_ACCDB_2007:
|
|
|
|
|
printf("ACE12\n");
|
|
|
|
|
break;
|
|
|
|
|
case MDB_VER_ACCDB_2010:
|
|
|
|
|
printf("ACE14\n");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2003-01-28 23:51:06 +00:00
|
|
|
printf(_("unknown database version\n"));
|
2012-07-07 21:08:25 +02:00
|
|
|
break;
|
2002-03-21 04:27:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-04-14 05:58:52 +00:00
|
|
|
mdb_close(mdb);
|
2002-08-12 17:37:04 +00:00
|
|
|
|
2012-07-22 02:29:04 +02:00
|
|
|
return 0;
|
2002-03-21 04:27:37 +00:00
|
|
|
}
|
|
|
|
|
|