fix for linux
authorLaurent Mazet <mazet@softndesign.org>
Sun, 28 Apr 2024 12:31:42 +0000 (14:31 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Sun, 28 Apr 2024 12:31:42 +0000 (14:31 +0200)
cmore.c
tui.c

diff --git a/cmore.c b/cmore.c
index 43ae48f5a66602d94b1f53ac4f242048942680b5..d439217c13e0e4a0e480ee3dc8adea5802818276 100644 (file)
--- 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 <stdlib.h>
 
@@ -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 47945cfe1a2742f70dd8e974acded5a5d77fec42..61d69befedac5883fc427782bdeb79a48bd369c4 100644 (file)
--- 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();
 }