]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
ldattach: convert debug macro to function
authorSami Kerola <kerolasa@iki.fi>
Wed, 2 Nov 2011 18:07:34 +0000 (19:07 +0100)
committerSami Kerola <kerolasa@iki.fi>
Wed, 2 Nov 2011 18:10:24 +0000 (19:10 +0100)
warning: ISO C does not permit named variadic macros

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/ldattach.c

index 1cbf37396f116d8fe6158e377a357c4a3181fbb6..e05cefef62bcb123dd860609b8ef18ac2b5785f5 100644 (file)
 #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':