env.c File Reference

#include <unistd.h>

Include dependency graph for env.c:

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

Go to the source code of this file.

Functions

int cmd_msleep (int argc, char **argv)
int cmd_setenv (int argc, char **argv)
 mycmd_init (msleep, cmd_msleep,"msleep ms","sleep ms")
 mycmd_init (setenv, cmd_setenv,"setenv [env] [val]","set environment")

Variables

char ** environ


Function Documentation

int cmd_msleep ( int  argc,
char **  argv 
)

Definition at line 25 of file env.c.

00026 {
00027 usleep(strtoul(argv[1],0,0)*1000);
00028 return 0;
00029 }

int cmd_setenv ( int  argc,
char **  argv 
)

Definition at line 3 of file env.c.

References environ.

00004 {
00005         int i;
00006         if(argc==1)
00007         {
00008         for(i=0; environ[i];i++)
00009                 printf("%s\n",environ[i]);
00010         }
00011         else if(argc==2)
00012         {
00013          char *env=getenv(argv[1]);
00014          if(env)printf("%s=%s\n",argv[1],env);
00015          else printf("%s is not set\n",argv[1]);
00016         }
00017         else 
00018         {
00019                 setenv(argv[1],argv[2],1);
00020         }
00021 
00022         return 0;
00023 }

mycmd_init ( msleep  ,
cmd_msleep  ,
"msleep ms"  ,
"sleep ms"   
)

mycmd_init ( setenv  ,
cmd_setenv  ,
"setenv "  [env][val],
"set environment"   
)


Variable Documentation

char** environ

Referenced by cmd_karg(), and cmd_setenv().


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