Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:remove unnecessary headers
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:56b3b1a867e6bd50fecab40f4bf47965c1722c15
User & Date: brandon 2016-06-12 14:07:06
Context
2016-06-12
15:11
cleanup zdbr check-in: 7894bb786f user: brandon tags: trunk
14:07
remove unnecessary headers check-in: 56b3b1a867 user: brandon tags: trunk
2016-05-27
19:58
Clean up more warnings in zdbc * zdbc.c (parse_opt): Correct a long-standing bug in setting the mmap_size and num_buckets. Clean up warnings. Set a more sensible default memmap size (128KiB). check-in: c96b0c4ae3 user: brandon tags: trunk
Changes

Changes to ChangeLog.







1
2
3
4
5
6
7






2016-05-26  Brandon Invergo  <brandon@invergo.net>

	* src/zdb.c (zdb_open): Always create a new database with zdbc.
	Support more open flags: sync, no-mmap, and no-lock
	* src/zdb*.c (main): Support extra opening flags

2013-11-17  Brandon Invergo  <brandon@invergo.net>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
2016-05-27  Brandon Invergo  <brandon@invergo.net>

	* src/zdbc.c (parse_opt): Correct a long-standing bug in setting
	the mmap_size and num_buckets.  Clean up warnings.  Set a more
	sensible default memmap size (128KiB).

2016-05-26  Brandon Invergo  <brandon@invergo.net>

	* src/zdb.c (zdb_open): Always create a new database with zdbc.
	Support more open flags: sync, no-mmap, and no-lock
	* src/zdb*.c (main): Support extra opening flags

2013-11-17  Brandon Invergo  <brandon@invergo.net>

Changes to INSTALL.

1
2
3
4
5
6
7
8
9
10
11
Installation Instructions
*************************

   Copyright (C) 1994-1996, 1999-2002, 2004-2015 Free Software
Foundation, Inc.

   Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.  This file is offered as-is,
without warranty of any kind.




|







1
2
3
4
5
6
7
8
9
10
11
Installation Instructions
*************************

   Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
Foundation, Inc.

   Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.  This file is offered as-is,
without warranty of any kind.

Changes to bootstrap.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
....
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
#! /bin/sh
# Print a version string.
scriptversion=2014-12-08.12; # UTC

# Bootstrap this package from checked-out sources.

# Copyright (C) 2003-2015 Free Software Foundation, Inc.

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
................................................................................

# Ensure that CDPATH is not set.  Otherwise, the output from cd
# would cause trouble in at least one use below.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH

local_gl_dir=gl

# Honour $PERL, but work even if there is none
PERL="${PERL-perl}"

me=$0

