From: Laurent Mazet Date: Sun, 28 Apr 2024 12:31:42 +0000 (+0200) Subject: fix for linux X-Git-Tag: cmore-1.0~33 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=39699220377d8af6379580392105f274fcfbb2ab;p=cmore.git fix for linux --- diff --git a/cmore.c b/cmore.c index 43ae48f..d439217 100644 --- a/cmore.c +++ b/cmore.c @@ -1,6 +1,6 @@ /* depend: */ /* cflags: */ -/* linker: cmd.o debug.o tui.o -lpdcurses */ +/* linker: cmd.o debug.o tui.o -lncurses */ #include @@ -8,6 +8,10 @@ #include "debug.h" #include "tui.h" +/* static variables */ +char *progname = NULL; +char *version = "0.1"; + int display (char **lines, int xmax, int ymax) { int stop = 0; @@ -33,7 +37,7 @@ int display (char **lines, int xmax, int ymax) switch (key) { case 'q': case KEY_ESC: - stop = 1; + exit (0); break; case 'i': case KEY_UP: @@ -43,8 +47,8 @@ int display (char **lines, int xmax, int ymax) case KEY_DOWN: skip = (lines[skip + 1] != NULL) ? skip + 1 : skip; break; - case ALT_F: - case ALT_H: + case BUTTON_ALT+'f': //ALT_F: + case BUTTON_ALT+'h': //ALT_H: stop = 2; break; } @@ -85,7 +89,7 @@ void exec_ipconfig (void) static int index = 0; switch (index) { - case 0: view ("ipconfig"); break; + case 0: view ("ifconfig"); break; case 1: view ("ps aux"); break; case 2: view ("ls"); break; } @@ -124,10 +128,7 @@ menu MainMenu[] = void init (void) { - int rc = view ("ipconfig"); - if (!rc) { - mainmenu (MainMenu); - } + view ("ifconfig"); } /* help message */ @@ -146,10 +147,8 @@ int usage (int ret) /* main function */ int main (int argc, char *argv[]) { - int rc = 0; char *input = NULL; char *command = NULL; - char c; /* get basename */ char *pt = progname = argv[0]; @@ -180,8 +179,8 @@ int main (int argc, char *argv[]) break; case 'f': arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL; - if ((arg) && (file == NULL)) { - file = arg; + if ((arg) && (input == NULL)) { + input = arg; } else { VERBOSE (ERROR, fprintf (stderr, "%s: error for file '%s'\n", progname, arg)); return usage (1); diff --git a/tui.c b/tui.c index 47945cf..61d69be 100644 --- a/tui.c +++ b/tui.c @@ -579,9 +579,8 @@ void startmenu(menu *mp, char *mtitle, FUNC init) menudim(mp, &nitems, &barlen); repaintmainmenu(barlen, mp); (*init)(); - } else { - mainmenu(mp); } + mainmenu(mp); cleanup(); }