aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/flatfile.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/flatfile.c b/src/flatfile.c
index 4589864..5b96d5f 100644
--- a/src/flatfile.c
+++ b/src/flatfile.c
@@ -27,12 +27,10 @@
extern const char * gdbm_version;
+#endif
+
int
gdbm_export (GDBM_FILE dbf, const char *exportfile, int flags, int mode)
-#else
-int
-gdbm_export (GDBM_FILE dbf, const char *exportfile, int flags, int mode)
-#endif
{
int nfd, size;
datum key, nextkey, data;
@@ -41,7 +39,8 @@ gdbm_export (GDBM_FILE dbf, const char *exportfile, int flags, int mode)
int count = 0;
/* Only support GDBM_WCREAT or GDBM_NEWDB */
- switch (flags) {
+ switch (flags)
+ {
case GDBM_WRCREAT:
nfd = open (exportfile, O_WRONLY | O_CREAT | O_EXCL, mode);
if (nfd == -1)
@@ -66,7 +65,7 @@ gdbm_export (GDBM_FILE dbf, const char *exportfile, int flags, int mode)
#endif
return -1;
}
-
+
/* Write out the text header. */
if (write (nfd, header1, strlen (header1)) != strlen (header1))
goto write_fail;
@@ -100,15 +99,15 @@ gdbm_export (GDBM_FILE dbf, const char *exportfile, int flags, int mode)
free (key.dptr);
free (data.dptr);
key = nextkey;
-
+
count++;
}
close (nfd);
-
+
return count;
-
-write_fail:
-
+
+ write_fail:
+
gdbm_errno = GDBM_FILE_WRITE_ERROR;
return -1;
}

Return to:

Send suggestions and report system problems to the System administrator.