usage() {
  cat <<EOF
Usage: $me [OPTION]...
................................................................................

echo "$0: done.  Now you can run './configure'."

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:


|



|







 







|







 







|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
....
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
#! /bin/sh
# Print a version string.
scriptversion=2016-01-24.06; # UTC

# Bootstrap this package from checked-out sources.

# Copyright (C) 2003-2016 Free Software Foundation, Inc.

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
................................................................................

# Ensure that CDPATH is not set.  Otherwise, the output from cd
# would cause trouble in at least one use below.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH

local_gl_dir=gl

# Honor $PERL, but work even if there is none.
PERL="${PERL-perl}"

me=$0

usage() {
  cat <<EOF
Usage: $me [OPTION]...
................................................................................

echo "$0: done.  Now you can run './configure'."

# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

Changes to src/Makefile.am.

24
25
26
27
28
29
30
31
32
33
34
35
36
37
zdbf_LDADD = $(LDADD)
zdbr_LDADD = $(LDADD)
zdbs_LDADD = $(LDADD)

AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(srcdir)
bin_PROGRAMS = zdbc zdbf zdbr zdbs

zdbc_SOURCES = zdbc.c zdbc.h zdb.c zdb.h
zdbf_SOURCES = zdbf.c zdbf.h zdb.c zdb.h
zdbr_SOURCES = zdbr.c zdbr.h zdb.c zdb.h
zdbs_SOURCES = zdbs.c zdbs.h zdb.c zdb.h

check-syntax:
	$(CC) $(CFLAGS) $(LIBS) -I. -I.. -Wall -Wextra -pedantic -std=c99 -fsyntax-only $(CHK_SOURCES)







|
|
|
|



24
25
26
27
28
29
30
31
32
33
34
35
36
37
zdbf_LDADD = $(LDADD)
zdbr_LDADD = $(LDADD)
zdbs_LDADD = $(LDADD)

AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(srcdir)
bin_PROGRAMS = zdbc zdbf zdbr zdbs

zdbc_SOURCES = zdbc.c zdb.c zdb.h
zdbf_SOURCES = zdbf.c zdb.c zdb.h
zdbr_SOURCES = zdbr.c zdb.c zdb.h
zdbs_SOURCES = zdbs.c zdb.c zdb.h

check-syntax:
	$(CC) $(CFLAGS) $(LIBS) -I. -I.. -Wall -Wextra -pedantic -std=c99 -fsyntax-only $(CHK_SOURCES)

Changes to src/zdbc.c.

14
15
16
17
18
19
20










21
22

23
24
25
26
27
28
29
30
31
32
33
34
35
36
...
165
166
167
168
169
170
171
172
173
174
175
176
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/











#include "zdbc.h"


const char *argp_program_version = PACKAGE_STRING;
const char *argp_program_bug_address = PACKAGE_BUGREPORT;
static void *database;

static char doc[] =
  "zdbc -- a tool for creating a DBM database";

static char args_doc[] = "DATABASE";

static struct argp_option options[] = {
  {"mmap-size",   (int) 'm', "NUM", 0,
   "The size (in bytes) of the memory-mapped region to use (default=1024)", 0},
  {"num-buckets", (int) 'b', "NUM", 0,
   "The number of buckets to use (default=100)", 0},
................................................................................

  /* open the database */
  database = zdb_create (arguments.args[0], arguments.mmap_size,
                         arguments.num_buckets,  arguments.verbose, mode);
  if (!database)
    error (EXIT_FAILURE, errno,
           "Failed to create database %s", arguments.args[0]);
  else if (zdb_close (database, arguments.verbose))
    error (EXIT_FAILURE, errno,
           "Failed to close database %s", arguments.args[0]);
  exit (EXIT_SUCCESS);
}







>
>
>
>
>
>
>
>
>
>
|

>



<


<







 







|




14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

37
38

39
40
41
42
43
44
45
...
174
175
176
177
178
179
180
181
182
183
184
185
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/

#define _GNU_SOURCE

#include <config.h>
#include <string.h>
#include "error.h"
#include "argp.h"
#include <signal.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include "zdb.h"

const char *program_name = "zdbc";
const char *argp_program_version = PACKAGE_STRING;
const char *argp_program_bug_address = PACKAGE_BUGREPORT;
static void *database;

static char doc[] =
  "zdbc -- a tool for creating a DBM database";

static char args_doc[] = "DATABASE";

static struct argp_option options[] = {
  {"mmap-size",   (int) 'm', "NUM", 0,
   "The size (in bytes) of the memory-mapped region to use (default=1024)", 0},
  {"num-buckets", (int) 'b', "NUM", 0,
   "The number of buckets to use (default=100)", 0},
................................................................................

  /* open the database */
  database = zdb_create (arguments.args[0], arguments.mmap_size,
                         arguments.num_buckets,  arguments.verbose, mode);
  if (!database)
    error (EXIT_FAILURE, errno,
           "Failed to create database %s", arguments.args[0]);
  else if (zdb_close (database, arguments.verbose) != 0)
    error (EXIT_FAILURE, errno,
           "Failed to close database %s", arguments.args[0]);
  exit (EXIT_SUCCESS);
}

Deleted src/zdbc.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*  zdbc.h

    Copyright © 2013, 2016 Brandon Invergo <brandon@invergo.net>

    This file is part of zeptodb

    zeptodb is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    zeptodb is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef ZDBC_H
#define ZDBC_H
#define _GNU_SOURCE

#include <config.h>

#include <string.h>
#include "error.h"
#include "argp.h"
#include <signal.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>

#include "zdb.h"

char *program_name = "zdbc";

void termination_handler (int);

#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































Changes to src/zdbf.c.

14
15
16
17
18
19
20








21
22

23
24
25
26
27
28
29
30
31
32
33
34

35

36

37
38

39
40

41
42

43
44

45
46
47
48
49
50
51
52
...
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
...
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
...
213
214
215
216
217
218
219
220
221


222
223
224
225
226
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/









#include "zdbf.h"


const char *argp_program_version = PACKAGE_STRING;
const char *argp_program_bug_address = PACKAGE_BUGREPORT;
void *database;

static char doc[] =
  "zdbf -- a tool for fetching records from a DBM database\v"
  "If an input file is provided, lines are read from it as individual queries, "
  "otherwise queries are taken from stdin.";

static char args_doc[] = "DATABASE";

static struct argp_option options[] = {

  {"input", 'i', "FILE", 0, "Read queries from a file"},

  {"all", 'a', 0, 0, "Fetch all the records in the database"},

  {"delim", 'd', "CHAR", 0, "Character to print between keys and values."
   "Keys will not be printed if left unspecified."},

  {"sync", 's', 0, 0, "Automatically synchronize all database operations to the"
   " disk"},

  {"no-lock", 'l', 0, 0, "Do not perform any locking of the database file"},
#ifdef HAVE_GDBM

  {"no-mmap", 'n', 0, 0, "Do not memory-map the database file"},
#endif

  {"verbose", 'v', 0, 0, "Print extra information."},
  {0}
};

struct arguments
{
  char *args[1];
  char *input_file;
................................................................................
      break;
    default:
      return ARGP_ERR_UNKNOWN;
    }
  return 0;
}

static struct argp argp = { options, parse_opt, args_doc, doc };

int
fetchqueries (void *db, FILE * input, char *delim)
{
  /*
   * This function fetches records from the database from queries
   * in a file object.
   */

................................................................................
      strncpy (key_str, lineptr, sizeof (char) * (key_size));
      key_str[key_size] = '\0';
      if (zdb_fetch (db, key_str, key_size, delim))
        error (0, errno, "Key does not exist in the database: %s", key_str);
      free (key_str);
    }
  free (lineptr);
  return (0);
}

