MALOC  0.1
vsh.h
Go to the documentation of this file.
1 
38 #ifndef _VSH_H_
39 #define _VSH_H_
40 
41 #include <maloc/maloc_base.h>
42 
43 #include <maloc/vsys.h>
44 
45 /*
46  * ***************************************************************************
47  * Class Vsh: Parameters and datatypes
48  * ***************************************************************************
49  */
50 
56 struct sVsh {
57 
61  int iMadeVmem;
62 
64  char processArgs;
65 
71  char **envValu;
73  char **envInfo;
74 
76  FILE *inUnit;
78  FILE *scUnit;
80  FILE *clUnit;
82  FILE *cinUnit;
85 
87  char PR[VMAX_ARGLEN];
92 
94  int cmdKey;
96  void *Ext_thee;
97 
99  char *buf;
101  int bufsize;
102 
104  int (*Ext_builtin)(void *thee, int argc, char **argv);
105 
106 };
107 
113 typedef struct sVsh Vsh;
114 
115 
116 /*
117  * ***************************************************************************
118  * Class Vsh: Inlineable methods (vsh.c)
119  * ***************************************************************************
120  */
121 
122 #if !defined(VINLINE_MALOC)
123 #else /* if defined(VINLINE_MALOC) */
124 #endif /* if !defined(VINLINE_MALOC) */
125 
126 
137 Vsh* Vsh_ctor(Vmem *vmem, int argc, char **argv);
138 
147 void Vsh_dtor(Vsh **thee);
148 
160 int Vsh_shell(Vsh *thee, char *pPR, void *pthee,
161  int (*builtin)(void *thee, int argc, char **argv));
162 
173 int Vsh_putenv(Vsh *thee, const char *envi, const char *valu);
174 
185 int Vsh_putenvInfo(Vsh *thee, const char *envi, const char *valu);
186 
197 int Vsh_putenvInt(Vsh *thee, const char *envi, const int valu);
198 
209 int Vsh_putenvReal(Vsh *thee, const char *envi, const double valu);
210 
220 char *Vsh_getenv(Vsh *thee, const char *envi);
221 
231 char *Vsh_getenvInfo(Vsh *thee, const char *envi);
232 
242 int Vsh_getenvInt(Vsh *thee, const char *envi);
243 
253 double Vsh_getenvReal(Vsh *thee, const char *envi);
254 
264 void Vsh_remove(Vsh *thee, const char *envi);
265 
274 void Vsh_wipe(Vsh *thee);
275 
284 void Vsh_memChk(Vsh *thee);
285 
295 Vio *Vsh_ioSetup(Vsh *thee, char *key);
296 
306 void Vsh_ioCleanup(Vsh *thee, Vio **sock);
307 
308 #endif /* _VSH_H_ */
309 
sVsh::envValuLen
int envValuLen
number of environment variables
Definition: vsh.h:67
Vsh_memChk
void Vsh_memChk(Vsh *thee)
Print the exact current malloc usage.
sVsh::PR_EXIT
char PR_EXIT[VMAX_ARGLEN]
the exit print string
Definition: vsh.h:91
sVio
Contains public data members for Vio class.
Definition: vio.h:98
sVsh::vmem
Vmem * vmem
the memory manager
Definition: vsh.h:59
sVsh::envValu
char ** envValu
the environment variables
Definition: vsh.h:71
sVsh::PR_PATH
char PR_PATH[VMAX_ARGLEN]
full prompt (user,hostname,path,etc)
Definition: vsh.h:89
sVsh::Ext_builtin
int(* Ext_builtin)(void *thee, int argc, char **argv)
external supershell builtin function
Definition: vsh.h:104
VMAX_ARGLEN
#define VMAX_ARGLEN
Global constant.
Definition: maloc_base.h:227
maloc_base.h
The base (or foundation) header for MALOC.
sVsh::cinUnit
FILE * cinUnit
input unit
Definition: vsh.h:82
sVsh::inUnit
FILE * inUnit
input unit
Definition: vsh.h:76
sVsh::scUnit
FILE * scUnit
script input unit
Definition: vsh.h:78
sVsh::clUnit
FILE * clUnit
input unit
Definition: vsh.h:80
Vsh_putenvInfo
int Vsh_putenvInfo(Vsh *thee, const char *envi, const char *valu)
Place a variable with an info string in the environment.
sVsh::envInfoLen
int envInfoLen
number of environment variable help strings
Definition: vsh.h:69
sVsh::iMadeVmem
int iMadeVmem
did i make vmem or was it inherited
Definition: vsh.h:61
Vsh_remove
void Vsh_remove(Vsh *thee, const char *envi)
Remove a variable from the environment.
sVsh::cmdKey
int cmdKey
external supershell command key
Definition: vsh.h:94
Vsh_ioSetup
Vio * Vsh_ioSetup(Vsh *thee, char *key)
Setup for an I/O command.
sVsh::envInfo
char ** envInfo
the environment variable help strings
Definition: vsh.h:73
Vsh_dtor
void Vsh_dtor(Vsh **thee)
Destroy the shell.
Vsh_getenvInfo
char * Vsh_getenvInfo(Vsh *thee, const char *envi)
Get info associated with a variable in the environment.
Vsh_putenvInt
int Vsh_putenvInt(Vsh *thee, const char *envi, const int valu)
Place a variable with a value (integer) in the environment.
Vsh_ioCleanup
void Vsh_ioCleanup(Vsh *thee, Vio **sock)
Cleanup an I/O command.
sVsh
Contains public data members for Vsh class.
Definition: vsh.h:56
Vsh_getenvReal
double Vsh_getenvReal(Vsh *thee, const char *envi)
Get a value of variable in the environment as a real.
Vsh_getenv
char * Vsh_getenv(Vsh *thee, const char *envi)
Get a value of variable in the environment.
Vsh_ctor
Vsh * Vsh_ctor(Vmem *vmem, int argc, char **argv)
Create the shell.
vsys.h
The primary header for VSYS. (Virtual SYStem utilities library.)
sVsh::buf
char * buf
internal buffer
Definition: vsh.h:99
sVsh::processArgs
char processArgs
whether the shell should process (argc,argv)
Definition: vsh.h:64
sVsh::bufsize
int bufsize
internal buffer size
Definition: vsh.h:101
sVsh::cinName
char cinName[VMAX_ARGLEN]
input unit
Definition: vsh.h:84
Vsh_wipe
void Vsh_wipe(Vsh *thee)
Wipe the environment.
Vsh_putenv
int Vsh_putenv(Vsh *thee, const char *envi, const char *valu)
Place a variable with a value in the environment.
Vsh_getenvInt
int Vsh_getenvInt(Vsh *thee, const char *envi)
Get a value of variable in the environment as an integer.
sVsh::PR
char PR[VMAX_ARGLEN]
minimal prompt (just the binary name)
Definition: vsh.h:87
sVmem
Contains public data members for Vmem class.
Definition: vmem.h:57
sVsh::Ext_thee
void * Ext_thee
external supershell object
Definition: vsh.h:96
Vsh_putenvReal
int Vsh_putenvReal(Vsh *thee, const char *envi, const double valu)
Place a variable with a value (real) in the environment.
Vsh_shell
int Vsh_shell(Vsh *thee, char *pPR, void *pthee, int(*builtin)(void *thee, int argc, char **argv))
A bash-like shell with user-definable extensions.