1 /* This file is part of GDBM, the GNU data base manager.
2    Copyright (C) 2011-2021 Free Software Foundation, Inc.
3 
4    GDBM is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 3, or (at your option)
7    any later version.
8 
9    GDBM is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13 
14    You should have received a copy of the GNU General Public License
15    along with GDBM. If not, see <http://www.gnu.org/licenses/>.   */
16 
17 #include <stdlib.h>
18 #include <stdarg.h>
19 #include "gettext.h"
20 #ifdef HAVE_LOCALE_H
21 # include <locale.h>
22 #endif
23 
24 extern const char *progname;
25 
26 void set_progname (const char *arg);
27 void gdbm_perror (const char *fmt, ...);
28 void sys_perror (int code, const char *fmt, ...);
29 void error (const char *fmt, ...);
30 void verror (const char *fmt, va_list ap);
31 
32 void *emalloc (size_t size);
33 void *erealloc (void *ptr, size_t size);
34 void *ecalloc (size_t nmemb, size_t size);
35 void *ezalloc (size_t size);
36 char *estrdup (const char *str);
37 void *e2nrealloc (void *p, size_t *pn, size_t s);
38 
39 #define PARSEOPT_HIDDEN 0x01
40 #define PARSEOPT_ALIAS  0x02
41 
42 struct gdbm_option
43 {
44   int opt_short;
45   char *opt_long;
46   char *opt_arg;
47   char *opt_descr;
48   int opt_flags;
49 };
50 
51 int parseopt_first (int pc, char **pv, struct gdbm_option *options);
52 int parseopt_next (void);
53 void parseopt_print_help (void);
54 
55 extern char *parseopt_program_name;
56 extern char *parseopt_program_doc;
57 extern char *parseopt_program_args;
58 
59 /* Application exit codes */
60 #define EXIT_OK      0
61 #define EXIT_FATAL   1
62 #define EXIT_MILD    2
63 #define EXIT_USAGE   3
64 
65