void
termination_handler (int signum)
{
  printf ("Interrupt caught, closing database\n");
  if (zdb_close (database, false))
    error (EXIT_FAILURE, errno, "Failed to close database");
  else
    exit (EXIT_SUCCESS);
}
................................................................................
  else
    input = fopen (arguments.input_file, "r");
  if (!input)
    error (EXIT_FAILURE, errno,
           "Failed to open input file %s", arguments.input_file);
  fetchqueries (database, input, arguments.delim);

  fclose (input);



  if (zdb_close (database, arguments.verbose))
    error (EXIT_FAILURE, errno,
           "Failed to close database %s", arguments.args[0]);
  exit (EXIT_SUCCESS);
}







>
>
>
>
>
>
>
>
|

>


|
<




<



>
|
>
|
>
|
|
>
|
<
>
|

>
|

>
|







 







|

|







 







<


|
|







 







|
<
>
>
|




14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

35
36
37
38

39
40
41
42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
...
153
154
155
156
157
158
159

160
161
162
163
164
165
166
167
168
169
170
...
225
226
227
228
229
230
231
232

233
234
235
236
237
238
239
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/

#define _GNU_SOURCE

#include <config.h>
#include <string.h>
#include "error.h"
#include "argp.h"
#include <signal.h>
#include <stdbool.h>
#include "zdb.h"

const char *program_name = "zdbf";
const char *argp_program_version = PACKAGE_STRING;
const char *argp_program_bug_address = PACKAGE_BUGREPORT;
static void *database;

static char doc[] =
  "zdbf -- a tool for fetching records from a DBM database\v"
  "If an input file is provided, lines are read from it as individual queries, "
  "otherwise queries are taken from stdin.";

static char args_doc[] = "DATABASE";

