* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)cmds.c 5.6 (Berkeley) %G%";
register struct cmdtab
*p
;
omask
= sigblock(sigmask(SIGALRM
));
for (cp
= cmd
; *cp
&& !isspace(*cp
); cp
++)
for (; *cp
&& isspace(*cp
); cp
++)
if (strcmp(cmd
, "quit") == 0 || strcmp(cmd
, "q") == 0)
if (strcmp(cmd
, "load") == 0) {
if (strcmp(cmd
, "stop") == 0) {
mvaddstr(CMDLINE
, 0, "Refresh disabled.");
if (strcmp(cmd
, "help") == 0) {
for (p
= cmdtab
; p
->c_name
; p
++) {
addstr(p
->c_name
); col
+= len
;
(strcmp(cmd
, "start") == 0 || strcmp(cmd
, "interval") == 0)) {
interval
= *cp
? atoi(cp
) : naptime
;
error("%d: bad interval.", interval
);
if (p
== (struct cmdtab
*)-1) {
error("%s: Ambiguous command.", cmd
);
error("Couldn't open new display");
wnd
= (*curcmd
->c_open
)();
error("Couldn't change back to previous cmd");
if ((p
->c_flags
& CF_INIT
) == 0) {
if (curcmd
->c_cmd
== 0 || !(*curcmd
->c_cmd
)(cmd
, cp
))
error("%s: Unknown command.", cmd
);
register struct cmdtab
*c
, *found
;
register int nmatches
, longest
;
found
= (struct cmdtab
*) 0;
for (c
= cmdtab
; p
= c
->c_name
; c
++) {
for (q
= name
; *q
== *p
++; q
++)
if (*q
== 0) /* exact match? */
if (!*q
) { /* the name was a prefix */
if (q
- name
> longest
) {
} else if (q
- name
== longest
)
return ((struct cmdtab
*)-1);
error("Showing %s, refresh every %d seconds.",
curcmd
->c_name
, naptime
);
signal(SIGTSTP
, sigtstpdfl
);
signal(SIGTSTP
, suspend
);