aboutsummaryrefslogtreecommitdiff
path: root/src/gdbmtool.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-07-13 10:58:45 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2016-07-13 10:58:45 +0300
commit6810fb9cda131a9fabd1615f9a7c2cf1c904c24c (patch)
treee86b7386fe680d2c75bc7c929324a12d66a19c36 /src/gdbmtool.h
parent89f200b55b309aa67c1fbfc11d4de211725348f4 (diff)
downloadgdbm-6810fb9cda131a9fabd1615f9a7c2cf1c904c24c.tar.gz
gdbm-6810fb9cda131a9fabd1615f9a7c2cf1c904c24c.tar.bz2
gdbmtool: define macros for accessing typed handler arguments.
* src/gdbmtool.h (PARAM_STRING, PARAM_DATUM) (PARAM_KVPAIR): New defines. * src/gdbmtool.c: Use above for accessing handler arguments.
Diffstat (limited to 'src/gdbmtool.h')
-rw-r--r--src/gdbmtool.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/gdbmtool.h b/src/gdbmtool.h
index d0e9aa0..028b66e 100644
--- a/src/gdbmtool.h
+++ b/src/gdbmtool.h
@@ -24,7 +24,14 @@
#include <stdarg.h>
#include <ctype.h>
-#define ARG_UNUSED __attribute__ ((__unused__))
+#ifndef GDBM_ARG_UNUSED
+# define GDBM_ARG_UNUSED __attribute__ ((__unused__))
+#endif
+
+#ifndef GDBM_PRINTFLIKE
+# define GDBM_PRINTFLIKE(fmt,narg) \
+ __attribute__ ((__format__ (__printf__, fmt, narg)))
+#endif
/* Position in input file */
struct point
@@ -92,9 +99,11 @@ typedef struct locus gdbm_yyltype_t;
while (0)
void vlerror (struct locus *loc, const char *fmt, va_list ap);
-void lerror (struct locus *loc, const char *fmt, ...);
+void lerror (struct locus *loc, const char *fmt, ...)
+ GDBM_PRINTFLIKE (2, 3);
-void terror (const char *fmt, ...);
+void terror (const char *fmt, ...)
+ GDBM_PRINTFLIKE (1, 2);
char *make_prompt (void);
@@ -185,6 +194,10 @@ struct handler_param
void *data;
};
+#define PARAM_STRING(p,n) ((p)->argv[n]->v.string)
+#define PARAM_DATUM(p,n) ((p)->argv[n]->v.dat)
+#define PARAM_KVPAIR(p,n) ((p)->argv[n]->v.kvpair)
+
void gdbmarglist_init (struct gdbmarglist *, struct gdbmarg *);
void gdbmarglist_add (struct gdbmarglist *, struct gdbmarg *);
void gdbmarglist_free (struct gdbmarglist *lst);
@@ -285,7 +298,7 @@ void dsprint (FILE *fp, int what, struct dsegm *ds);
char *mkfilename (const char *dir, const char *file, const char *suf);
char *tildexpand (char *s);
int vgetyn (const char *prompt, va_list ap);
-int getyn (const char *prompt, ...);
+int getyn (const char *prompt, ...) GDBM_PRINTFLIKE (1, 2);
int getnum (int *pnum, char *arg, char **endp);
int get_screen_lines (void);

Return to:

Send suggestions and report system problems to the System administrator.