diff options
Diffstat (limited to 'src/print_volume.c')
-rw-r--r-- | src/print_volume.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/print_volume.c b/src/print_volume.c index e28a132..4c0fbde 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; @@ -61,7 +63,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char * free(instance); } -#ifndef __OpenBSD__ +#if !defined(__DragonFly__) && !defined(__OpenBSD__) /* Try PulseAudio first */ /* If the device name has the format "pulse[:N]" where N is the |