/*
 *  DO NOT EDIT THIS FILE   (genshell.c)
 *  
 *  It has been autogen-ed  Friday November  5, 1999 at 01:41:59 PM PST
 *  From the definitions    genshell.def
 *  and the template file   options.tpl
 */

static const char zCopyright[] =
       "genshellopt copyright (c) 1999 Bruce Korb, all rights reserved";
static const char zCopyrightNotice[] =
       "genshellopt is free software.\n"
       "\n"
       "You may redistribute it and/or modify it under the terms of the\n"
       "GNU General Public License, as published by the Free Software\n"
       "Foundation; either version 2, or (at your option) any later version.\n"
       "\n"
       "genshellopt is distributed in the hope that it will be useful,\n"
       "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
       "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
       "See the GNU General Public License for more details.\n"
       "\n"
       "You should have received a copy of the GNU General Public License\n"
       "along with genshellopt.  See the file \"COPYING\".  If not,\n"
       "write to:  The Free Software Foundation, Inc.,\n"
       "           59 Temple Place - Suite 330,\n"
       "           Boston,  MA  02111-1307, USA.\n"
       "\n"
       "As a special exception, Bruce Korb gives permission for additional\n"
       "uses of the text contained in the release of genshellopt.\n"
       "\n"
       "The exception is that, if you link the genshellopt library with other\n"
       "files to produce an executable, this does not by itself cause the\n"
       "resulting executable to be covered by the GNU General Public License.\n"
       "Your use of that executable is in no way restricted on account of\n"
       "linking the genshellopt library code into it.\n"
       "\n"
       "This exception does not however invalidate any other reasons why\n"
       "the executable file might be covered by the GNU General Public License.\n"
       "\n"
       "This exception applies only to the code released by Bruce Korb under\n"
       "the name genshellopt.  If you copy code from other sources under the\n"
       "General Public License into a copy of genshellopt, as the General Public\n"
       "License permits, the exception does not apply to the code that you add\n"
       "in this way.  To avoid misleading anyone as to the status of such\n"
       "modified files, you must delete this exception notice from them.\n"
       "\n"
       "If you write modifications of your own for genshellopt, it is your choice\n"
       "whether to permit this exception to apply to your modifications.\n"
       "If you do not wish that, delete this exception notice.";
#include "genshell.h"

extern tUsageProc genshelloptUsage;

#ifndef NULL
#  define NULL 0x0
#endif

#ifndef EXIT_SUCCESS
#  define  EXIT_SUCCESS 0
#  define  EXIT_FAILURE 1
#endif

/*
 *  Script option description:
 */
tSCC    zScriptText[] =
       "Output Script File";
tSCC    zScript_NAME[] =              "SCRIPT";
#define zNotScript_Pfx                (const char*)NULL
#define zNotScript_Name               (const char*)NULL
tSCC    zScript_Name[] =              "script";

/*
 *  Shell option description:
 */
tSCC    zShellText[] =
       "Shell name (follows \"#!\" magic)";
tSCC    zShell_NAME[] =               "SHELL";
tSCC    zNotShell_Name[] =            "no-shell";
tSCC    zNotShell_Pfx[] =             "no";
#define zShell_Name                   (zNotShell_Name + 3)
/*
 *  Help option description:
 */
tSCC zHelpText[]  = "Display usage information and exit";
tSCC zHelp_Name[] = "help";

/*
 *  More_Help option description:
 */
tSCC zMore_HelpText[]  = "Extended usage information passed thru pager";
tSCC zMore_Help_Name[] = "more-help";

/*
 *  Version option description:
 */
tSCC zVersionText[]  = "Output version information and exit";
tSCC zVersion_Name[] = "version";
/*
 *  These are always callable, whether
 *  TEST_GENSHELLOPT_OPTS is defined or not
 */
static tOptProc doUsageOpt;
extern tOptProc doVersion;
extern tOptProc doPagedUsage;

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 *  Define the Genshellopt Option Descriptions.
 */