static struct argp_option options[] = {
  {"input", (int)'i', "FILE", 0,
   "Read queries from a file", 0},
  {"all", (int)'a', 0, 0,
   "Fetch all the records in the database", 0},
  {"delim", (int)'d', "CHAR", 0,
   "Character to print between keys and values.  Keys will not be printed if "
   "left unspecified.", 0},
  {"sync", (int)'s', 0, 0,
   "Automatically synchronize all database operations to the disk", 0},

  {"no-lock", (int)'l', 0, 0,
   "Do not perform any locking of the database file", 0},
#ifdef HAVE_GDBM
  {"no-mmap", (int)'n', 0, 0,
   "Do not memory-map the database file", 0},
#endif
  {"verbose", (int)'v', 0, 0,
   "Print extra information.", 0},
  {0}
};

struct arguments
{
  char *args[1];
  char *input_file;
................................................................................
      break;
    default:
      return ARGP_ERR_UNKNOWN;
    }
  return 0;
}

static struct argp argp = {options, parse_opt, args_doc, doc, NULL, NULL, NULL};

static void
fetchqueries (void *db, FILE * input, char *delim)
{
  /*
   * This function fetches records from the database from queries
   * in a file object.
   */

................................................................................
      strncpy (key_str, lineptr, sizeof (char) * (key_size));
      key_str[key_size] = '\0';
      if (zdb_fetch (db, key_str, key_size, delim))
        error (0, errno, "Key does not exist in the database: %s", key_str);
      free (key_str);
    }
  free (lineptr);

}

static void
termination_handler (int signum __attribute__ ((unused)))
{
  printf ("Interrupt caught, closing database\n");
  if (zdb_close (database, false))
    error (EXIT_FAILURE, errno, "Failed to close database");
  else
    exit (EXIT_SUCCESS);
}
................................................................................
  else
    input = fopen (arguments.input_file, "r");
  if (!input)
    error (EXIT_FAILURE, errno,
           "Failed to open input file %s", arguments.input_file);
  fetchqueries (database, input, arguments.delim);

  if (fclose (input) != 0)

    error (EXIT_FAILURE, errno,
           "Failed to close input file %s", arguments.input_file);
  if (zdb_close (database, arguments.verbose) != 0)
    error (EXIT_FAILURE, errno,
           "Failed to close database %s", arguments.args[0]);
  exit (EXIT_SUCCESS);
}

Deleted src/zdbf.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*  zdbf.h

    Copyright © 2011, 2012, 2013 Brandon Invergo <brandon@invergo.net>

    This file is part of zeptodb

    zeptodb is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    zeptodb is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef ZDBF_H
#define ZDBF_H
#define _GNU_SOURCE

#include <config.h>

#include <string.h>
#include "error.h"
#include "argp.h"
#include <signal.h>
#include <stdbool.h>

#include "zdb.h"

char *program_name = "zdbf";

int fetchqueries (void *, FILE *, char *);
void termination_handler (int);

#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Changes to src/zdbr.c.

14
15
16
17
18
19
20








21
22

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/









#include "zdbr.h"


const char *argp_program_version = PACKAGE_STRING;
const char *argp_program_bug_address = PACKAGE_BUGREPORT;
void *database;

static char doc[] =
  "zdbr -- a tool for removing records from a DBM database\v"
  "If an input file is provided, lines are read from it as individual queries, "
  "otherwise queries are taken from stdin. Note that if you have removed "
  "many records from the database, some fragmentation can occur, in which case "
  "it is recommended to reorganize the database. If the 'reorganize' argument "
  "is passed, the database will be reorganized after any records have been "
  "removed";

static char args_doc[] = "DATABASE";

