VIS
|
00001 00032 #include "tstInt.h" 00033 00034 static char rcsid[] UNUSED = "$Id: tst.c,v 1.6 2002/09/10 06:14:37 fabio Exp $"; 00035 00036 /*---------------------------------------------------------------------------*/ 00037 /* Constant declarations */ 00038 /*---------------------------------------------------------------------------*/ 00039 00040 /*---------------------------------------------------------------------------*/ 00041 /* Structure declarations */ 00042 /*---------------------------------------------------------------------------*/ 00043 00044 /*---------------------------------------------------------------------------*/ 00045 /* Type declarations */ 00046 /*---------------------------------------------------------------------------*/ 00047 00048 /*---------------------------------------------------------------------------*/ 00049 /* Variable declarations */ 00050 /*---------------------------------------------------------------------------*/ 00051 00052 /*---------------------------------------------------------------------------*/ 00053 /* Macro declarations */ 00054 /*---------------------------------------------------------------------------*/ 00055 00058 /*---------------------------------------------------------------------------*/ 00059 /* Static function prototypes */ 00060 /*---------------------------------------------------------------------------*/ 00061 00062 static int CommandTest(Hrc_Manager_t ** hmgr, int argc, char ** argv); 00063 00067 /*---------------------------------------------------------------------------*/ 00068 /* Definition of exported functions */ 00069 /*---------------------------------------------------------------------------*/ 00070 00080 void 00081 Tst_Init(void) 00082 { 00083 /* 00084 * Add a command to the global command table. By using the leading 00085 * underscore, the command will be listed under "help -a" but not "help". 00086 */ 00087 Cmd_CommandAdd("_tst_test", CommandTest, /* doesn't changes_network */ 0); 00088 } 00089 00090 00100 void 00101 Tst_End(void) 00102 { 00103 /* 00104 * For example, free any global memory (if any) which the test package is 00105 * responsible for. 00106 */ 00107 } 00108 00109 00110 /*---------------------------------------------------------------------------*/ 00111 /* Definition of internal functions */ 00112 /*---------------------------------------------------------------------------*/ 00113 00114 00115 /*---------------------------------------------------------------------------*/ 00116 /* Definition of static functions */ 00117 /*---------------------------------------------------------------------------*/ 00118 00147 static int 00148 CommandTest( 00149 Hrc_Manager_t ** hmgr, 00150 int argc, 00151 char ** argv) 00152 { 00153 int c; 00154 int verbose = 0; /* default value */ 00155 00156 /* 00157 * Parse command line options. 00158 */ 00159 util_getopt_reset(); 00160 while ((c = util_getopt(argc, argv, "vh")) != EOF) { 00161 switch(c) { 00162 case 'v': 00163 verbose = 1; 00164 break; 00165 case 'h': 00166 goto usage; 00167 default: 00168 goto usage; 00169 } 00170 } 00171 00172 if (verbose) { 00173 (void) fprintf(vis_stdout, "The _tst_test command does nothing useful.\n"); 00174 } 00175 00176 return 0; /* normal exit */ 00177 00178 usage: 00179 (void) fprintf(vis_stderr, "usage: _tst_test [-h] [-v]\n"); 00180 (void) fprintf(vis_stderr, " -h\t\tprint the command usage\n"); 00181 (void) fprintf(vis_stderr, " -v\t\tverbose\n"); 00182 return 1; /* error exit */ 00183 } 00184 00185 00186 00187