static tOptDesc optDesc[ OPTION_CT ] = {
  {  /* entry idx, value */ 0, VALUE_OPT_SCRIPT,
     /* equiv idx, value */ 0, VALUE_OPT_SCRIPT,
     /* option argument  */ ARG_MUST,
     /* equivalenced to  */ NO_EQUIVALENT,
     /* min, max, act ct */ 0, 1, 0,
     /* opt state flags  */ OPTST_DISABLED | OPTST_INIT,
     /* last opt argumnt */ (char*)NULL,
     /* arg list/cookie  */ (void*)NULL,
     /* must/cannot opts */ (const int*)NULL, (const int*)NULL,
     /* option proc      */ (tpOptProc)NULL,
     /* desc, NAME, name */ zScriptText,  zScript_NAME,
                            zScript_Name,
     /* disablement strs */ zNotScript_Name, zNotScript_Pfx },

  {  /* entry idx, value */ 1, VALUE_OPT_SHELL,
     /* equiv idx, value */ 1, VALUE_OPT_SHELL,
     /* option argument  */ ARG_MUST,
     /* equivalenced to  */ NO_EQUIVALENT,
     /* min, max, act ct */ 0, 1, 0,
     /* opt state flags  */ OPTST_DISABLEOK | OPTST_INITENABLED | OPTST_INIT,
     /* last opt argumnt */ (char*)NULL,
     /* arg list/cookie  */ (void*)NULL,
     /* must/cannot opts */ (const int*)NULL, (const int*)NULL,
     /* option proc      */ (tpOptProc)NULL,
     /* desc, NAME, name */ zShellText,  zShell_NAME,
                            zShell_Name,
     /* disablement strs */ zNotShell_Name, zNotShell_Pfx },

  {  /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
     /* equiv idx value  */ NO_EQUIVALENT, 0,
     /* option argument  */ ARG_MAY,
     /* equivalenced to  */ NO_EQUIVALENT,
     /* min, max act ct  */ 0, 1, 0,
     /* opt state flags  */ OPTST_INIT,
     /* last opt argumnt */ (char*)NULL,
     /* arg list/cookie  */ (void*)NULL,
     /* must/cannot opts */ (const int*)NULL,  (const int*)NULL,
     /* option proc      */ doVersion,
     /* desc, NAME, name */ zVersionText,      (const char*)NULL,
                            zVersion_Name,
     /* disablement strs */ (const char*)NULL, (const char*)NULL },

  {  /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
     /* equiv idx value  */ NO_EQUIVALENT, 0,
     /* option argument  */ ARG_NONE,
     /* equivalenced to  */ NO_EQUIVALENT,
     /* min, max act ct  */ 0, 1, 0,
     /* opt state flags  */ OPTST_INIT,
     /* last opt argumnt */ (char*)NULL,
     /* arg list/cookie  */ (void*)NULL,
     /* must/cannot opts */ (const int*)NULL,  (const int*)NULL,
     /* option proc      */ doUsageOpt,
     /* desc, NAME, name */ zHelpText,         (const char*)NULL,
                            zHelp_Name,
     /* disablement strs */ (const char*)NULL, (const char*)NULL },

  {  /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
     /* equiv idx value  */ NO_EQUIVALENT, 0,
     /* option argument  */ ARG_NONE,
     /* equivalenced to  */ NO_EQUIVALENT,
     /* min, max act ct  */ 0, 1, 0,
     /* opt state flags  */ OPTST_INIT,
     /* last opt argumnt */ (char*)NULL,
     /* arg list/cookie  */ (void*)NULL,
     /* must/cannot opts */ (const int*)NULL,  (const int*)NULL,
     /* option proc      */ doPagedUsage,
     /* desc, NAME, name */ zMore_HelpText,    (const char*)NULL,
                            zMore_Help_Name,
     /* disablement strs */ (const char*)NULL, (const char*)NULL }
};

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *
 *  Define the Genshellopt Option Environment
 */
tSCC   zPROGNAME[]   = "GENSHELLOPT";
tSCC   zUsageTitle[] = GENSHELLOPT_FULL_VERSION 
    "\nUSAGE:  %s [-<flag> [<val>]]... [--<name>[{=| }<val>]]... \n";
#define zRcName     (tCC*)NULL
#define apzHomeList (tCC**)NULL
tSCC   zExplain[]    = "\n"
       "Note that `shell' is only useful if the output file does not already\n"
       "exist.  If it does, then the shell name and optional first argument\n"
       "will be extracted from the script file." "\n";

tSCC    zDetail[]     = "\n"
       "If the script file already exists and contains Automated Option Processing\n"
       "text, the second line of the file through the ending tag will be replaced\n"
       "by the newly generated text.  The first `#!' line will be regenerated." "\n";

#define zDetailFile (const char*)NULL
tSCC    zFullVersion[] = GENSHELLOPT_FULL_VERSION;

tOptions genshelloptOptions = {
    OPTIONS_STRUCT_VERSION,
    (char*)NULL,    (char*)NULL,    zPROGNAME,
    zRcName,        zCopyright,     zCopyrightNotice,
    zFullVersion,   apzHomeList,    zUsageTitle,
    zExplain,       zDetail,        zDetailFile,
    genshelloptUsage,
    ( OPTPROC_NONE
    + OPTPROC_ERRSTOP
    + OPTPROC_DISABLEOK
    + OPTPROC_SHORTOPT
    + OPTPROC_LONGOPT
    + OPTPROC_NO_REQ_OPT
    + OPTPROC_NEGATIONS
    + OPTPROC_NO_ARGS ),
    0, (char*)NULL,
    { INDEX_OPT_MORE_HELP,
       0 /* no option state saving */,
      NO_EQUIVALENT /* no '-#' option */,
      NO_EQUIVALENT /* no '-#' option */ },
    OPTION_CT, 2,
    optDesc
};

/*
 *  Create the static procedure(s) declared above.
 */
    static void
doUsageOpt( tOptions*  pOpts, tOptDesc* pOD )
{
    USAGE( EXIT_SUCCESS );
}

