Recently Written · git

sad

sad (2f30.org simple audio daemon) with a Cygwin/OSS port on branch cygwin

git clone https://github.com/equwal/sad

Log | Files | Refs


commit 3ad4bb3590b76992d937e4ac30af5ed1d46b0a88
sin <sin@2f30.org>
2015-01-14 19:49:16 +0000

Use else-if as only one of these is possible at a time

 cmd.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/cmd.c b/cmd.c
index bdefde7..32429cf 100644
--- a/cmd.c
+++ b/cmd.c
@@ -26,19 +26,13 @@ cmdstatus(int fd, char *arg)
 	if (!strncmp(arg, "random", 7)) {
 		ok = 1;
 		dprintf(fd, "%d\n", getplaylistmode() & RANDOM == 1);
-	}
-
-	if (!strncmp(arg, "repeat", 7)) {
+	} else if (!strncmp(arg, "repeat", 7)) {
 		ok = 1;
 		dprintf(fd, "%d\n", getplaylistmode() & REPEAT == 1);
-	}
-
-	if (!strncmp(arg, "single", 7)) {
+	} else if (!strncmp(arg, "single", 7)) {
 		ok = 1;
 		dprintf(fd, "%d\n", getplaylistmode() & SINGLE == 1);
-	}
-
-	if (!strncmp(arg, "songid", 7)) {
+	} else if (!strncmp(arg, "songid", 7)) {
 		ok = 1;
 		s = getcursong();
 
@@ -48,9 +42,7 @@ cmdstatus(int fd, char *arg)
 		}
 
 		dprintf(fd, "%d\n", s->id);
-	}
-
-	if (!strncmp(arg, "playback", 9)) {
+	} else if (!strncmp(arg, "playback", 9)) {
 		ok = 1;
 		s = getcursong();