home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.lbl.gov
/
2014.05.ftp.ee.lbl.gov.tar
/
ftp.ee.lbl.gov
/
bmd-1.0beta.tar.Z
/
bmd-1.0beta.tar
/
bmd-1.0beta
/
app
/
omtd
/
command.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-01-22
|
1KB
|
70 lines
/*
* Copyright (c) 1990 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Lawrence Berkeley Laboratory,
* Berkeley, CA. The name of the University may not be used to
* endorse or promote products derived from this software without
* specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#include "command.h"
struct command {
char *cmd_name;
void (*cmd_fn)();
};
struct command cmdtbl[] = {
CMDS
};
int
do_command(cmd, args)
char *cmd;
struct token **args;
{
struct command *p;
for (p = cmdtbl; p->cmd_name != 0; ++p) {
if (strcmp(p->cmd_name, cmd) == 0) {
(*p->cmd_fn)(args);
return 0;
}
}
return -1;
}
void
quit_command(args)
struct token **args;
{
/* XXX Save state in /tmp file. */
exit(0);
}
void
stop_command(args)
struct token **args;
{
printf("STOP\n");
ptokens(args);
}
void
print_command(args)
struct token **args;
{
printf("PRINT\n");
ptokens(args);
}