summaryrefslogtreecommitdiffstats
path: root/plugins/wdc/wdc-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/wdc/wdc-utils.c')
-rw-r--r--plugins/wdc/wdc-utils.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/wdc/wdc-utils.c b/plugins/wdc/wdc-utils.c
index 80d9955..2740181 100644
--- a/plugins/wdc/wdc-utils.c
+++ b/plugins/wdc/wdc-utils.c
@@ -144,3 +144,18 @@ int wdc_UtilsStrCompare(char *pcSrc, char *pcDst)
return *pcSrc - *pcDst;
}
+void wdc_StrFormat(char *formatter, size_t fmt_sz, char *tofmt, size_t tofmtsz)
+{
+
+ fmt_sz = snprintf(formatter,fmt_sz, "%-*.*s",
+ (int)tofmtsz, (int)tofmtsz, tofmt);
+ /* trim() the obnoxious trailing white lines */
+ while (fmt_sz) {
+ if (formatter[fmt_sz - 1] != ' ' && formatter[fmt_sz - 1] != '\0') {
+ formatter[fmt_sz] = '\0';
+ break;
+ }
+ fmt_sz--;
+ }
+}
+