Hello,
I have fixed several problems and made ---I think--- some improvements.
Some bugs were serious ones. In particular, the `init' function in
pgdump.c was not initializing correctly a structure causing random
data to be passed to PG.
I have not looked in the bug base, but these should close some bugs
referenced there.
Here is the ChangeLog :
main.c:
- Added option to set the DELIMITER to a user defined character
value (only used for super-user when using COPY command);
-> Now PgDumpFromDBF takes 3 arguments: filename, mode and delimiter
- PgDumpFromDBF proto removed from main.c and added to
pgdump.h;
- include <string.h> for strlen
- include "pgdump.h" for PgDumpFromDBF proto
- Default delimiter now changed to '\t';
- Suppressed bogus parm structure ;
- no_rattle -> normal_user: more explicit, match PgDumpFromDBF and
... well the way the assignement was made was queer: changed too!
- Added comments
pgdump.h:
- created for PgDumpFromDBF proto
pgdump.c:
-XXX in the `init' function used to initialize the my_string struct
the initial string pointed to by the data member was not initialized
to NULL.
Hence, the use of the function `append', not taking into account
the length of the string and using `strcat' directly concatenated
the random data found where my_string.data was pointing until it
found some '\0'
=> Now my_string.data points to a null string at initialization;
- include "pgdump.h" for PgDumpFromDBF proto
- modified PgDumpFromDBF: now takes 4 arguments:
filename, normal_user, delimiter, null_string
- modified DBFDumpASCII: now takes 3 arguments:
DBFHandle, File pointer, delimiter
-dbfopen.c:
- the filename of the DBF file supposed to be opened was
subject of extension changes, `strcmp' being used as if it was a
matching function returning 0 if failed or not zero on success.
And indeed this is almost exactly the contrary.
Furthermore, the combination of two conditions made the first
test succeeds in all cases, transforming every extension in ".dbf".
-Last but not least, _without renaming or copying the file that
was read not written_ this was this modified version of the
filename that was given to `fopen' resulting in a
failure in every case except when the change to ".dbf" was a
null one, that is when the filename was already ending with ".dbf".
Cheers,
--
Thierry Laronde (Alceste) <tlaronde@polynum.org>
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
(attachments)
pg.in.dbf.patch (13.5 KB)
pg.in.dbf.html.patch (2.7 KB)