/**CFile*********************************************************************** FileName [tst.c] PackageName [tst] Synopsis [Test package initialization, ending, and the command test.] Author [Originated from SIS.] Copyright [Copyright (c) 1994-1996 The Regents of the Univ. of California. All rights reserved. Permission is hereby granted, without written agreement and without license or royalty fees, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following two paragraphs appear in all copies of this software. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.] ******************************************************************************/ #include "tstInt.h" static char rcsid[] UNUSED = "$Id: tst.c,v 1.6 2002/09/10 06:14:37 fabio Exp $"; /*---------------------------------------------------------------------------*/ /* Constant declarations */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Structure declarations */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Type declarations */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Variable declarations */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Macro declarations */ /*---------------------------------------------------------------------------*/ /**AutomaticStart*************************************************************/ /*---------------------------------------------------------------------------*/ /* Static function prototypes */ /*---------------------------------------------------------------------------*/ static int CommandTest(Hrc_Manager_t ** hmgr, int argc, char ** argv); /**AutomaticEnd***************************************************************/ /*---------------------------------------------------------------------------*/ /* Definition of exported functions */ /*---------------------------------------------------------------------------*/ /**Function******************************************************************** Synopsis [Initializes the test package.] SideEffects [] SeeAlso [Tst_End] ******************************************************************************/ void Tst_Init(void) { /* * Add a command to the global command table. By using the leading * underscore, the command will be listed under "help -a" but not "help". */ Cmd_CommandAdd("_tst_test", CommandTest, /* doesn't changes_network */ 0); } /**Function******************************************************************** Synopsis [Ends the test package.] SideEffects [] SeeAlso [Tst_Init] ******************************************************************************/ void Tst_End(void) { /* * For example, free any global memory (if any) which the test package is * responsible for. */ } /*---------------------------------------------------------------------------*/ /* Definition of internal functions */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* Definition of static functions */ /*---------------------------------------------------------------------------*/ /**Function******************************************************************** Synopsis [Implements the _tst_test command.] CommandName [_tst_test] CommandSynopsis [template for implementing commands] CommandArguments [\[-h\] \[-v\]] CommandDescription [This command does nothing useful. It merely serves as a template for the implementation of new commands.

Command options:

-h
Print the command usage.
-v
Verbose mode. ] SideEffects [] ******************************************************************************/ static int CommandTest( Hrc_Manager_t ** hmgr, int argc, char ** argv) { int c; int verbose = 0; /* default value */ /* * Parse command line options. */ util_getopt_reset(); while ((c = util_getopt(argc, argv, "vh")) != EOF) { switch(c) { case 'v': verbose = 1; break; case 'h': goto usage; default: goto usage; } } if (verbose) { (void) fprintf(vis_stdout, "The _tst_test command does nothing useful.\n"); } return 0; /* normal exit */ usage: (void) fprintf(vis_stderr, "usage: _tst_test [-h] [-v]\n"); (void) fprintf(vis_stderr, " -h\t\tprint the command usage\n"); (void) fprintf(vis_stderr, " -v\t\tverbose\n"); return 1; /* error exit */ }