vsh.h

00001 /*
00002  * ***************************************************************************
00003  * MALOC = < Minimal Abstraction Layer for Object-oriented C >
00004  * Copyright (C) 1994--2000  Michael Holst
00005  * 
00006  * This program is free software; you can redistribute it and/or modify it
00007  * under the terms of the GNU General Public License as published by the
00008  * Free Software Foundation; either version 2 of the License, or (at your
00009  * option) any later version.
00010  * 
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00014  * See the GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License along
00017  * with this program; if not, write to the Free Software Foundation, Inc.,
00018  * 675 Mass Ave, Cambridge, MA 02139, USA.
00019  * 
00020  * rcsid="$Id: vsh.h,v 1.15 2002/10/01 21:29:45 mholst Exp $"
00021  * ***************************************************************************
00022  */
00023 
00024 /*
00025  * ***************************************************************************
00026  * File:     vsh.h    < vsh.c, ... >
00027  *
00028  * Purpose:  Header file for vsh, a bourne-compatible shell.
00029  *
00030  * Author:   Michael Holst
00031  * ***************************************************************************
00032  */
00033 
00034 #ifndef _VSH_H_
00035 #define _VSH_H_
00036 
00037 #include <maloc/maloc_base.h>
00038 
00039 #include <maloc/vsys.h>
00040 
00041 /*
00042  * ***************************************************************************
00043  * Class Vsh: Parameters and datatypes
00044  * ***************************************************************************
00045  */
00046 
00047 /*
00048  * ***************************************************************************
00049  * Class Vsh: Definition
00050  * ***************************************************************************
00051  */
00052 
00053 typedef struct Vsh {
00054 
00055     Vmem   *vmem;        /* the memory manager                              */
00056     int    iMadeVmem;    /* did i make vmem or was it inherited             */
00057 
00058     char processArgs;    /* whether the shell should process (argc,argv)    */
00059 
00060     int envValuLen;      /* number of environment variables                 */
00061     int envInfoLen;      /* number of environment variable help strings     */
00062     char **envValu;      /* the environment variables                       */
00063     char **envInfo;      /* the environment variable help strings           */
00064 
00065     FILE *inUnit;        /* input unit                                      */
00066     FILE *scUnit;        /* script input unit                               */
00067     FILE *clUnit;        /* input unit                                      */
00068     FILE *cinUnit;       /* input unit                                      */
00069     char cinName[80];    /* input unit                                      */
00070 
00071     char PR[80];         /* minimal prompt (just the binary name)           */
00072     char PR_PATH[80];    /* full prompt (with user,hostname,path,etc)       */
00073     char PR_EXIT[80];    /* the exit print string                           */
00074 
00075     int cmdKey;          /* external supershell command key                 */
00076     void *Ext_thee;      /* external supershell object                      */
00077 
00078     char *buf;           /* internal buffer                                 */
00079     int bufsize;         /* internal buffer size                            */
00080 
00081     /* external supershell builtin function */
00082     int (*Ext_builtin)(void *thee, int argc, char **argv);
00083 
00084 } Vsh;                                                                        
00085 
00086 /*
00087  * ***************************************************************************
00088  * Class Vsh: Inlineable methods (vsh.c)
00089  * ***************************************************************************
00090  */
00091 
00092 #if !defined(VINLINE_MALOC)
00093 #else /* if defined(VINLINE_MALOC) */
00094 #endif /* if !defined(VINLINE_MALOC) */
00095 
00096 /*
00097  * ***************************************************************************
00098  * Class Vsh: Non-inlineable methods (vsh.c)
00099  * ***************************************************************************
00100  */
00101 
00102 Vsh* Vsh_ctor(Vmem *vmem, int argc, char **argv);
00103 void Vsh_dtor(Vsh **thee);
00104 
00105 int Vsh_shell(Vsh *thee, char *pPR, void *pthee,
00106     int (*builtin)(void *thee, int argc, char **argv));
00107 
00108 int Vsh_putenv(Vsh *thee, const char *envi, const char *valu);
00109 int Vsh_putenvInfo(Vsh *thee, const char *envi, const char *valu);
00110 int Vsh_putenvInt(Vsh *thee, const char *envi, const int valu);
00111 int Vsh_putenvReal(Vsh *thee, const char *envi, const double valu);
00112 
00113 char *Vsh_getenv(Vsh *thee, const char *envi);
00114 char *Vsh_getenvInfo(Vsh *thee, const char *envi);
00115 int Vsh_getenvInt(Vsh *thee, const char *envi);
00116 double Vsh_getenvReal(Vsh *thee, const char *envi);
00117 
00118 void Vsh_remove(Vsh *thee, const char *envi);
00119 void Vsh_wipe(Vsh *thee);
00120 
00121 void Vsh_memChk(Vsh *thee);
00122 
00123 Vio *Vsh_ioSetup(Vsh *thee, char *key);
00124 void Vsh_ioCleanup(Vsh *thee, Vio **sock);
00125 
00126 #endif /* _VSH_H_ */
00127 
00128 

Generated on Fri Aug 21 15:55:26 2009 for MALOC by  doxygen 1.4.7