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
|
|
|
*
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
#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"
|
|
|
|
#include <locale.h>
|
|
|
|
|
|
|
|
#ifdef DMALLOC
|
|
|
|
#include "dmalloc.h"
|
|
|
|
#endif
|
2002-03-21 12:27:37 +08:00
|
|
|
|
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;
|
|
|
|
int opt;
|
2002-03-21 12:27:37 +08:00
|
|
|
|
2003-01-29 07:51:06 +08:00
|
|
|
/* setlocale (LC_ALL, ""); */
|
|
|
|
bindtextdomain (PACKAGE, LOCALEDIR);
|
|
|
|
textdomain (PACKAGE);
|
2004-02-14 02:49:51 +08: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 12:27:37 +08:00
|
|
|
/*
|
|
|
|
** optind is now the position of the first non-option arg,
|
|
|
|
** see getopt(3)
|
|
|
|
*/
|
2004-02-14 02:49:51 +08:00
|
|
|
if (argc-optind < 1) {
|
|
|
|
fprintf(stderr,_("Usage: %s [-M] <file>\n"),argv[0]);
|
2002-03-21 12:27:37 +08:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
mdb_init();
|
|
|
|
|
2004-04-14 04:06:04 +08:00
|
|
|
if (!(mdb = mdb_open(argv[optind], MDB_NOFLAGS))) {
|
2004-02-14 02:49:51 +08:00
|
|
|
fprintf(stderr,_("Error: unable to open file %s\n"),argv[optind]);
|
2005-03-14 05:29:17 +08:00
|
|
|
mdb_exit();
|
2002-03-21 12:27:37 +08:00
|
|
|
exit(1);
|
|
|
|
}
|
2003-01-02 06:29:39 +08:00
|
|
|
if (IS_JET3(mdb)) {
|
|
|
|
printf("JET3\n");
|
|
|
|
} else if (IS_JET4(mdb)) {
|
|
|
|
printf("JET4\n");
|
|
|
|
} else {
|
2003-01-29 07:51:06 +08:00
|
|
|
printf(_("unknown database version\n"));
|
2002-03-21 12:27:37 +08:00
|
|
|
}
|
|
|
|
|
2004-04-14 13:58:52 +08:00
|
|
|
mdb_close(mdb);
|
2002-03-21 12:27:37 +08:00
|
|
|
mdb_exit();
|
2002-08-13 01:37:04 +08:00
|
|
|
|
|
|
|
exit(0);
|
2002-03-21 12:27:37 +08:00
|
|
|
}
|
|
|
|
|