From 331f05ac9c58d358806fe1bcba88a01467ab0895 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Mon, 4 Jul 2022 13:41:43 +0300
Subject: [PATCH] Bugfix

* tools/gdbm_load.c (main): Restore accidentally removed parameter.
* tools/gdbmapp.h (GDBM_PRINTFLIKE): New macro
(gdbm_perror, sys_perror, error): Mark as printf-like.
---
 tools/gdbm_load.c |  2 +-
 tools/gdbmapp.h   | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/gdbm_load.c b/tools/gdbm_load.c
index e7e2ab1..78ab6a8 100644
--- a/tools/gdbm_load.c
+++ b/tools/gdbm_load.c
@@ -238,7 +238,7 @@ main (int argc, char **argv)
 
   if (argc > 2)
     {
-      error (_("too many arguments; try `%s -h' for more info"));
+      error (_("too many arguments; try `%s -h' for more info"), progname);
       exit (EXIT_USAGE);
     }
 
diff --git a/tools/gdbmapp.h b/tools/gdbmapp.h
index 1bccb3d..94c04f6 100644
--- a/tools/gdbmapp.h
+++ b/tools/gdbmapp.h
@@ -21,12 +21,16 @@
 # include <locale.h>
 #endif
 
+#ifndef GDBM_PRINTFLIKE
+# define GDBM_PRINTFLIKE(fmt,narg) __attribute__ ((__format__ (__printf__, fmt, narg)))
+#endif
+
 extern const char *progname;
 
 void set_progname (const char *arg);
-void gdbm_perror (const char *fmt, ...);
-void sys_perror (int code, const char *fmt, ...);
-void error (const char *fmt, ...);
+void gdbm_perror (const char *fmt, ...) GDBM_PRINTFLIKE(1,2);
+void sys_perror (int code, const char *fmt, ...) GDBM_PRINTFLIKE(2,3);
+void error (const char *fmt, ...) GDBM_PRINTFLIKE(1,2);
 void verror (const char *fmt, va_list ap);
 
 void *emalloc (size_t size);
-- 
2.33.0

