This commit is contained in:
brianb 2000-03-11 20:19:23 +00:00
parent d37f5058ae
commit 6714088c27
4 changed files with 112 additions and 1 deletions

View File

@ -60,6 +60,8 @@ struct stat status;
/* fprintf(stderr,"EOF reached.\n"); */
return 0;
}
/* kan - reset the cur_pos on a new page read */
mdb->cur_pos = 0; /* kan */
return len;
}
int mdb_get_int16(MdbHandle *mdb, int offset)

View File

@ -3,11 +3,12 @@ CC = gcc
INC = -I ../include `glib-config --cflags`
LIBS = -L ../libmdb -lmdb `glib-config --libs`
PROGS = prcat prkkd prtable prdata
PROGS = prcat prkkd prtable prdata prdump
PRCATOBJS = prcat.o
PRKKDOBJS = prkkd.o
PRTABLEOBJS = prtable.o
PRDATAOBJS = prdata.o
PRDUMPOBJS = prdump.o
all: $(PROGS)
@ -23,6 +24,9 @@ prtable: $(PRTABLEOBJS)
prdata: $(PRDATAOBJS)
$(CC) -g -o $@ $(PRDATAOBJS) $(LIBS)
prdump: $(PRDUMPOBJS)
$(CC) -g -o $@ $(PRDUMPOBJS) $(LIBS)
clean:
rm -f core *.o $(PROGS)

55
src/util/prdump.c Normal file
View File

@ -0,0 +1,55 @@
/* 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)
{
int rows;
int i;
unsigned char buf[2048];
MdbHandle *mdb;
MdbCatalogEntry entry;
MdbTableDef *table;
GList *l;
int j;
int page, start, stop;
if (argc<4) {
fprintf(stderr,"Usage: prdump <file> <page> <start> <stop>\n");
exit(1);
}
mdb = mdb_open(argv[1]);
mdb_read_catalog(mdb, MDB_TABLE);
sscanf (argv [2], "%d", &page);
sscanf (argv [3], "%d", &start);
sscanf (argv [4], "%d", &stop);
mdb_read_pg (mdb, page);
for (j = start; j < stop; j++)
{
fprintf (stderr, "%4x %4x %c\n", j, mdb->pg_buf [j], mdb->pg_buf [j]);
}
mdb_free_handle(mdb);
}

50
src/util/prkkd.c Normal file
View File

@ -0,0 +1,50 @@
/* MDB Tools - A library for reading MS Access database file
* Copyright (C) 2000 Brian Bruns
*
* 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.
*
* This program 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 General Public License for more details.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "mdbtools.h"
main(int argc, char **argv)
{
int rows;
int i;
unsigned char buf[2048];
MdbHandle *mdb;
MdbCatalogEntry 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_read_catalog_entry(mdb, i, &entry)) {
if (!strcmp(entry.object_name,argv[2])) {
mdb_kkd_dump(&entry);
}
}
}
mdb_free_handle(mdb);
}