Back to index

wims  3.65+svn20090927
Defines | Functions | Variables
cmd.c File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define cmdcnt   (sizeof(cmdlist)/sizeof(cmdlist[0]))

Functions

void cmd_test (char *p)
void cmd_ping (char *p)
void cmd_forklist (char *p)
void cmd_readfile (char *p)
void cmd_record (char *p)
void cmd_recordcnt (char *p)
void cmd (void)

Variables

struct {
char * name
void(* routine )(char *p)
cmdlist []

Define Documentation

#define cmdcnt   (sizeof(cmdlist)/sizeof(cmdlist[0]))

Definition at line 85 of file cmd.c.


Function Documentation

void cmd ( void  )

Definition at line 87 of file cmd.c.

{
    char *p1, *p2, cmdline[MAX_LINELEN+1];
    int i;
    
    errno=0;
    p1=find_word_start(textptr); p2=find_word_end(p1);
    if(*p2) *p2++=0;
    i=search_list(cmdlist,cmdcnt,sizeof(cmdlist[0]),p1);
    if(i<0) {sockerror(2,"bad_cmd %s",p1); return;}
    mystrncpy(cmdline,find_word_start(p2),sizeof(cmdline));
    memmove(textbuf,"OK\n",4);
    cmdlist[i].routine(cmdline);
}

Here is the call graph for this function:

void cmd_forklist ( char *  p)

Definition at line 34 of file cmd.c.

{
    snprintf(textbuf+3,MAX_LINELEN,"%d",forkcnt);
}
void cmd_ping ( char *  p)

Definition at line 25 of file cmd.c.

{
    char *p1;
    int qtest;
    p1=find_word_start(p); *find_word_end(p1)=0;
    if(*p1!=0 && qbuf[0]!=0 && wordchr(qbuf,p1)!=NULL) qtest=1; else qtest=0;
    snprintf(textbuf+3,MAX_LINELEN,"%d %s\n%s",qtest,loadavg,ipbuf);
}

Here is the call graph for this function:

void cmd_readfile ( char *  p)

Definition at line 39 of file cmd.c.

{
    char *cut[2];
    int l;
    cutwords(p,cut,2);
    if(cut[1][0]) l=evalue(cut[1]); else l=MAX_LINELEN-16;
    if(l<=0 || cut[0][0]==0) return;
    if(l>BUFFERLEN-16) l=BUFFERLEN-16;
    readfile(cut[0],textbuf+3,l);
}

Here is the call graph for this function:

void cmd_record ( char *  p)

Definition at line 50 of file cmd.c.

{
    char *cut[2];
    cutwords(p,cut,2);
    if(cut[1][0]==0) return;
    datafile_fnd_record(cut[1],atoi(cut[0]),textbuf+3);
}

Here is the call graph for this function:

void cmd_recordcnt ( char *  p)

Definition at line 58 of file cmd.c.

{
    char *p1;
    p1=find_word_start(p);
    if(*p1==0) return;
    *find_word_end(p1)=0;
    snprintf(textbuf+3,16,"%d",datafile_recordnum(p1));
}

Here is the call graph for this function:

void cmd_test ( char *  p)

Definition at line 21 of file cmd.c.

{
}

Variable Documentation

struct { ... } cmdlist[]