Files
mdbtools/src/util/mdb-ver.c

89 lines
2.0 KiB
C
Raw Normal View History

2002-03-21 04:27:37 +00:00
/* MDB Tools - A library for reading MS Access database file
* 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"
#include "mdbver.h"
#include "mdbprivate.h"
#include <locale.h>
#ifdef DMALLOC
#include "dmalloc.h"
#endif
2002-03-21 04:27:37 +00:00
int
2002-03-21 04:27:37 +00:00
main(int argc, char **argv)
{
MdbHandle *mdb;
int print_mdbver = 0;
int opt;
2002-03-21 04:27:37 +00:00
/* setlocale (LC_ALL, ""); */
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
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)
*/
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))) {
fprintf(stderr,_("Error: unable to open file %s\n"),argv[optind]);
2002-03-21 04:27:37 +00:00
exit(1);
}
switch(mdb->f->jet_version) {
case MDB_VER_JET3:
2003-01-01 22:29:39 +00:00
printf("JET3\n");
break;
case MDB_VER_JET4:
2003-01-01 22:29:39 +00:00
printf("JET4\n");
break;
case MDB_VER_ACCDB_2007:
printf("ACE12\n");
break;
case MDB_VER_ACCDB_2010:
printf("ACE14\n");
break;
default:
printf(_("unknown database version\n"));
break;
2002-03-21 04:27:37 +00:00
}
mdb_close(mdb);
return 0;
2002-03-21 04:27:37 +00:00
}