diff options
Diffstat (limited to 'databases/dbf/files/patch-dbf.c')
-rw-r--r-- | databases/dbf/files/patch-dbf.c | 60 |
1 files changed, 43 insertions, 17 deletions
diff --git a/databases/dbf/files/patch-dbf.c b/databases/dbf/files/patch-dbf.c index 4a9c1f003094..2f78adce4eb5 100644 --- a/databases/dbf/files/patch-dbf.c +++ b/databases/dbf/files/patch-dbf.c @@ -1,6 +1,20 @@ ---- dbf.c.orig Thu Nov 20 05:22:03 2003 -+++ dbf.c Fri Apr 2 17:01:43 2004 -@@ -341,7 +341,7 @@ +--- dbf.c Fri Apr 16 08:17:22 2004 ++++ dbf.c Fri Apr 16 15:31:29 2004 +@@ -245,11 +245,11 @@ + int dbfhandle; + FILE *output = NULL; + int header_length, record_length, i; +- const char *filename, *export_filename; ++ const char *filename, *export_filename = NULL; + headerMethod writeHeader = NULL; + lineMethod writeLine = printDBF; + unsigned char *record; +- char *flag_byte; ++ char flag_byte; + + if (argc < 2) { + fprintf(stderr, "Usage: %s [option][argument] dbf-file, -h for help\n", *argv); +@@ -342,7 +342,7 @@ if (verbosity > 0) banner(); @@ -9,19 +23,31 @@ output = stdout; else output = export_open(export_filename); -@@ -357,6 +357,7 @@ - exit(1); - - if (writeLine) { -+ char *flag_byte; - if ((record = malloc(record_length + 1)) == NULL) { - perror("malloc"); exit(1); - } -@@ -369,7 +370,6 @@ - //lseek(dbfhandle, rotate2b(db->header_length) + 1, SEEK_SET); - - /* At this point we look if the following data set is deleted */ -- char *flag_byte; +@@ -372,12 +372,7 @@ + /* At this point we look if the following data set is deleted */ lseek(dbfhandle, rotate2b(db->header_length), SEEK_SET); - if ( (flag_byte = malloc(1)) == NULL ) { +- if ( (flag_byte = malloc(1)) == NULL ) { +- perror("malloc"); +- exit(1); +- } +- +- if ( -1 == read(dbfhandle, flag_byte, 1) ) { ++ if ( -1 == read(dbfhandle, &flag_byte, 1) ) { + perror("reading Flag Byte"); + exit(1); + } +@@ -389,11 +384,11 @@ + exit(1); + } + +- if (*flag_byte == '*' && keep_deleted == 0) { ++ if (flag_byte == '*' && keep_deleted == 0) { + fputc('#', output); + } + +- *flag_byte = *(record + record_length - 1); ++ flag_byte = *(record + record_length - 1); + + /* automaticly convert options */ + if (convert) |