summaryrefslogtreecommitdiffstats
path: root/sys-utils/ldattach.c
diff options
context:
space:
mode:
authorSami Kerola2011-11-02 19:07:34 +0100
committerSami Kerola2011-11-02 19:10:24 +0100
commit3a134012040d2d9f42398a393a3217e1ad86155b (patch)
tree20cdfce4731adf24337eba8cb7fd54573fb1770d /sys-utils/ldattach.c
parentldattach: check numeric user inputs with strtol_or_err (diff)
downloadkernel-qcow2-util-linux-3a134012040d2d9f42398a393a3217e1ad86155b.tar.gz
kernel-qcow2-util-linux-3a134012040d2d9f42398a393a3217e1ad86155b.tar.xz
kernel-qcow2-util-linux-3a134012040d2d9f42398a393a3217e1ad86155b.zip
ldattach: convert debug macro to function
warning: ISO C does not permit named variadic macros Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/ldattach.c')
-rw-r--r--sys-utils/ldattach.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/sys-utils/ldattach.c b/sys-utils/ldattach.c
index 1cbf37396..e05cefef6 100644
--- a/sys-utils/ldattach.c
+++ b/sys-utils/ldattach.c
@@ -28,12 +28,6 @@
#include "nls.h"
#include "strutils.h"
-#define dbg(format, arg...) \
- do { \
- if (debug) \
- fprintf(stderr, "%s:" format "\n", progname, ## arg); \
- } while (0)
-
#ifndef N_GIGASET_M101
# define N_GIGASET_M101 16
#endif
@@ -99,6 +93,22 @@ static const struct ld_table ld_iflags[] =
{ NULL, 0 }
};
+void dbg(char *fmt, ...)
+{
+ va_list args;
+
+ if (debug == 0)
+ return;
+ fflush(NULL);
+ fprintf(stderr, "%s: ", program_invocation_short_name);
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
+ fprintf(stderr, "\n");
+ fflush(NULL);
+ return;
+}
+
static int lookup_table(const struct ld_table *tab, const char *str)
{
const struct ld_table *t;
@@ -235,7 +245,7 @@ int main(int argc, char **argv)
NULL)) >= 0) {
switch (optc) {
case 'd':
- debug++;
+ debug = 1;
break;
case '1':
case '2':