]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Insread of building one big format string:
authorAidan Van Dyk <aidan@ifax.com>
Mon, 26 Jun 2006 17:12:43 +0000 (17:12 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Mon, 26 Jun 2006 17:12:43 +0000 (17:12 +0000)
   printf("<-s fmt><value fmt><-e fmt>", name, value)
it keeps them separate:
   printf("<-s fmt>", name)
   printf("<value fmt>" value)
   printf("<-e fmt>", name);

This makes the -s -e formats much easier to understand, and leads to
simpler formats needed, like:

old format                      new format
-------------------             -----------------
-s '%.0s'                       -s ''
-e '%1$s'                       -e '%s'

util/faxinfo.c++

index 2bbaaf3e086e565f786fac7b6b3741be1d8b5818..cdc603ff600668b668e900466120e5d3cdff2e3c 100644 (file)
@@ -128,14 +128,15 @@ printStart (const char* filename)
 }
 
 static void
-printField (const char* val_fmt, ...)
+printField (const char* val_fmt, const char* name, ...)
 {
     char fmt[256];
-    snprintf(fmt, sizeof(fmt), "%s%s%s", fieldStart, val_fmt, fieldEnd);
+    printf(fieldStart, name);
     va_list ap;
-    va_start(ap,val_fmt);
-    vprintf(fmt, ap);
+    va_start(ap,name);
+    vprintf(val_fmt, ap);
     va_end(ap);
+    printf(fieldEnd, name);
 }
 
 static void