diff options
-rw-r--r-- | menudriver.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/menudriver.c b/menudriver.c index 7447e73..5071ad2 100644 --- a/menudriver.c +++ b/menudriver.c @@ -66,6 +66,7 @@ static int read_next(size_t n, char buf[static n]) for (char *end = strchr(buf, '\n'); isspace(*end); end--) { *end = '\0'; } + return 1; } @@ -177,7 +178,8 @@ int lastval(char *last) void menudrive(const char *menuviewer, const char *viewer, char *dir) { - char next[40] = "", last[40] = "."; + char next[40] = ""; + char last[40] = "."; int bad = 0; @@ -216,13 +218,9 @@ void menudrive(const char *menuviewer, const char *viewer, char *dir) if (strcmp(next, ".") == 0) { strcpy(next, last); /* repeat last option */ - } - - if (strcmp(next, "+") == 0 && lastval(last)) { + } else if (strcmp(next, "+") == 0 && lastval(last)) { (void)sprintf(next, "%d", atoi(last) + 1); - } - - if (strcmp(next, "-") == 0 && lastval(last)) { + } else if (strcmp(next, "-") == 0 && lastval(last)) { (void)sprintf(next, "%d", atoi(last) - 1); } |