summaryrefslogtreecommitdiff
path: root/src/print_volume.c
diff options
context:
space:
mode:
authorIngo Bürk <admin@airblader.de>2018-07-13 15:17:51 +0200
committerGitHub <noreply@github.com>2018-07-13 15:17:51 +0200
commitfc9da67e65819cb14071db4fd5b7941ab01a1134 (patch)
tree5f6ab7b574e6fad71cdd2d8ac21c19ba0768d936 /src/print_volume.c
parent9aafc38370e5f2b337643d22aa04f4d34208fb03 (diff)
parent52e9f6f63b74db2a6a1d67524851649b18794950 (diff)
Merge pull request #297 from Stunkymonkey/percent-first
able to print percentage
Diffstat (limited to 'src/print_volume.c')
-rw-r--r--src/print_volume.c12
1 files changed, 7 insertions, 5 deletions
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;