Rev 10 | Rev 8185 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 10 | Rev 7491 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | */ |
16 | */ |
17 | 17 | ||
18 | /* daemon command processing */ |
18 | /* daemon command processing */ |
19 | 19 | ||
20 |
|
20 | /* testing routine. Don't touch! */ |
21 | void cmd_test(char *p) |
21 | void cmd_test(char *p) |
22 | { |
22 | { |
23 | } |
23 | } |
24 | 24 | ||
25 | void cmd_ping(char *p) |
25 | void cmd_ping(char *p) |
Line 66... | Line 66... | ||
66 | 66 | ||
67 | struct { |
67 | struct { |
68 | char *name; |
68 | char *name; |
69 | void (*routine) (char *p); |
69 | void (*routine) (char *p); |
70 | } cmdlist[]={ |
70 | } cmdlist[]={ |
71 | {"forkcnt", |
71 | {"forkcnt", cmd_forklist}, |
72 | {"forkcount", cmd_forklist}, |
72 | {"forkcount", cmd_forklist}, |
73 | {"forklist", |
73 | {"forklist", cmd_forklist}, |
74 | {"getscore", |
74 | {"getscore", cmd_getscore}, |
75 | {"ping", |
75 | {"ping", cmd_ping}, |
76 | {"readfile", |
76 | {"readfile", cmd_readfile}, |
77 | {"record", |
77 | {"record", cmd_record}, |
78 | {"recordcnt", cmd_recordcnt}, |
78 | {"recordcnt", cmd_recordcnt}, |
79 | {"recordcount", cmd_recordcnt}, |
79 | {"recordcount", cmd_recordcnt}, |
80 | {"recordno", |
80 | {"recordno", cmd_recordcnt}, |
81 | {"recordnum", cmd_recordcnt}, |
81 | {"recordnum", cmd_recordcnt}, |
82 | {"scorelog", |
82 | {"scorelog", cmd_scorelog}, |
83 | {"test", |
83 | {"test", cmd_test}, |
84 | }; |
84 | }; |
85 | #define cmdcnt (sizeof(cmdlist)/sizeof(cmdlist[0])) |
85 | #define cmdcnt (sizeof(cmdlist)/sizeof(cmdlist[0])) |
86 | 86 | ||
87 | void cmd(void) |
87 | void cmd(void) |
88 | { |
88 | { |
89 | char *p1, *p2, cmdline[MAX_LINELEN+1]; |
89 | char *p1, *p2, cmdline[MAX_LINELEN+1]; |
90 | int i; |
90 | int i; |
91 | 91 | ||
92 | errno=0; |
92 | errno=0; |
93 | p1=find_word_start(textptr); p2=find_word_end(p1); |
93 | p1=find_word_start(textptr); p2=find_word_end(p1); |
94 | if(*p2) *p2++=0; |
94 | if(*p2) *p2++=0; |
95 | i=search_list(cmdlist,cmdcnt,sizeof(cmdlist[0]),p1); |
95 | i=search_list(cmdlist,cmdcnt,sizeof(cmdlist[0]),p1); |
96 | if(i<0) {sockerror(2,"bad_cmd %s",p1); return;} |
96 | if(i<0) {sockerror(2,"bad_cmd %s",p1); return;} |