/* depend: */
/* cflags: */
-/* linker: cmd.o debug.o tui.o -lpdcurses */
+/* linker: cmd.o debug.o tui.o -lncurses */
#include <stdlib.h>
#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;
switch (key) {
case 'q':
case KEY_ESC:
- stop = 1;
+ exit (0);
break;
case 'i':
case KEY_UP:
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;
}
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;
}
void init (void)
{
- int rc = view ("ipconfig");
- if (!rc) {
- mainmenu (MainMenu);
- }
+ view ("ifconfig");
}
/* help message */
/* 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];
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);
menudim(mp, &nitems, &barlen);
repaintmainmenu(barlen, mp);
(*init)();
- } else {
- mainmenu(mp);
}
+ mainmenu(mp);
cleanup();
}