echo.c File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static int echo (int argc, char **argv)
static int loop (int argc, char **argv)
 mycmd_init (loop, loop,"cmds","loop")
 mycmd_init (verbose, verbose,"cmds","verbose [on|off|fd number]")
 mycmd_init (echo_off, echo,"","echo off")
 mycmd_init (echo_on, echo,"","echo on")
 mycmd_init (echo, echo,"cmds","echo")
static int verbose (int argc, char **argv)


Function Documentation

static int echo ( int  argc,
char **  argv 
) [static]

Definition at line 1 of file echo.c.

References showcmd.

00002 {
00003         int i;
00004 if(!strcmp(argv[0],"echo_on")){showcmd=1;return 0;}
00005 else if(!strcmp(argv[0],"echo_off")){showcmd=0;return 0;}
00006 
00007         for(i=1;i<argc;i++)
00008         printf("%s ",argv[i]);
00009         printf("\n");
00010 return 0;       
00011 }

static int loop ( int  argc,
char **  argv 
) [static]

Definition at line 36 of file echo.c.

References do_cmd().

00037 {
00038 unsigned int i;
00039 char buf[100]="";
00040 if (argc<3) return -1;
00041 for(i=2;i<argc;i++)
00042 {
00043  strcat(buf,argv[i]);
00044  strcat(buf," ");
00045 }
00046 
00047         for(i=0;i<strtoul(argv[1],0,0);i++)
00048         do_cmd(buf);
00049 }

Here is the call graph for this function:

mycmd_init ( loop  ,
loop  ,
"cmds"  ,
"loop"   
)

mycmd_init ( verbose  ,
verbose  ,
"cmds"  ,
"verbose "  [on|off|fd number] 
)

mycmd_init ( echo_off  ,
echo  ,
""  ,
"echo off"   
)

mycmd_init ( echo_on  ,
echo  ,
""  ,
"echo on"   
)

mycmd_init ( echo  ,
echo  ,
"cmds"  ,
"echo"   
)

static int verbose ( int  argc,
char **  argv 
) [static]

Definition at line 13 of file echo.c.

References fd.

00014 {
00015 if (argc<2) return -1;
00016  if (!strcmp(argv[1],"off")) {
00017          int fd;
00018          fd=open("/dev/null",O_WRONLY);
00019          close(2);
00020          dup2(fd,2);
00021          close(fd);
00022          return 0;
00023  }
00024  else if (!strcmp(argv[1],"on")) {
00025          close(2);
00026          dup(1,2);
00027          return 0;
00028  }
00029 else {
00030          close(2);
00031          dup(strtoul(argv[1],0,0),2);
00032          return 0;
00033  }
00034 }


Generated on Fri Nov 5 07:24:48 2010 for ejtag debug tools for loongson 232 cpu by  doxygen 1.5.6