static struct argp_option options[] = {
  {"input", 'i', "FILE", 0, "Read queries from a file"},
  {"reorganize", 'r', 0, 0, "Reorganize the database"},
  {"sync", 's', 0, 0, "Automatically synchronize all database operations to the"
   " disk"},







>
>
>
>
>
>
>
>
|

>



<








<







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/

#define _GNU_SOURCE

#include <config.h>
#include <string.h>
#include "error.h"
#include "argp.h"
#include <signal.h>
#include <stdbool.h>
#include "zdb.h"

const char *program_name = "zdbr";
const char *argp_program_version = PACKAGE_STRING;
const char *argp_program_bug_address = PACKAGE_BUGREPORT;
void *database;

static char doc[] =
  "zdbr -- a tool for removing records from a DBM database\v"
  "If an input file is provided, lines are read from it as individual queries, "
  "otherwise queries are taken from stdin. Note that if you have removed "
  "many records from the database, some fragmentation can occur, in which case "
  "it is recommended to reorganize the database. If the 'reorganize' argument "
  "is passed, the database will be reorganized after any records have been "
  "removed";

static char args_doc[] = "DATABASE";

static struct argp_option options[] = {
  {"input", 'i', "FILE", 0, "Read queries from a file"},
  {"reorganize", 'r', 0, 0, "Reorganize the database"},
  {"sync", 's', 0, 0, "Automatically synchronize all database operations to the"
   " disk"},

Deleted src/zdbr.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*  zdbr.h

    Copyright © 2011, 2012, 2013 Brandon Invergo <brandon@invergo.net>

    This file is part of zeptodb

    zeptodb is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    zeptodb is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef ZDBR_H
#define ZDBR_H
#define _GNU_SOURCE

#include <config.h>

#include <string.h>
#include "error.h"
#include "argp.h"
#include <signal.h>
#include <stdbool.h>

#include "zdb.h"

char *program_name = "zdbr";

int remrecords (void *, FILE *, bool);
void termination_handler (int);

#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































Changes to src/zdbs.c.

14
15
16
17
18
19
20








21
22

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/









#include "zdbs.h"


const char *argp_program_version = PACKAGE_STRING;
const char *argp_program_bug_address = PACKAGE_BUGREPORT;
void *database;

static char doc[] =
  "zdbs -- a tool for storing records in a DBM database\v"
  "If an input file is provided, lines are read from it as new records, "
  "otherwise records are added from stdin. Records are expected in the "
  "format KEY|VALUE.";

static char args_doc[] = "DATABASE";

static struct argp_option options[] = {
  {"input", 'i', "FILE", 0, "Read new records from a file"},
  {"delim", 'd', "CHAR", 0,
   "Character used to separate keys from values (default '|')"},
  {"sync", 's', 0, 0, "Automatically synchronize all database operations to the"







>
>
>
>
>
>
>
>
|

>



<





<







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

35
36
37
38
39

40
41
42
43
44
45
46
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/

#define _GNU_SOURCE

#include <config.h>
#include <string.h>
#include "error.h"
#include "argp.h"
#include <signal.h>
#include <stdbool.h>
#include "zdb.h"

const char *program_name = "zdbs";
const char *argp_program_version = PACKAGE_STRING;
const char *argp_program_bug_address = PACKAGE_BUGREPORT;
void *database;

static char doc[] =
  "zdbs -- a tool for storing records in a DBM database\v"
  "If an input file is provided, lines are read from it as new records, "
  "otherwise records are added from stdin. Records are expected in the "
  "format KEY|VALUE.";

static char args_doc[] = "DATABASE";

static struct argp_option options[] = {
  {"input", 'i', "FILE", 0, "Read new records from a file"},
  {"delim", 'd', "CHAR", 0,
   "Character used to separate keys from values (default '|')"},
  {"sync", 's', 0, 0, "Automatically synchronize all database operations to the"

Deleted src/zdbs.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*  zdbs.h

    Copyright © 2011, 2012, 2013 Brandon Invergo <brandon@invergo.net>

    This file is part of zeptodb

    zeptodb is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    zeptodb is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with zeptodb.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef ZDBS_H
#define ZDBS_H
#define _GNU_SOURCE

#include <config.h>

#include <string.h>
#include "error.h"
#include "argp.h"
#include <signal.h>
#include <stdbool.h>

#include "zdb.h"

char *program_name = "zdbs";

int addrecords (void *, FILE *, const char *, bool);
void termination_handler (int);

#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<