void updateDisplay() { erase(); initWins(); // Get files and directories getEntries(); printHead(); printMenus(); }
int main (int argc, char *argv[]) { int argn; int termFd; char cmdline[256]; /* this is kinda pointless, cause we're probably not going to be getting input from anything but stdin */ termFd = 0; initWins(); /* set up curses interface */ fd = mspInit("/dev/abus"); if (fd < 0) exit (0); wprintw (termWin, "mspterm - %s\n", version_date); /* we also need to cause devId 0x51 to be abmgr, 0x50 to be ab, */ /* and 0x52 to be serial. Real devs will be numbered after that */ /* probably this should happen in abmgrInit(). */ /* handle commandline args */ for (argn=1; argn!=argc; argn++) { if (*argv[argn] == '-') { if (strcmp (argv[argn], "-h") == 0) { fprintf (stderr, usage, argv[0]); quit (0); } } } signal (SIGTERM, quit); signal (SIGINT, quit); signal (SIGHUP, quit); do { fd_set realset, rset; wprintw (termWin, PROMPT, destId); wrefresh (termWin); /* we need to reset this each time through */ FD_ZERO (&realset); FD_SET (fd, &realset); FD_SET (termFd, &realset); do { /* has to be reset, cause select unsets it */ rset = realset; /* block until read ready on one of msps or termWin */ select (10, &rset, NULL, NULL, NULL); /* deal with everyone that needs to be read */ if (FD_ISSET (fd, &rset) && fd != termFd) { abtSelect(fd); wrefresh(termWin); } /* feed the user from time to time */ } while (!FD_ISSET (termFd, &rset)); wgetstr (termWin, cmdline); } while (parse_line (cmdline)); /* exit gracefully */ quit (0); return (0); }