changes designed so that ESIS and ARP may use routing table
[unix-history] / usr / src / usr.bin / systat / cmds.c
index f16878a..c8c887e 100644 (file)
@@ -1,6 +1,12 @@
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)cmds.c     1.7 (Berkeley) %G%";
-#endif
+static char sccsid[] = "@(#)cmds.c     5.7 (Berkeley) %G%";
+#endif not lint
 
 /*
  * Command support.
 
 /*
  * Command support.
@@ -15,7 +21,6 @@ command(cmd)
         register char *cp;
         register struct cmdtab *p;
        int interval, omask;
         register char *cp;
         register struct cmdtab *p;
        int interval, omask;
-        char *arg;
 
        omask = sigblock(sigmask(SIGALRM));
         for (cp = cmd; *cp && !isspace(*cp); cp++)
 
        omask = sigblock(sigmask(SIGALRM));
         for (cp = cmd; *cp && !isspace(*cp); cp++)
@@ -89,11 +94,13 @@ command(cmd)
                        }
                        p = curcmd;
                }
                        }
                        p = curcmd;
                }
-                curcmd = p;
                if ((p->c_flags & CF_INIT) == 0) {
                if ((p->c_flags & CF_INIT) == 0) {
-                       (*p->c_init)();
-                       p->c_flags |= CF_INIT;
+                       if ((*p->c_init)())
+                               p->c_flags |= CF_INIT;
+                       else
+                               goto done;
                }
                }
+                curcmd = p;
                labels();
                 display();
                 status();
                labels();
                 display();
                 status();
@@ -115,7 +122,7 @@ lookup(name)
 
        longest = 0;
        nmatches = 0;
 
        longest = 0;
        nmatches = 0;
-       found = 0;
+       found = (struct cmdtab *) 0;
        for (c = cmdtab; p = c->c_name; c++) {
                for (q = name; *q == *p++; q++)
                        if (*q == 0)            /* exact match? */
        for (c = cmdtab; p = c->c_name; c++) {
                for (q = name; *q == *p++; q++)
                        if (*q == 0)            /* exact match? */
@@ -144,13 +151,14 @@ status()
 suspend()
 {
         int oldmask;
 suspend()
 {
         int oldmask;
+       extern sig_t sigtstpdfl;
 
        alarm(0);
         move(CMDLINE, 0);
         refresh();
         echo();
         nocrmode();
 
        alarm(0);
         move(CMDLINE, 0);
         refresh();
         echo();
         nocrmode();
-        signal(SIGTSTP, SIG_DFL);
+        signal(SIGTSTP, sigtstpdfl);
         oldmask = sigsetmask(0);
         kill(getpid(), SIGTSTP);
         sigsetmask(oldmask);
         oldmask = sigsetmask(0);
         kill(getpid(), SIGTSTP);
         sigsetmask(oldmask);
@@ -158,7 +166,6 @@ suspend()
         crmode();
         noecho();
         move(CMDLINE, col);
         crmode();
         noecho();
         move(CMDLINE, col);
-        wrefresh(curscr);
        alarm(naptime);
 }
 
        alarm(naptime);
 }