summaryrefslogtreecommitdiff
path: root/databases/dbf/files/patch-dbf.c
diff options
context:
space:
mode:
authorMikhail Teterin <mi@FreeBSD.org>2004-04-16 19:49:52 +0000
committerMikhail Teterin <mi@FreeBSD.org>2004-04-16 19:49:52 +0000
commita06290b8cf792d259c7743a91954114c87ddbe4d (patch)
treef2c152ffd5e382ad6391699df8eacf0391f1ecf2 /databases/dbf/files/patch-dbf.c
parentBack out last checkin. The listed file must be from some dependency. (diff)
Update from 0.8.1 to 0.8.3. Fix bugs...
Notes
Notes: svn path=/head/; revision=107263
Diffstat (limited to 'databases/dbf/files/patch-dbf.c')
-rw-r--r--databases/dbf/files/patch-dbf.c60
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)