mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-09-18 09:50:07 +08:00
index work
dmalloc headers mem leak fixes start on i18n
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(src/extras/mdb-dump.c)
|
||||
AM_INIT_AUTOMAKE(mdbtools,0.5)
|
||||
AM_CONFIG_HEADER(include/config.h)
|
||||
|
||||
AC_PROG_CC(gcc)
|
||||
dnl Checks for programs.
|
||||
@@ -123,4 +124,7 @@ LDFLAGS=$OLDLDFLAGS
|
||||
|
||||
AC_SUBST(READLINE_LIBS)
|
||||
|
||||
localedir=${datadir}/locale
|
||||
AC_SUBST(localedir)
|
||||
|
||||
AC_OUTPUT(src/util/Makefile src/extras/Makefile Makefile include/Makefile src/Makefile src/libmdb/Makefile include/Makefile src/sql/Makefile src/odbc/Makefile doc/Makefile src/gmdb2/Makefile src/gmdb2/gladefiles/Makefile src/gmdb2/pixmaps/Makefile src/gmdb2/help/Makefile src/gmdb2/help/C/Makefile mdbtools.spec)
|
||||
|
@@ -23,6 +23,10 @@
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
/* Access data types */
|
||||
char *mdb_access_types[] =
|
||||
{"Unknown 0x00",
|
||||
|
@@ -19,6 +19,10 @@
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
char *
|
||||
mdb_get_objtype_string(int obj_type)
|
||||
{
|
||||
@@ -91,6 +95,9 @@ int type;
|
||||
}
|
||||
}
|
||||
//mdb_dump_catalog(mdb, MDB_TABLE);
|
||||
|
||||
mdb_free_tabledef(table);
|
||||
|
||||
return mdb->catalog;
|
||||
}
|
||||
|
||||
|
@@ -21,6 +21,10 @@
|
||||
#include "time.h"
|
||||
#include "math.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
#define MDB_DEBUG_OLE 1
|
||||
|
||||
char *mdb_money_to_string(MdbHandle *mdb, int start, char *s);
|
||||
|
@@ -2,6 +2,10 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
void buffer_dump(const unsigned char* buf, int start, int end)
|
||||
{
|
||||
char asc[20];
|
||||
|
@@ -19,6 +19,10 @@
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
MdbFormatConstants MdbJet4Constants = {
|
||||
4096, 0x0c, 12, 45, 47, 51, 55, 56, 63, 12, 15, 23, 5, 25
|
||||
};
|
||||
@@ -143,7 +147,10 @@ mdb_close(MdbHandle *mdb)
|
||||
{
|
||||
if (mdb->f) {
|
||||
mdb->f->refs--;
|
||||
if (mdb->f->refs<=0) mdb_free_file(mdb->f);
|
||||
if (mdb->f->refs<=0) {
|
||||
mdb_free_file(mdb->f);
|
||||
mdb->f = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
MdbHandle *mdb_clone_handle(MdbHandle *mdb)
|
||||
|
@@ -18,6 +18,11 @@
|
||||
*/
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
char idx_to_text[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0-7 0x00-0x07 */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8-15 0x09-0x0f */
|
||||
@@ -53,43 +58,70 @@ char idx_to_text[] = {
|
||||
0x81, 0x00, 0x00, 0x00, 'x', 0x00, 0x00, 0x00, /* 0xf8-0xff */
|
||||
};
|
||||
|
||||
|
||||
GPtrArray *
|
||||
mdb_read_indices(MdbTableDef *table)
|
||||
{
|
||||
MdbHandle *mdb = table->entry->mdb;
|
||||
MdbCatalogEntry *entry = table->entry;
|
||||
MdbHandle *mdb = entry->mdb;
|
||||
MdbFormatConstants *fmt = mdb->fmt;
|
||||
MdbIndex idx, *pidx;
|
||||
int i, j;
|
||||
int idx_num, key_num, col_num;
|
||||
int cur_pos;
|
||||
int name_sz;
|
||||
int name_sz, idx2_sz;
|
||||
gchar *tmpbuf;
|
||||
|
||||
/* FIX ME -- doesn't handle multipage table headers */
|
||||
|
||||
table->indices = g_ptr_array_new();
|
||||
|
||||
cur_pos = table->index_start + 39 * table->num_real_idxs;
|
||||
if (IS_JET4(mdb)) {
|
||||
cur_pos = table->index_start + 52 * table->num_real_idxs;
|
||||
idx2_sz = 27;
|
||||
|
||||
} else {
|
||||
cur_pos = table->index_start + 39 * table->num_real_idxs;
|
||||
idx2_sz = 19;
|
||||
}
|
||||
|
||||
for (i=0;i<table->num_idxs;i++) {
|
||||
memset(&idx, '\0', sizeof(MdbIndex));
|
||||
idx.table = table;
|
||||
idx.index_num = mdb_get_int16(mdb, cur_pos);
|
||||
cur_pos += 19;
|
||||
cur_pos +=4;
|
||||
idx.index_num = read_pg_if_16(mdb, &cur_pos);
|
||||
read_pg_if(mdb, &cur_pos, idx2_sz - 4);
|
||||
cur_pos += idx2_sz - 4;
|
||||
idx.index_type = mdb->pg_buf[cur_pos++];
|
||||
mdb_append_index(table->indices, &idx);
|
||||
}
|
||||
|
||||
for (i=0;i<table->num_idxs;i++) {
|
||||
pidx = g_ptr_array_index (table->indices, i);
|
||||
name_sz=mdb->pg_buf[cur_pos++];
|
||||
memcpy(pidx->name, &mdb->pg_buf[cur_pos], name_sz);
|
||||
pidx->name[name_sz]='\0';
|
||||
read_pg_if(mdb, &cur_pos, 0);
|
||||
if (IS_JET4(mdb)) {
|
||||
name_sz=read_pg_if_16(mdb, &cur_pos);
|
||||
cur_pos += 2;
|
||||
tmpbuf = g_malloc((name_sz + 1)*2);
|
||||
read_pg_if_n(mdb, tmpbuf, &cur_pos, name_sz*2);
|
||||
mdb_unicode2ascii(mdb, tmpbuf, 0, name_sz, pidx->name);
|
||||
g_free(tmpbuf);
|
||||
cur_pos += name_sz;
|
||||
} else {
|
||||
name_sz=mdb->pg_buf[cur_pos++];
|
||||
read_pg_if_n(mdb, pidx->name, &cur_pos, name_sz);
|
||||
pidx->name[name_sz]='\0';
|
||||
cur_pos += name_sz;
|
||||
}
|
||||
//fprintf(stderr, "index name %s\n", pidx->name);
|
||||
cur_pos += name_sz;
|
||||
}
|
||||
|
||||
cur_pos = table->index_start;
|
||||
mdb_read_alt_pg(mdb, entry->table_pg);
|
||||
mdb_read_pg(mdb, entry->table_pg);
|
||||
idx_num=0;
|
||||
for (i=0;i<table->num_real_idxs;i++) {
|
||||
if (IS_JET4(mdb)) cur_pos += 4;
|
||||
do {
|
||||
pidx = g_ptr_array_index (table->indices, idx_num++);
|
||||
} while (pidx && pidx->index_type==2);
|
||||
@@ -103,11 +135,13 @@ int name_sz;
|
||||
continue;
|
||||
}
|
||||
|
||||
pidx->num_rows = mdb_get_int32(mdb, 43+(i*8) );
|
||||
pidx->num_rows = _mdb_get_int32(mdb->alt_pg_buf,
|
||||
fmt->tab_cols_start_offset +
|
||||
(i*fmt->tab_ridx_entry_size));
|
||||
|
||||
key_num=0;
|
||||
for (j=0;j<MDB_MAX_IDX_COLS;j++) {
|
||||
col_num=mdb_get_int16(mdb,cur_pos);
|
||||
col_num=read_pg_if_16(mdb,&cur_pos);
|
||||
cur_pos += 2;
|
||||
if (col_num != 0xFFFF) {
|
||||
/* set column number to a 1 based column number and store */
|
||||
@@ -123,9 +157,11 @@ int name_sz;
|
||||
}
|
||||
pidx->num_keys = key_num;
|
||||
cur_pos += 4;
|
||||
pidx->first_pg = mdb_get_int32(mdb, cur_pos);
|
||||
pidx->first_pg = read_pg_if_32(mdb, &cur_pos);
|
||||
cur_pos += 4;
|
||||
read_pg_if(mdb, &cur_pos, 1);
|
||||
pidx->flags = mdb->pg_buf[cur_pos++];
|
||||
if (IS_JET4(mdb)) cur_pos += 9;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -569,7 +605,7 @@ mdb_choose_index(MdbTableDef *table, int *choice)
|
||||
}
|
||||
}
|
||||
/* and the winner is: *choice */
|
||||
if (!least) return MDB_TABLE_SCAN;
|
||||
if (least==99) return MDB_TABLE_SCAN;
|
||||
return MDB_INDEX_SCAN;
|
||||
}
|
||||
void
|
||||
@@ -590,6 +626,7 @@ mdb_index_scan_init(MdbHandle *mdb, MdbTableDef *table)
|
||||
mdb_read_pg(table->mdbidx, table->scan_idx->first_pg);
|
||||
//printf("best index is %s\n",table->scan_idx->name);
|
||||
}
|
||||
//printf("TABLE SCAN? %d\n", table->strategy);
|
||||
}
|
||||
void
|
||||
mdb_index_scan_free(MdbTableDef *table)
|
||||
|
@@ -19,6 +19,10 @@
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** Note: This code is mostly garbage right now...just a test to parse out the
|
||||
|
@@ -20,6 +20,10 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
//#define MDB_DEBUG_LIKE 1
|
||||
|
||||
int mdb_like_cmp(char *s, char *r)
|
||||
|
@@ -19,6 +19,10 @@
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
void mdb_init()
|
||||
{
|
||||
mdb_init_backends();
|
||||
|
@@ -20,6 +20,10 @@
|
||||
#include <stdio.h>
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
#define MAXPRECISION 9
|
||||
/*
|
||||
** these routines are copied from the freetds project which does something
|
||||
|
@@ -19,6 +19,10 @@
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
void
|
||||
mdb_sql_walk_tree(MdbSargNode *node, MdbSargTreeFunc func, gpointer data)
|
||||
{
|
||||
|
@@ -19,6 +19,10 @@
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
void
|
||||
mdb_stats_on(MdbHandle *mdb)
|
||||
{
|
||||
|
@@ -19,6 +19,10 @@
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
#define MDB_DEBUG_USAGE 0
|
||||
|
||||
static gint mdb_col_comparer(MdbColumn *a, MdbColumn *b)
|
||||
@@ -86,7 +90,8 @@ int rownum, row_start, row_end;
|
||||
** read the next page if offset is > pg_size
|
||||
** return true if page was read
|
||||
*/
|
||||
static int read_pg_if(MdbHandle *mdb, int *cur_pos, int offset)
|
||||
int
|
||||
read_pg_if(MdbHandle *mdb, int *cur_pos, int offset)
|
||||
{
|
||||
if (*cur_pos + offset >= mdb->fmt->pg_size) {
|
||||
mdb_read_pg(mdb, mdb_get_int32(mdb,4));
|
||||
@@ -95,6 +100,47 @@ static int read_pg_if(MdbHandle *mdb, int *cur_pos, int offset)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
guint32
|
||||
read_pg_if_32(MdbHandle *mdb, int *cur_pos)
|
||||
{
|
||||
unsigned char c[4];
|
||||
int i, rc = 0;
|
||||
|
||||
for (i=0;i<4;i++) {
|
||||
rc += read_pg_if(mdb, cur_pos, i);
|
||||
c[i] = mdb->pg_buf[(*cur_pos) + i];
|
||||
}
|
||||
return _mdb_get_int32(c, 0);
|
||||
}
|
||||
guint16
|
||||
read_pg_if_16(MdbHandle *mdb, int *cur_pos)
|
||||
{
|
||||
unsigned char low_byte, high_byte;
|
||||
int rc = 0;
|
||||
|
||||
rc += read_pg_if(mdb, cur_pos, 0);
|
||||
low_byte = mdb->pg_buf[*cur_pos];
|
||||
rc += read_pg_if(mdb, cur_pos, 1);
|
||||
high_byte = mdb->pg_buf[(*cur_pos) + 1];
|
||||
|
||||
return (high_byte * 256 + low_byte);
|
||||
}
|
||||
guint16
|
||||
read_pg_if_n(MdbHandle *mdb, unsigned char *buf, int *cur_pos, int len)
|
||||
{
|
||||
int half;
|
||||
|
||||
if (*cur_pos + len < mdb->fmt->pg_size) {
|
||||
memcpy(buf, &mdb->pg_buf[*cur_pos], len);
|
||||
return 0;
|
||||
}
|
||||
half = (mdb->fmt->pg_size - *cur_pos - 1);
|
||||
memcpy(buf, &mdb->pg_buf[*cur_pos], half);
|
||||
mdb_read_pg(mdb, mdb_get_int32(mdb,4));
|
||||
memcpy(buf, &mdb->pg_buf[8], len - half);
|
||||
*cur_pos = 8 - (mdb->fmt->pg_size - (*cur_pos));
|
||||
return 1;
|
||||
}
|
||||
|
||||
GPtrArray *mdb_read_columns(MdbTableDef *table)
|
||||
{
|
||||
|
@@ -21,6 +21,10 @@
|
||||
#include "time.h"
|
||||
#include "math.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
#define MDB_DEBUG_WRITE 1
|
||||
|
||||
void
|
||||
|
@@ -20,6 +20,10 @@
|
||||
#include "mdbsql.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
void mdb_dump_results(MdbSQL *sql);
|
||||
|
||||
#ifdef HAVE_WORDEXP_H
|
||||
@@ -74,19 +78,29 @@ MdbSQLSarg *sql_sarg;
|
||||
memset(sql_sarg->sarg,0,sizeof(MdbSarg));
|
||||
return sql_sarg;
|
||||
}
|
||||
void mdb_sql_free_column(MdbSQLColumn *c)
|
||||
{
|
||||
if (c->name) g_free(c->name);
|
||||
g_free(c);
|
||||
}
|
||||
MdbSQLColumn *mdb_sql_alloc_column()
|
||||
{
|
||||
MdbSQLColumn *c;
|
||||
|
||||
c = (MdbSQLColumn *) malloc(sizeof(MdbSQLColumn));
|
||||
c = (MdbSQLColumn *) g_malloc(sizeof(MdbSQLColumn));
|
||||
memset(c,0,sizeof(MdbSQLColumn));
|
||||
return c;
|
||||
}
|
||||
void mdb_sql_free_table(MdbSQLTable *t)
|
||||
{
|
||||
if (t->name) g_free(t->name);
|
||||
g_free(t);
|
||||
}
|
||||
MdbSQLTable *mdb_sql_alloc_table()
|
||||
{
|
||||
MdbSQLTable *t;
|
||||
|
||||
t = (MdbSQLTable *) malloc(sizeof(MdbSQLTable));
|
||||
t = (MdbSQLTable *) g_malloc(sizeof(MdbSQLTable));
|
||||
memset(t,0,sizeof(MdbSQLTable));
|
||||
return t;
|
||||
}
|
||||
@@ -387,6 +401,8 @@ MdbSQLSarg *sql_sarg;
|
||||
g_ptr_array_free(sql->columns,TRUE);
|
||||
g_ptr_array_free(sql->tables,TRUE);
|
||||
g_ptr_array_free(sql->sargs,TRUE);
|
||||
mdb_close(sql->mdb);
|
||||
mdb_free_handle(sql->mdb);
|
||||
}
|
||||
void mdb_sql_reset(MdbSQL *sql)
|
||||
{
|
||||
@@ -402,11 +418,11 @@ MdbSQLSarg *sql_sarg;
|
||||
}
|
||||
for (i=0;i<sql->num_columns;i++) {
|
||||
c = g_ptr_array_index(sql->columns,i);
|
||||
if (c->name) g_free(c->name);
|
||||
mdb_sql_free_column(c);
|
||||
}
|
||||
for (i=0;i<sql->num_tables;i++) {
|
||||
t = g_ptr_array_index(sql->tables,i);
|
||||
if (t->name) g_free(t->name);
|
||||
mdb_sql_free_table(t);
|
||||
}
|
||||
for (i=0;i<sql->num_sargs;i++) {
|
||||
sql_sarg = g_ptr_array_index(sql->sargs,i);
|
||||
|
@@ -1,5 +1,6 @@
|
||||
bin_PROGRAMS = mdb-export mdb-array mdb-schema mdb-tables mdb-parsecsv mdb-header mdb-sql mdb-ver prtable prcat prdata prkkd prdump prole updrow prindex
|
||||
LIBS = $(GLIB_LIBS) $(READLINE_LIBS) @LEXLIB@
|
||||
DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\"
|
||||
INCLUDES = -I$(top_srcdir)/include $(GLIB_CFLAGS)
|
||||
LDADD = ../libmdb/libmdb.la
|
||||
if SQL
|
||||
|
@@ -23,6 +23,10 @@
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
|
@@ -20,6 +20,10 @@
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
int
|
||||
dbcc_page_usage(MdbTableDef *table)
|
||||
{
|
||||
|
@@ -17,9 +17,12 @@
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
#define is_text_type(x) (x==MDB_TEXT || x==MDB_MEMO || x==MDB_SDATETIME)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
@@ -129,9 +132,11 @@ char *s;
|
||||
for (j=0;j<table->num_cols;j++) {
|
||||
free(bound_values[j]);
|
||||
}
|
||||
mdb_free_tabledef(table);
|
||||
}
|
||||
}
|
||||
|
||||
mdb_close(mdb);
|
||||
mdb_free_handle(mdb);
|
||||
mdb_exit();
|
||||
|
||||
|
@@ -18,10 +18,13 @@
|
||||
|
||||
/* this utility dumps the C headers for an existing database */
|
||||
/* it will create three files - types.h and dump_types.[ch] */
|
||||
|
||||
#include "mdbtools.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
void copy_header (FILE *f)
|
||||
{
|
||||
fprintf (f, "/******************************************************************/\n");
|
||||
|
@@ -19,11 +19,14 @@
|
||||
/* this utility converts a CSV from an existing database to a C file */
|
||||
/* input FOO.txt, output FOO.c */
|
||||
/* generates an array of type FOO */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
#define FILENAMESIZE 128
|
||||
#define BUFFERSIZE 4096
|
||||
#define LF 10
|
||||
|
@@ -17,9 +17,12 @@
|
||||
*/
|
||||
|
||||
/* this utility dumps the schema for an existing database */
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
|
@@ -16,7 +16,6 @@
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_READLINE
|
||||
#include <readline/readline.h>
|
||||
@@ -24,6 +23,10 @@
|
||||
#include <string.h>
|
||||
#include "mdbsql.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
void dump_results(MdbSQL *sql);
|
||||
void dump_results_pp(MdbSQL *sql);
|
||||
|
||||
@@ -415,6 +418,8 @@ FILE *in = NULL, *out = NULL;
|
||||
}
|
||||
mdb_sql_exit(sql);
|
||||
|
||||
free(mybuf);
|
||||
free(s);
|
||||
myexit(0);
|
||||
|
||||
return 0; /* make gcc -Wall happy */
|
||||
|
@@ -17,9 +17,12 @@
|
||||
*/
|
||||
|
||||
/* this utility dumps the schema for an existing database */
|
||||
|
||||
#include "mdbtools.h"
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@@ -84,7 +87,8 @@ int opt;
|
||||
if (!line_break)
|
||||
fprintf (stdout, "\n");
|
||||
|
||||
mdb_free_handle (mdb);
|
||||
mdb_close(mdb);
|
||||
mdb_free_handle(mdb);
|
||||
mdb_exit();
|
||||
if (delimiter) free(delimiter);
|
||||
|
||||
|
@@ -17,8 +17,13 @@
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "mdbtools.h"
|
||||
#include "mdbprivate.h"
|
||||
#include <locale.h>
|
||||
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
@@ -26,12 +31,15 @@ main(int argc, char **argv)
|
||||
MdbHandle *mdb;
|
||||
/* doesn't handle tables > 256 columns. Can that happen? */
|
||||
|
||||
/* setlocale (LC_ALL, ""); */
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
/*
|
||||
** optind is now the position of the first non-option arg,
|
||||
** see getopt(3)
|
||||
*/
|
||||
if (argc < 2) {
|
||||
fprintf(stderr,"Usage: %s <file>\n",argv[0]);
|
||||
fprintf(stderr,_("Usage: %s <file>\n"),argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -45,7 +53,7 @@ MdbHandle *mdb;
|
||||
} else if (IS_JET4(mdb)) {
|
||||
printf("JET4\n");
|
||||
} else {
|
||||
printf("unknown\n");
|
||||
printf(_("unknown database version\n"));
|
||||
}
|
||||
|
||||
mdb_free_handle(mdb);
|
||||
|
Reference in New Issue
Block a user