From bdca080cce757ee7664f9038d18fb25493fc12f5 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 25 Apr 1999 22:14:06 +0000 Subject: [PATCH] Use braces to avoid potentially ambiguous else clause. main's return type is int not void. Reviewed by: obrien and chuckr --- gnu/lib/libdialog/menubox.c | 3 ++- gnu/lib/libdialog/tree.c | 6 ++++-- gnu/usr.bin/sort/sort.c | 2 +- gnu/usr.bin/tar/tar.c | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gnu/lib/libdialog/menubox.c b/gnu/lib/libdialog/menubox.c index 73d004adb6c0..9a5b0c254ebd 100644 --- a/gnu/lib/libdialog/menubox.c +++ b/gnu/lib/libdialog/menubox.c @@ -259,7 +259,7 @@ draw: else i = choice - 1; } - else if (KEY_IS_DOWN(key)) + else if (KEY_IS_DOWN(key)) { if (choice == max_choice - 1) { if (scroll + choice < item_no - 1) { /* Scroll menu up */ @@ -285,6 +285,7 @@ draw: } else i = choice + 1; + } if (i != choice) { /* De-highlight current item */ diff --git a/gnu/lib/libdialog/tree.c b/gnu/lib/libdialog/tree.c index e48f134d5ffa..43c7399abbdd 100644 --- a/gnu/lib/libdialog/tree.c +++ b/gnu/lib/libdialog/tree.c @@ -315,7 +315,7 @@ int dialog_treemenu(unsigned char *title, unsigned char *prompt, else i = choice - 1; } - else if (key == KEY_DOWN || key == '+') + else if (key == KEY_DOWN || key == '+') { if (choice == max_choice - 1) { if (scroll+choice < item_no-1) { #ifdef BROKEN_WSCRL @@ -352,6 +352,7 @@ int dialog_treemenu(unsigned char *title, unsigned char *prompt, } else i = choice + 1; + } if (i != choice) { /* De-highlight current item */ @@ -987,7 +988,7 @@ mk_tree(unsigned char **names, int size, unsigned char FS, in_string = name = names[i]; while(*in_string) { - if (*in_string == FS) + if (*in_string == FS) { if (!i && !*(in_string + 1)) name = in_string; else @@ -995,6 +996,7 @@ mk_tree(unsigned char **names, int size, unsigned char FS, shift++; name = in_string + 1; } + } in_string++; } array[i].name = name; diff --git a/gnu/usr.bin/sort/sort.c b/gnu/usr.bin/sort/sort.c index c1d9004cc2e0..f1976b4ff560 100644 --- a/gnu/usr.bin/sort/sort.c +++ b/gnu/usr.bin/sort/sort.c @@ -1719,7 +1719,7 @@ set_ordering (register const char *s, struct keyfield *key, return (char *) s; } -void +int main (int argc, char **argv) { struct keyfield *key = NULL, gkey; diff --git a/gnu/usr.bin/tar/tar.c b/gnu/usr.bin/tar/tar.c index f0d63efd81e4..b50cbbb8cf00 100644 --- a/gnu/usr.bin/tar/tar.c +++ b/gnu/usr.bin/tar/tar.c @@ -197,7 +197,7 @@ struct option long_options[] = /* * Main routine for tar. */ -void +int main (argc, argv) int argc; char **argv;