mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-09-19 10:37:54 +08:00
Initial revision
This commit is contained in:
13
src/Makefile
Normal file
13
src/Makefile
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
DIRS = extras libmdb util
|
||||
|
||||
all:
|
||||
cd libmdb; make
|
||||
cd util; make
|
||||
cd extras; make
|
||||
|
||||
clean:
|
||||
cd extras; make clean
|
||||
cd util; make clean
|
||||
cd libmdb; make clean
|
||||
|
16
src/extras/Makefile
Normal file
16
src/extras/Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
PROGS = mdb-dump
|
||||
OBJS = dump.o
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
clean:
|
||||
rm -f core *.o $(PROGS)
|
||||
|
||||
mdb-dump: dump.o
|
||||
$(CC) -g -o $@ $<
|
||||
|
||||
.c.o:
|
||||
$(CC) -g -c $<
|
39
src/extras/dump.c
Normal file
39
src/extras/dump.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* utility program to make a hex dump of a binary file (such as a mdb file) */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
long i=0;
|
||||
int j;
|
||||
unsigned char data[17];
|
||||
FILE *in;
|
||||
int length;
|
||||
|
||||
in = fopen(argv[1],"r");
|
||||
while (length = fread(data,1,16,in)) {
|
||||
fprintf(stdout, "%06x ", i);
|
||||
i+=length;
|
||||
|
||||
for(j=0; j<length; j++) {
|
||||
fprintf(stdout, "%02x ", data[j]);
|
||||
}
|
||||
|
||||
fprintf(stdout, " |");
|
||||
|
||||
for(j=0; j<length; j++) {
|
||||
fprintf(stdout, "%c", (isprint(data[j])) ? data[j] : '.');
|
||||
}
|
||||
fprintf(stdout, "|\n");
|
||||
}
|
||||
}
|
||||
|
76
src/include/mdbtools.h
Normal file
76
src/include/mdbtools.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/* MDB Tools - A library for reading MS Access database files
|
||||
* Copyright (C) 2000 Brian Bruns
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _mdbtools_h_
|
||||
#define _mdbtools_h_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MDB_PGSIZE 2048
|
||||
#define MDB_MAX_OBJ_NAME 30
|
||||
#define MDB_CATALOG_PG 18
|
||||
|
||||
enum {
|
||||
MDB_FORM = 0,
|
||||
MDB_TABLE,
|
||||
MDB_MACRO,
|
||||
MDB_SYSTEM_TABLE,
|
||||
MDB_REPORT,
|
||||
MDB_QUERY,
|
||||
MDB_LINKED_TABLE,
|
||||
MDB_MODULE,
|
||||
MDB_UNKNOWN_08,
|
||||
MDB_UNKNOWN_09,
|
||||
MDB_UNKNOWN_0A,
|
||||
MDB_UNKNOWN_0B
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
char *filename;
|
||||
unsigned long cur_pg;
|
||||
unsigned int row_num;
|
||||
unsigned int cur_pos;
|
||||
unsigned char pg_buf[MDB_PGSIZE];
|
||||
int cur_cat_entry;
|
||||
} MDB_HANDLE;
|
||||
|
||||
typedef struct {
|
||||
char object_name[MDB_MAX_OBJ_NAME+1];
|
||||
int object_type;
|
||||
unsigned long kkd_pg;
|
||||
unsigned int kkd_rowid;
|
||||
} MDB_CATALOG_ENTRY;
|
||||
|
||||
extern MDB_HANDLE *mdb_alloc_handle();
|
||||
extern void mdb_free_handle(MDB_HANDLE *mdb);
|
||||
extern size_t mdb_read_pg(MDB_HANDLE *mdb, unsigned long pg);
|
||||
extern int mdb_get_int16(MDB_HANDLE *mdb, int offset);
|
||||
extern long mdb_get_int32(MDB_HANDLE *mdb, int offset);
|
||||
extern MDB_HANDLE *mdb_open(char *filename);
|
||||
extern void mdb_catalog_dump(MDB_HANDLE *mdb, int obj_type);
|
||||
extern int mdb_catalog_rows(MDB_HANDLE *mdb);
|
||||
extern MDB_CATALOG_ENTRY *mdb_get_catalog_entry(MDB_HANDLE *mdb, int rowid, MDB_CATALOG_ENTRY *entry);
|
||||
#endif /* _mdbtools_h_ */
|
15
src/libmdb/Makefile
Normal file
15
src/libmdb/Makefile
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
INC = -I ../include
|
||||
OBJS = catalog.o mem.o file.o
|
||||
|
||||
all: libmdb
|
||||
|
||||
libmdb: $(OBJS)
|
||||
ar cq libmdb.a $(OBJS)
|
||||
clean:
|
||||
rm -f core *.o *.a
|
||||
|
||||
.c.o:
|
||||
$(CC) -g -c $< $(INC)
|
108
src/libmdb/catalog.c
Normal file
108
src/libmdb/catalog.c
Normal file
@@ -0,0 +1,108 @@
|
||||
/* MDB Tools - A library for reading MS Access database file
|
||||
* Copyright (C) 2000 Brian Bruns
|
||||
*
|
||||
* 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"
|
||||
|
||||
char *mdb_get_objtype_string(int obj_type)
|
||||
{
|
||||
static char *type_name[] = {"Form",
|
||||
"Table",
|
||||
"Macro",
|
||||
"System Table",
|
||||
"Report",
|
||||
"Query",
|
||||
"Linked Table",
|
||||
"Module",
|
||||
"Unknown 0x08",
|
||||
"Unknown 0x09",
|
||||
"Unknown 0x0a",
|
||||
"Unknown 0x0b"
|
||||
};
|
||||
|
||||
if (obj_type > 11) {
|
||||
return NULL;
|
||||
} else {
|
||||
return type_name[obj_type];
|
||||
}
|
||||
}
|
||||
|
||||
MDB_CATALOG_ENTRY *mdb_catalog_entry(MDB_HANDLE *mdb, int rowid, MDB_CATALOG_ENTRY *entry)
|
||||
{
|
||||
int offset;
|
||||
int rows;
|
||||
int i,j;
|
||||
|
||||
rows = mdb_get_int16(mdb, 8);
|
||||
|
||||
if (rowid < 0 || rowid > rows) return NULL;
|
||||
|
||||
offset = mdb_get_int16(mdb, 10 + 2 * rowid);
|
||||
/*
|
||||
** ??? this happens, don't know what it means
|
||||
*/
|
||||
if (offset & 0xF000) return NULL;
|
||||
|
||||
/*
|
||||
for (j=offset;j<offset+32;j++)
|
||||
fprintf(stdout,"%02x ",mdb->pg_buf[j]);
|
||||
fprintf(stdout,"\n");
|
||||
*/
|
||||
|
||||
memset(entry, '\0', sizeof(MDB_CATALOG_ENTRY));
|
||||
entry->object_type = mdb->pg_buf[offset+0x09];
|
||||
j=0;
|
||||
for (i=offset+31;isprint(mdb->pg_buf[i]);i++) {
|
||||
if (j<=MDB_MAX_OBJ_NAME) {
|
||||
entry->object_name[j++]=mdb->pg_buf[i];
|
||||
}
|
||||
}
|
||||
entry->object_name[j] = '\0';
|
||||
entry->kkd_pg = mdb_get_int16(mdb,offset+31+strlen(entry->object_name)+7);
|
||||
entry->kkd_rowid = mdb->pg_buf[offset+31+strlen(entry->object_name)+6];
|
||||
|
||||
return entry;
|
||||
}
|
||||
int mdb_catalog_rows(MDB_HANDLE *mdb)
|
||||
{
|
||||
return mdb_get_int16(mdb, 0x08);
|
||||
}
|
||||
void mdb_catalog_dump(MDB_HANDLE *mdb, int obj_type)
|
||||
{
|
||||
int off, save_pos;
|
||||
int rows;
|
||||
int i,j;
|
||||
unsigned char *buf;
|
||||
MDB_CATALOG_ENTRY entry;
|
||||
|
||||
mdb_read_pg(mdb, MDB_CATALOG_PG);
|
||||
rows = mdb_catalog_rows(mdb);
|
||||
|
||||
for (i=0;i<rows;i++) {
|
||||
if (mdb_catalog_entry(mdb, i, &entry)) {
|
||||
if (obj_type==-1 || obj_type==entry.object_type) {
|
||||
fprintf(stdout,"Type: %-15s Name: %-30s KKD pg: %04x row: %2d\n",
|
||||
mdb_get_objtype_string(entry.object_type),
|
||||
entry.object_name,
|
||||
entry.kkd_pg,
|
||||
entry.kkd_rowid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
103
src/libmdb/file.c
Normal file
103
src/libmdb/file.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/* MDB Tools - A library for reading MS Access database files
|
||||
* Copyright (C) 2000 Brian Bruns
|
||||
*
|
||||
* 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"
|
||||
|
||||
MDB_HANDLE *mdb_open(char *filename)
|
||||
{
|
||||
MDB_HANDLE *mdb;
|
||||
|
||||
mdb = mdb_alloc_handle();
|
||||
mdb->filename = (char *) malloc(strlen(filename)+1);
|
||||
strcpy(mdb->filename, filename);
|
||||
mdb->fd = open(filename,O_RDONLY);
|
||||
|
||||
if (mdb->fd==-1) {
|
||||
fprintf(stderr,"Couldn't open file %s\n",filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return mdb;
|
||||
}
|
||||
|
||||
/*
|
||||
** mdb_read a wrapper for read that bails if anything is wrong
|
||||
*/
|
||||
size_t mdb_read_pg(MDB_HANDLE *mdb, unsigned long pg)
|
||||
{
|
||||
size_t len;
|
||||
off_t offset = pg * MDB_PGSIZE;
|
||||
struct stat status;
|
||||
|
||||
fstat(mdb->fd, &status);
|
||||
if (status.st_size < offset) {
|
||||
fprintf(stderr,"offset %lu is beyond EOF\n",offset);
|
||||
return 0;
|
||||
}
|
||||
lseek(mdb->fd, offset, SEEK_SET);
|
||||
len = read(mdb->fd,mdb->pg_buf,MDB_PGSIZE);
|
||||
if (len==-1) {
|
||||
perror("read");
|
||||
return 0;
|
||||
}
|
||||
else if (len<MDB_PGSIZE) {
|
||||
fprintf(stderr,"EOF reached.\n");
|
||||
return 0;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
int mdb_get_int16(MDB_HANDLE *mdb, int offset)
|
||||
{
|
||||
unsigned char *c;
|
||||
int i;
|
||||
|
||||
if (offset < 0 || offset+2 > MDB_PGSIZE) return -1;
|
||||
c = &mdb->pg_buf[offset];
|
||||
i = c[1]*256+c[0];
|
||||
|
||||
mdb->cur_pos+=2;
|
||||
return i;
|
||||
|
||||
}
|
||||
long mdb_get_int32(MDB_HANDLE *mdb, int offset)
|
||||
{
|
||||
long l;
|
||||
unsigned char *c;
|
||||
|
||||
if (offset <0 || offset+4 > MDB_PGSIZE) return -1;
|
||||
c = &mdb->pg_buf[offset];
|
||||
l =c[3]; l<<=8;
|
||||
l+=c[2]; l<<=8;
|
||||
l+=c[1]; l<<=8;
|
||||
l+=c[0];
|
||||
|
||||
mdb->cur_pos+=4;
|
||||
return l;
|
||||
}
|
||||
int mdb_set_pos(MDB_HANDLE *mdb, int pos)
|
||||
{
|
||||
if (pos<0 || pos >= MDB_PGSIZE) return 0;
|
||||
|
||||
mdb->cur_pos=pos;
|
||||
return pos;
|
||||
}
|
||||
int mdb_get_pos(MDB_HANDLE *mdb)
|
||||
{
|
||||
return mdb->cur_pos;
|
||||
}
|
140
src/libmdb/kkd.c
Normal file
140
src/libmdb/kkd.c
Normal file
@@ -0,0 +1,140 @@
|
||||
/* MDB Tools - A library for reading MS Access database file
|
||||
* Copyright (C) 2000 Brian Bruns
|
||||
*
|
||||
* 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"
|
||||
|
||||
|
||||
/*
|
||||
** Note: This code is mostly garbage right now...just a test to parse out the
|
||||
** KKD structures.
|
||||
*/
|
||||
|
||||
void mdb_kkd_dump(MDB_HANDLE *mdb, int rowid)
|
||||
{
|
||||
int rows;
|
||||
int kkd_start, kkd_end;
|
||||
int i, j, tmp, pos, row_type, hdrpos=0, datapos=0;
|
||||
int len;
|
||||
int col_type, col_num, val_len;
|
||||
int start;
|
||||
unsigned char c;
|
||||
|
||||
rows = mdb_get_int16(mdb,8);
|
||||
fprintf(stdout,"number of rows = %d\n",rows);
|
||||
kkd_start = mdb_get_int16(mdb,10+rowid*2);
|
||||
fprintf(stdout,"kkd start = %d %04x\n",kkd_start,kkd_start);
|
||||
kkd_end = MDB_PGSIZE;
|
||||
for (i=0;i<rows;i++) {
|
||||
tmp = mdb_get_int16(mdb, 10+i*2);
|
||||
if (tmp<MDB_PGSIZE &&
|
||||
tmp>kkd_start &&
|
||||
tmp<kkd_end) {
|
||||
kkd_end = tmp;
|
||||
}
|
||||
}
|
||||
fprintf(stdout,"kkd end = %d %04x\n",kkd_end,kkd_end);
|
||||
pos = kkd_start + 4; /* 4 = K K D \0 */
|
||||
while (pos < kkd_end) {
|
||||
tmp = mdb_get_int16(mdb,pos);
|
||||
row_type = mdb_get_int16(mdb,pos+4);
|
||||
fprintf(stdout,"row size = %3d type = 0x%02x\n",tmp,row_type);
|
||||
if (row_type==0x80) hdrpos = pos;
|
||||
if (row_type==0x01) datapos = pos;
|
||||
pos += tmp;
|
||||
}
|
||||
|
||||
if (hdrpos) {
|
||||
j=0;
|
||||
fprintf(stdout,"\nheaders\n");
|
||||
fprintf(stdout,"-------\n");
|
||||
len = mdb_get_int16(mdb,hdrpos);
|
||||
pos = hdrpos + 6;
|
||||
while (pos < hdrpos+len) {
|
||||
fprintf(stdout,"%3d ",j++);
|
||||
tmp = mdb_get_int16(mdb,pos); /* length of string */
|
||||
pos += 2;
|
||||
for (i=0;i<tmp;i++)
|
||||
fprintf(stdout,"%c",mdb->pg_buf[pos+i]);
|
||||
fprintf(stdout,"\n");
|
||||
pos += tmp;
|
||||
}
|
||||
}
|
||||
if (datapos) {
|
||||
fprintf(stdout,"\n data\n");
|
||||
fprintf(stdout,"-------\n");
|
||||
len = mdb_get_int16(mdb,datapos);
|
||||
pos = datapos + 6;
|
||||
while (pos < datapos+len) {
|
||||
start = pos;
|
||||
tmp = mdb_get_int16(mdb,pos); /* length of field */
|
||||
pos += 2;
|
||||
col_type = mdb_get_int16(mdb,pos); /* ??? */
|
||||
pos += 2;
|
||||
col_num = 0;
|
||||
if (col_type) {
|
||||
col_num = mdb_get_int16(mdb,pos);
|
||||
pos += 2;
|
||||
}
|
||||
val_len = mdb_get_int16(mdb,pos);
|
||||
pos += 2;
|
||||
fprintf(stdout,"length = %3d %04x %2d %2d ",tmp, col_type, col_num, val_len);
|
||||
for (i=0;i<val_len;i++) {
|
||||
c = mdb->pg_buf[pos+i];
|
||||
if (isprint(c))
|
||||
fprintf(stdout," %c",c);
|
||||
else
|
||||
fprintf(stdout," %02x",c);
|
||||
|
||||
}
|
||||
fprintf(stdout,"\n");
|
||||
pos = start + tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int rows;
|
||||
int i;
|
||||
unsigned char buf[2048];
|
||||
MDB_HANDLE *mdb;
|
||||
MDB_CATALOG_ENTRY entry;
|
||||
|
||||
|
||||
if (argc<2) {
|
||||
fprintf(stderr,"Usage: prtable <file> <table>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
mdb = mdb_open(argv[1]);
|
||||
|
||||
mdb_read_pg(mdb, MDB_CATALOG_PG);
|
||||
rows = mdb_catalog_rows(mdb);
|
||||
|
||||
for (i=0;i<rows;i++) {
|
||||
if (mdb_catalog_entry(mdb, i, &entry)) {
|
||||
if (!strcmp(entry.object_name,argv[2])) {
|
||||
mdb_read_pg(mdb, entry.kkd_pg);
|
||||
mdb_kkd_dump(mdb, entry.kkd_rowid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mdb_free_handle(mdb);
|
||||
}
|
||||
|
37
src/libmdb/mem.c
Normal file
37
src/libmdb/mem.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/* MDB Tools - A library for reading MS Access database files
|
||||
* Copyright (C) 2000 Brian Bruns
|
||||
*
|
||||
* 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"
|
||||
|
||||
MDB_HANDLE *mdb_alloc_handle()
|
||||
{
|
||||
MDB_HANDLE *mdb;
|
||||
|
||||
mdb = (MDB_HANDLE *) malloc(sizeof(MDB_HANDLE));
|
||||
memset(mdb, '\0', sizeof(MDB_HANDLE));
|
||||
|
||||
return mdb;
|
||||
}
|
||||
void mdb_free_handle(MDB_HANDLE *mdb)
|
||||
{
|
||||
if (!mdb) return;
|
||||
|
||||
if (mdb->filename) free(mdb->filename);
|
||||
free(mdb);
|
||||
}
|
18
src/util/Makefile
Normal file
18
src/util/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
INC = -I ../include
|
||||
LIBS = -L ../libmdb -lmdb
|
||||
PROGS = prcat
|
||||
PRCATOBJS = prcat.o
|
||||
|
||||
all: $(PROGS)
|
||||
|
||||
prcat: $(PRCATOBJS)
|
||||
$(CC) -g -o $@ $(PRCATOBJS) $(LIBS)
|
||||
|
||||
clean:
|
||||
rm -f core *.o $(PROGS)
|
||||
|
||||
.c.o:
|
||||
$(CC) -g -c $< $(INC)
|
45
src/util/prcat.c
Normal file
45
src/util/prcat.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* MDB Tools - A library for reading MS Access database file
|
||||
* Copyright (C) 2000 Brian Bruns
|
||||
*
|
||||
* 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"
|
||||
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
off_t offset=0;
|
||||
int fd, i, j;
|
||||
char xdigit;
|
||||
short digit;
|
||||
struct stat status;
|
||||
int rows, cur, off;
|
||||
unsigned char buf[2048];
|
||||
MDB_HANDLE *mdb;
|
||||
|
||||
|
||||
if (argc<2) {
|
||||
fprintf(stderr,"Usage: prcat <file> [<objtype>]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
mdb = mdb_open(argv[1]);
|
||||
|
||||
mdb_catalog_dump(mdb,(argc > 2) ? atoi(argv[2]) : MDB_TABLE);
|
||||
|
||||
mdb_free_handle(mdb);
|
||||
}
|
||||
|
Reference in New Issue
Block a user