1 /* export.c - Stand alone flat file exporter for older versions of GDBM. */
3 /* This file is part of GDBM, the GNU data base manager.
4 Copyright (C) 2007, Free Software Foundation, Inc.
6 GDBM is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 GDBM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GDBM. If not, see <http://www.gnu.org/licenses/>. */
19 /* Include system configuration before all else. */
26 /* Pull in gdbm_export() */
32 printf ("Usage: %s database outfile\n", s);
33 printf (" or: %s [-hv]\n", s);
34 printf ("Convert GDBM database into a flat dump format.\n");
35 printf ("Linked with %s\n", gdbm_version);
37 printf ("Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
44 printf ("gdbmexport (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION);
45 printf ("Copyright (C) 2007 Free Software Foundation, Inc.\n");
46 printf ("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n");
47 printf ("This is free software: you are free to change and redistribute it.\n");
48 printf ("There is NO WARRANTY, to the extent permitted by law.\n");
53 main(int argc, char *argv[])
59 while ((c = getopt (argc, argv, "hlv")) != -1)
85 dbf = gdbm_open (argv[1], 0, GDBM_READER | flags, 0600, NULL);
88 fprintf (stderr, "%s: couldn't open database, %s\n", argv[0],
89 gdbm_strerror (gdbm_errno));
93 if (gdbm_export (dbf, argv[2], GDBM_WRCREAT | flags, 0600) == -1)
95 fprintf (stderr, "%s: export failed, %s\n",
96 argv[0], gdbm_strerror (gdbm_errno));