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'
}
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