From 52e9f6f63b74db2a6a1d67524851649b18794950 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Sat, 2 Jun 2018 02:32:25 +0200 Subject: able to print percentage its now possible to have percentage before and after a variable. except for the date. But percentage with dates does not make much sense to me, so i skipped it. --- src/print_volume.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/print_volume.c') diff --git a/src/print_volume.c b/src/print_volume.c index e28a132..c5cf55b 100644 --- a/src/print_volume.c +++ b/src/print_volume.c @@ -35,15 +35,17 @@ static char *apply_volume_format(const char *fmt, char *outwalk, int ivolume) { for (; *walk != '\0'; walk++) { if (*walk != '%') { *(outwalk++) = *walk; - continue; - } - if (BEGINS_WITH(walk + 1, "%")) { + + } else if (BEGINS_WITH(walk + 1, "%")) { outwalk += sprintf(outwalk, "%s", pct_mark); walk += strlen("%"); - } - if (BEGINS_WITH(walk + 1, "volume")) { + + } else if (BEGINS_WITH(walk + 1, "volume")) { outwalk += sprintf(outwalk, "%d%s", ivolume, pct_mark); walk += strlen("volume"); + + } else { + *(outwalk++) = '%'; } } return outwalk; -- cgit v1.2.3