home *** CD-ROM | disk | FTP | other *** search
/ synchro.net / synchro.net.tar / synchro.net / main / BBS / ODOORS62.ZIP / ODCmdLn.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-07  |  22.6 KB  |  652 lines

  1. /* OpenDoors Online Software Programming Toolkit
  2.  * (C) Copyright 1991 - 1999 by Brian Pirie.
  3.  *
  4.  * This library is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU Lesser General Public
  6.  * License as published by the Free Software Foundation; either
  7.  * version 2 of the License, or (at your option) any later version.
  8.  *
  9.  * This library is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.  * Lesser General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU Lesser General Public
  15.  * License along with this library; if not, write to the Free Software
  16.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  17.  *
  18.  *
  19.  *        File: ODCmdLn.c
  20.  *
  21.  * Description: Implementation of od_parse_cmd_line() function, which
  22.  *              parses standard command-line parameters for OpenDors programs.
  23.  *
  24.  *   Revisions: Date          Ver   Who  Change
  25.  *              ---------------------------------------------------------------
  26.  *              Jan 29, 1995  6.00  BP   Created.
  27.  *              Aug 19, 1995  6.00  BP   Cleaned up indentations.
  28.  *              Nov 12, 1995  6.00  BP   32-bit portability.
  29.  *              Nov 12, 1995  6.00  BP   Added -CONFIG parameter.
  30.  *              Dec 21, 1995  6.00  BP   Added -HANDLE parameter.
  31.  *              Dec 24, 1995  6.00  BP   puts() -> printf().
  32.  *              Dec 30, 1995  6.00  BP   Added ODCALL for calling convention.
  33.  *              Jan 03, 1996  6.00  BP   Recognize -D for -DROPFILE.
  34.  *              Jan 03, 1996  6.00  BP   Parameters must begin with - or /.
  35.  *              Feb 06, 1996  6.00  BP   Added -SILENT for od_silent_mode.
  36.  *              Feb 19, 1996  6.00  BP   Changed version number to 6.00.
  37.  *              Feb 20, 1996  6.00  BP   Added bParsedCmdLine.
  38.  *              Feb 21, 1996  6.00  BP   Make cmd line options overriding.
  39.  *              Feb 25, 1996  6.00  BP   Fix -P COMx.
  40.  *              Feb 27, 1996  6.00  BP   Add -P COMx to command line help.
  41.  *              Mar 03, 1996  6.10  BP   Begin version 6.10.
  42.  *              Apr 08, 1996  6.10  BP   Added command-line parsing callbacks.
  43.  */
  44.  
  45. #define BUILDING_OPENDOORS
  46.  
  47. #include <string.h>
  48. #include <stdio.h>
  49. #include <stdlib.h>
  50. #include <ctype.h>
  51.  
  52. #include "OpenDoor.h"
  53. #include "ODPlat.h"
  54. #include "ODCore.h"
  55. #include "ODInEx.h"
  56.  
  57.  
  58. /* Maximum number of command-line arguments. Any additional arguments will */
  59. /* simply be ignored.                                                      */
  60. #define MAX_ARGS 32
  61.  
  62. /* Size of temporary string that will hold any options following custom      */
  63. /* command-line keywords that are passed to the client application's handler */
  64. /* function.                                                                 */
  65. #define CUSTOM_OPTION_SIZE 80
  66.  
  67. /* Command-line parameter identifiers. */
  68. typedef enum
  69. {
  70.    kParamConfigFile,
  71.    kParamLocal,
  72.    kParamBPS,
  73.    kParamPort,
  74.    kParamNode,
  75.    kParamHelp,
  76.    kParamPersonality,
  77.    kParamMaxTime,
  78.    kParamAddress,
  79.    kParamIRQ,
  80.    kParamNoFOSSIL,
  81.    kParamNoFIFO,
  82.    kParamDropFile,
  83.    kParamUserName,
  84.    kParamTimeLeft,
  85.    kParamSecurity,
  86.    kParamLocation,
  87.    kParamGraphics,
  88.    kParamBBSName,
  89.    kParamPortHandle,
  90.    kParamSilentMode,
  91.    kParamOption,
  92.    kParamUnknown
  93. } tCommandLineParameter;
  94.  
  95.  
  96. /* Private function prototypes. */
  97. static void ODAdvanceToNextArg(INT *pnCurrentArg, INT nArgCount,
  98.    char *pszOption);
  99. static void ODGetNextArgName(INT *pnCurrentArg, INT nArgCount,
  100.    char *papszArguments[], char *pszString, size_t nStringSize);
  101. static tCommandLineParameter ODGetCommandLineParameter(char *pszArgument);
  102.  
  103.  
  104. /* Private variables. */
  105. #define CONFIG_FILENAME_SIZE 80
  106. static char szConfigFilename[CONFIG_FILENAME_SIZE];
  107.  
  108.  
  109. /* ----------------------------------------------------------------------------
  110.  * od_parse_cmd_line()
  111.  *
  112.  * Function to parse an OpenDoors program's command-line, interpreting
  113.  * standard command-line parameters. This is one of the few OpenDoors APIs
  114.  * that will not automatically initialize OpenDoors if it hasn't already
  115.  * been done. This is because od_parse_cmd_line() performs setup that must
  116.  * be done prior to OpenDoors initialization.
  117.  *
  118.  * Parameters: FOR NON-WIN32 VERSIONS:
  119.  *
  120.  *             nArgCount      - Number of command line arguments, as passed to
  121.  *                              main() in argc.
  122.  *
  123.  *             papszArguments - Pointer to array of pointers to string
  124.  *                              arguments, as passed to main() in argv. The
  125.  *                              first element of this array (usually the
  126.  *                              full path and filename of the executable)
  127.  *                              is ignored.
  128.  *
  129.  *             FOR WIN32 VERSION:
  130.  *
  131.  *             pszCmdLine     - Pointer to the command line string, as passed
  132.  *                              to WinMain().
  133.  *
  134.  *     Return: void
  135.  */
  136. #ifdef ODPLAT_WIN32
  137. ODAPIDEF void ODCALL od_parse_cmd_line(LPSTR pszCmdLine)
  138. #else /* !ODPLAT_WIN32 */
  139. ODAPIDEF void ODCALL od_parse_cmd_line(INT nArgCount, char *papszArguments[])
  140. #endif /* !ODPLAT_WIN32 */
  141. {
  142.    char *pszCurrentArg;
  143.    INT nCurrentArg;
  144.    INT n;
  145. #ifdef ODPLAT_WIN32
  146.    INT nArgCount;
  147.    char *papszArguments[MAX_ARGS];
  148.    char *pszCmdLineCopy;
  149.    char *pchCurrent
  150. #endif /* ODPLAT_WIN32 */
  151.  
  152.    /* Log function entry if running in trace mode. */
  153.    TRACE(TRACE_API, "od_parse_cmd_line()");
  154.  
  155. #ifdef ODPLAT_WIN32
  156.    /* Attempt to allocate space for a copy of the command line. */
  157.    pszCmdLineCopy = malloc(strlen(pszCmdLine) + 1);
  158.    if(pszCmdLineCopy == NULL)
  159.    {
  160.       od_control.od_error = ERR_MEMORY;
  161.       return;
  162.    }
  163.  
  164.    /* Copy the command line text into our working copy. */
  165.    strcpy(pszCmdLineCopy, pszCmdLine);
  166.  
  167.    /* Loop, building papszArguments and nArgCount. */
  168.    pchCurrent = pszCmdLineCopy;
  169.    for(nArgCount = 0; nArgCount < MAX_ARGS && *pchCurrent != '\0'; ++nArgCount)
  170.    {
  171.       /* Store address of the next command line argument. */
  172.       papszArguments[nArgCount] = pchCurrent;
  173.  
  174.       /* Skip forward to the next white space. */
  175.       while(*pchCurrent != '\0' && !isspace(*pchCurrent))
  176.       {
  177.          ++pchCurrent;
  178.       }
  179.  
  180.       /* Replace white space characters with '\0' string terminators, until */
  181.       /* we reach the next command line argument, or the end of the string. */
  182.       while(*pchCurrent != '\0' && isspace(*pchCurrent))
  183.       {
  184.          *pchCurrent = '\0';
  185.          ++pchCurrent;
  186.       }
  187.    }
  188. #endif /* ODPLAT_WIN32 */
  189.  
  190. #ifndef ODPLAT_WIN32
  191.    /* Check validity of parameters. */
  192.    if(papszArguments == NULL)
  193.    {
  194.       od_control.od_error = ERR_PARAMETER;
  195.       return;
  196.    }
  197. #endif /* !ODPLAT_WIN32 */
  198.  
  199.    /* Record that od_parse_cmd_line() has been called. */
  200.    bParsedCmdLine = TRUE;
  201.  
  202.    /* Initialize variables that are not initialized in od_init() if */
  203.    /* od_parse_cmd_line is specified.                               */
  204.    od_control.user_ansi = TRUE;
  205.    od_control.user_timelimit = 60;
  206.  
  207. #ifdef ODPLAT_WIN32
  208.    for(nCurrentArg = 0; nCurrentArg < nArgCount; ++nCurrentArg)
  209. #else /* !ODPLAT_WIN32 */
  210.    for(nCurrentArg = 1; nCurrentArg < nArgCount; ++nCurrentArg)
  211. #endif /* !ODPLAT_WIN32 */
  212.    {
  213.       pszCurrentArg = papszArguments[nCurrentArg];
  214.  
  215.       switch(ODGetCommandLineParameter(pszCurrentArg))
  216.       {
  217.          case kParamConfigFile:
  218.             ODAdvanceToNextArg(&nCurrentArg, nArgCount, pszCurrentArg);
  219.             strncpy(szConfigFilename, papszArguments[nCurrentArg],
  220.                sizeof(szConfigFilename) - 1);
  221.             szConfigFilename[sizeof(szConfigFilename) - 1] = '\0';
  222.             od_control.od_config_filename = szConfigFilename;
  223.             break;
  224.  
  225.          case kParamLocal:
  226.             od_control.od_force_local = TRUE;
  227.             break;
  228.  
  229.          case kParamBPS:
  230.             ODAdvanceToNextArg(&nCurrentArg, nArgCount, pszCurrentArg);
  231.             od_control.baud = atol(papszArguments[nCurrentArg]);
  232.             wPreSetInfo |= PRESET_BPS;
  233.             break;
  234.  
  235.          case kParamPort:
  236.             ODAdvanceToNextArg(&nCurrentArg, nArgCount, pszCurrentArg);
  237.             if(strnicmp(papszArguments[nCurrentArg], "COM", 3) == 0)
  238.             {
  239.                od_control.port = atoi(papszArguments[nCurrentArg] + 3) - 1;
  240.             }
  241.             else
  242.             {
  243.                od_control.port = atoi(papszArguments[nCurrentArg]);
  244.             }
  245.             wPreSetInfo |= PRESET_PORT;
  246.             break;
  247.  
  248.          case kParamHelp:
  249.             if(od_control.od_cmd_line_help_func != NULL)
  250.             {
  251.                (*od_control.od_cmd_line_help_func)();
  252.                exit(0);
  253.             }
  254.  
  255. #ifdef ODPLAT_WIN32
  256.             sprintf(szODWorkString, "%s Command Line Options",
  257.                strlen(od_control.od_prog_name) > 0 ? od_control.od_prog_name
  258.                : OD_VER_SHORTNAME);
  259.             if(od_control.od_cmd_line_help != NULL)
  260.             {
  261.                MessageBox(NULL, od_control.od_cmd_line_help, szODWorkString,
  262.                   MB_ICONINFORMATION | MB_OK);
  263.             }
  264.             else
  265.             {
  266.                MessageBox(NULL,
  267.                   "(Note that some options can be overriden by configuration or drop files.)\n"
  268.                   "\n"
  269.                   "-C x or -CONFIG x\t- Specfies configuration filename.\n"
  270.                   "-L or -LOCAL\t- Causes door to operate in local mode, without requiring a drop file.\n"
  271.                   "-D or -DROPFILE x\t- Door information file directory and/or filename.\n"
  272.                   "-N x or -NODE x\t- Sets the node number to use.\n"
  273.                   "-B x or -BPS x\t- Sets the serial port <---> modem bps (baud) rate to use.\n"
  274.                   "-P x or -PORT x\t- Sets serial port to use. For COM1: use -P 0 or -P COM1, for COM2: use -P 1 or -P COM2, etc.\n"
  275.                   "-HANDLE x\t- Provides an already open serial port handle.\n"
  276.                   "-SILENT\t\t- Operate in silent mode, with no local display.\n"
  277.                   "-MAXTIME x\t- Sets the maximum number of minutes that user will be permitted to access the door.\n"
  278.                   "-G or -GRAPHICS\t- Unless followed by 0 or N, turns on ANSI display mode.\n"
  279.                   "-BBSNAME x\t- Name of BBS.\n"
  280.                   "-USERNAME x\t- Name of user who is currently online.\n"
  281.                   "-TIMELEFT x\t- User's time remaining online.\n"
  282.                   "-SECURITY x\t- User's security level.\n"
  283.                   "-LOCATION x\t- Location from which user is calling.\n"
  284.                   "-?, -H or -HELP\t- Displays command-line help and exits.",
  285.                   szODWorkString, MB_ICONINFORMATION | MB_OK);
  286.             }
  287. #else /* !ODPLAT_WIN32 */
  288.             printf("AVALIABLE COMMAND LINE OPTIONS ");
  289.             if(od_control.od_cmd_line_help != NULL)
  290.             {
  291.                printf(od_control.od_cmd_line_help);
  292.             }
  293.             else
  294.             {
  295.                printf("(Some can be overriden by config/drop file)\n");
  296.                printf(" -C or -CONFIG    - Specfies configuration filename.\n");
  297.                printf(" -L or -LOCAL     - Causes door to operate in local mode, without requiring a\n");
  298.                printf("                    door information (drop) file.\n");
  299.                printf(" -D or -DROPFILE  - Door information file directory and/or filename.\n");
  300.                printf(" -N x or -NODE x  - Sets the node number to use.\n");
  301.                printf(" -B x or -BPS x   - Sets the serial port <---> modem bps (baud) rate to use.\n");
  302.                printf(" -P x or -PORT x  - Sets serial port to use. For COM1: use -P 0 or -P COM1, for\n");
  303.                printf("                    COM2: use -P 1 or -P COM2, etc.\n");
  304.                printf(" -ADDRESS x       - Sets serial port address in HEXIDECIMAL (if no FOSSIL).\n");
  305.                printf(" -IRQ x           - Sets the serial port IRQ line (if FOSSIL is not used).\n");
  306.                printf(" -NOFOSSIL        - Disables use of FOSSIL driver, even if available.\n");
  307.                printf(" -NOFIFO          - Disables use of 16550 FIFO buffers (only if no FOSSIL).\n");
  308.                printf(" -MAXTIME x       - Sets the maximum number of minutes that any user will be\n");
  309.                printf("                    permitted to access the door, regardless of time left.\n");
  310.                printf(" -SILENT          - Operate in silent mode, with no local display.\n");
  311.                printf(" -G or -GRAPHICS  - Unless followed by 0 or N, turns on ANSI display mode.\n");
  312.                printf(" -BBSNAME x       - Name of BBS.\n");
  313.                printf(" -USERNAME x      - Name of user who is currently online.\n");
  314.                printf(" -TIMELEFT x      - User's time remaining online.\n");
  315.                printf(" -SECURITY x      - User's security level.\n");
  316.                printf(" -LOCATION x      - Location from which user is calling.\n");
  317.                printf(" -?, -H or -HELP  - Displays command-line help and exits.\n");
  318.             }
  319. #endif /* !ODPLAT_WIN32 */
  320.             exit(1);
  321.             break;
  322.  
  323.          case kParamNode:
  324.             ODAdvanceToNextArg(&nCurrentArg, nArgCount, pszCurrentArg);
  325.             od_control.od_node = atoi(papszArguments[nCurrentArg]);
  326.             break;
  327.  
  328.          case kParamMaxTime:
  329.             ODAdvanceToNextArg(&nCurrentArg, nArgCount, pszCurrentArg);
  330.             od_control.od_maxtime = atoi(papszArguments[nCurrentArg]);
  331.             break;
  332.  
  333.          case kParamAddress:
  334.             ODAdvanceToNextArg(&nCurrentArg, nArgCount, pszCurrentArg);
  335.             od_control.od_com_address =
  336.                (WORD)strtol(papszArguments[nCurrentArg], NULL, 16);
  337.             break;
  338.  
  339.          case kParamIRQ:
  340.             ODAdvanceToNextArg(&nCurrentArg, nArgCount, pszCurrentArg);
  341.             od_control.od_com_irq = atoi(papszArguments[nCurrentArg]);
  342.             break;
  343.  
  344.          case kParamNoFOSSIL:
  345.             od_control.od_no_fossil = TRUE;
  346.             break;
  347.  
  348.          case kParamNoFIFO:
  349.             od_control.od_com_no_fifo = TRUE;
  350.             break;
  351.  
  352.          case kParamDropFile:
  353.             ODAdvanceToNextArg(&nCurrentArg, nArgCount, pszCurrentArg);
  354.             strncpy(od_control.info_path, papszArguments[nCurrentArg],
  355.                sizeof(od_control.info_path) - 1);
  356.             od_control.info_path[sizeof(od_control.info_path) - 1] = '\0';
  357.             break;
  358.  
  359.          case kParamUserName:
  360.             ODGetNextArgName(&nCurrentArg, nArgCount, papszArguments,
  361.             od_control.user_name, sizeof(od_control.user_name));
  362.             break;
  363.  
  364.          case kParamTimeLeft:
  365.             ODAdvanceToNextArg(&nCurrentArg, nArgCount, pszCurrentArg);
  366.             od_control.user_timelimit = atoi(papszArguments[nCurrentArg]);
  367.             break;
  368.  
  369.          case kParamSecurity:
  370.             ODAdvanceToNextArg(&nCurrentArg, nArgCount, pszCurrentArg);
  371.             od_control.user_security = atoi(papszArguments[nCurrentArg]);
  372.             break;
  373.  
  374.          case kParamLocation:
  375.             ODGetNextArgName(&nCurrentArg, nArgCount, papszArguments,
  376.             od_control.user_location, sizeof(od_control.user_location));
  377.             break;
  378.  
  379.          case kParamGraphics:
  380.             n = nCurrentArg;
  381.             if(++n < nArgCount)
  382.             {
  383.                if(atoi(papszArguments[n]) == 0 ||
  384.                   stricmp(papszArguments[n], "N") == 0)
  385.                {
  386.                   od_control.user_ansi = FALSE;
  387.                   ++nCurrentArg;
  388.                   break;
  389.                }
  390.             }
  391.             od_control.user_ansi = TRUE;
  392.             break;
  393.  
  394.          case kParamBBSName:
  395.             ODGetNextArgName(&nCurrentArg, nArgCount, papszArguments,
  396.                od_control.system_name, sizeof(od_control.system_name));
  397.             break;
  398.  
  399.          case kParamPortHandle:
  400.             ODAdvanceToNextArg(&nCurrentArg, nArgCount, pszCurrentArg);
  401.             od_control.od_open_handle = atoi(papszArguments[nCurrentArg]);
  402.             break;
  403.  
  404.          case kParamSilentMode:
  405.             od_control.od_silent_mode = TRUE;
  406.             break;
  407.  
  408.          case kParamUnknown:
  409.             /* If the client application provided a custom command line   */
  410.             /* handler function, then pass this unrecognized command-line */
  411.             /* parameter and any options to that callback function.       */
  412.             if(od_control.od_cmd_line_handler != NULL)
  413.             {
  414.                char szCustomOptions[CUSTOM_OPTION_SIZE];
  415.                ODGetNextArgName(&nCurrentArg, nArgCount, papszArguments,
  416.                   szCustomOptions, sizeof(szCustomOptions));
  417.                (*od_control.od_cmd_line_handler)(pszCurrentArg,
  418.                   szCustomOptions);
  419.             }
  420.             break;
  421.       }
  422.    }
  423.  
  424. #ifdef ODPLAT_WIN32
  425.    free(pszCmdLineCopy);
  426. #endif /* ODPLAT_WIN32 */
  427. }
  428.  
  429.  
  430. /* ----------------------------------------------------------------------------
  431.  * ODAdvanceToNextArg()                                *** PRIVATE FUNCTION ***
  432.  *
  433.  * Moves to the argument for a particular command line option.
  434.  *
  435.  * Parameters: pnCurrentArg - Pointer to current argument number.
  436.  *
  437.  *             nArgCount    - Total number of arguments available.
  438.  *
  439.  *             pszOption    - Pointer to command line option name.
  440.  *
  441.  *     Return: void
  442.  */
  443. static void ODAdvanceToNextArg(INT *pnCurrentArg, INT nArgCount,
  444.    char *pszOption)
  445. {
  446.    ASSERT(pnCurrentArg != NULL);
  447.    ASSERT(pszOption != NULL);
  448.  
  449.    if(++*pnCurrentArg >= nArgCount)
  450.    {
  451.       printf("Missing parameter for option: %s\n", pszOption);
  452.       exit(1);
  453.    }
  454. }
  455.  
  456.  
  457. /* ----------------------------------------------------------------------------
  458.  * ODGetNextArgName()                                  *** PRIVATE FUNCTION ***
  459.  *
  460.  * Obtains a multi-word name from command-line.
  461.  *
  462.  * Parameters: pnCurrentArg   - Pointer to integer storing current argument
  463.  *                              number.
  464.  *
  465.  *             nArgCount      - The total number of command-line argument
  466.  *
  467.  *             papszArguments - Pointer to array of pointers to string
  468.  *                              arguments, as passed to main() in argv.
  469.  *
  470.  *             pszString      - Pointer to string in which name will string
  471.  *                              be stored.
  472.  *
  473.  *             nStringSize    - Size of the string.
  474.  *
  475.  *     Return: void
  476.  */
  477. static void ODGetNextArgName(INT *pnCurrentArg, INT nArgCount,
  478.    char *papszArguments[], char *pszString, size_t nStringSize)
  479. {
  480.    BOOL bFirst = TRUE;
  481.  
  482.    ASSERT(pnCurrentArg != NULL);
  483.    ASSERT(papszArguments != NULL);
  484.    ASSERT(pszString != NULL);
  485.    ASSERT(nStringSize > 0);
  486.  
  487.    if((*pnCurrentArg) + 1 >= nArgCount)
  488.    {
  489.       printf("Missing parameter for option: %s\n",
  490.          papszArguments[(*pnCurrentArg) - 1]);
  491.       exit(1);
  492.    }
  493.  
  494.    pszString[0] = '\0';
  495.  
  496.    while(++*pnCurrentArg < nArgCount)
  497.    {
  498.       if(ODGetCommandLineParameter(papszArguments[*pnCurrentArg])
  499.          != kParamOption)
  500.       {
  501.          --*pnCurrentArg;
  502.          break;
  503.       }
  504.  
  505.       if(strlen(pszString) >= nStringSize - 1)
  506.       {
  507.          break;
  508.       }
  509.  
  510.       if(!bFirst)
  511.       {
  512.          strcat(pszString, " ");
  513.       }
  514.  
  515.       strncat(pszString, papszArguments[*pnCurrentArg],
  516.          strlen(pszString) - nStringSize - 1);
  517.       pszString[nStringSize - 1] = '\0';
  518.  
  519.       bFirst = FALSE;
  520.    }
  521.  
  522. }
  523.  
  524.  
  525. /* ----------------------------------------------------------------------------
  526.  * ODGetCommandLineParameter()                         *** PRIVATE FUNCTION ***
  527.  *
  528.  * Determines which command-line option, if any, is specified by an argument
  529.  * string.
  530.  *
  531.  * Parameters: pszArgument - Pointer to string containing raw command-line
  532.  *                           argument.
  533.  *
  534.  *     Return: A tCommandLineParameter, identifying which command-line option,
  535.  *             if any, matches the argument string.
  536.  */
  537. static tCommandLineParameter ODGetCommandLineParameter(char *pszArgument)
  538. {
  539.    ASSERT(pszArgument != NULL);
  540.  
  541.    if(*pszArgument == '-' || *pszArgument == '/')
  542.    {
  543.       ++pszArgument;
  544.    }
  545.    else
  546.    {
  547.       return(kParamOption);
  548.    }
  549.  
  550.    if(stricmp(pszArgument, "C") == 0
  551.       || stricmp(pszArgument, "CONFIG") == 0
  552.       || stricmp(pszArgument, "CONFIGFILE") == 0
  553.       || stricmp(pszArgument, "CFGFILE") == 0
  554.       || stricmp(pszArgument, "CFG") == 0)
  555.    {
  556.       return(kParamConfigFile);
  557.    }
  558.    else if(stricmp(pszArgument, "L") == 0
  559.       || stricmp(pszArgument, "LOCAL") == 0)
  560.    {
  561.       return(kParamLocal);
  562.    }
  563.    else if(stricmp(pszArgument, "B") == 0
  564.       || stricmp(pszArgument, "BPS") == 0
  565.       || stricmp(pszArgument, "BAUD") == 0)
  566.    {
  567.       return(kParamBPS);
  568.    }
  569.    else if(stricmp(pszArgument, "P") == 0
  570.       || stricmp(pszArgument, "PORT") == 0)
  571.    {
  572.       return(kParamPort);
  573.    }
  574.    else if(stricmp(pszArgument, "N") == 0
  575.       || stricmp(pszArgument, "NODE") == 0)
  576.    {
  577.       return(kParamNode);
  578.    }
  579.    else if(stricmp(pszArgument, "?") == 0
  580.       || stricmp(pszArgument, "H") == 0
  581.       || stricmp(pszArgument, "HELP") == 0)
  582.    {
  583.       return(kParamHelp);
  584.    }
  585.    else if(stricmp(pszArgument, "PERSONALITY") == 0)
  586.    {
  587.       return(kParamPersonality);
  588.    }
  589.    else if(stricmp(pszArgument, "MAXTIME") == 0)
  590.    {
  591.       return(kParamMaxTime);
  592.    }
  593.    else if(stricmp(pszArgument, "ADDRESS") == 0)
  594.    {
  595.       return(kParamAddress);
  596.    }
  597.    else if(stricmp(pszArgument, "IRQ") == 0)
  598.    {
  599.       return(kParamIRQ);
  600.    }
  601.    else if(stricmp(pszArgument, "NOFOSSIL") == 0)
  602.    {
  603.       return(kParamNoFOSSIL);
  604.    }
  605.    else if(stricmp(pszArgument, "NOFIFO") == 0)
  606.    {
  607.       return(kParamNoFIFO);
  608.    }
  609.    else if(stricmp(pszArgument, "DROPFILE") == 0 ||
  610.       stricmp(pszArgument, "D") == 0)
  611.    {
  612.       return(kParamDropFile);
  613.    }
  614.    else if(stricmp(pszArgument, "USERNAME") == 0)
  615.    {
  616.       return(kParamUserName);
  617.    }
  618.    else if(stricmp(pszArgument, "TIMELEFT") == 0)
  619.    {
  620.       return(kParamTimeLeft);
  621.    }
  622.    else if(stricmp(pszArgument, "SECURITY") == 0)
  623.    {
  624.       return(kParamSecurity);
  625.    }
  626.    else if(stricmp(pszArgument, "LOCATION") == 0)
  627.    {
  628.       return(kParamLocation);
  629.    }
  630.    else if(stricmp(pszArgument, "GRAPHICS") == 0
  631.       || stricmp(pszArgument, "G") == 0)
  632.    {
  633.       return(kParamGraphics);
  634.    }
  635.    else if(stricmp(pszArgument, "BBSNAME") == 0)
  636.    {
  637.       return(kParamBBSName);
  638.    }
  639.    else if(stricmp(pszArgument, "HANDLE") == 0)
  640.    {
  641.       return(kParamPortHandle);
  642.    }
  643.    else if(stricmp(pszArgument, "SILENT") == 0)
  644.    {
  645.       return(kParamSilentMode);
  646.    }
  647.    else
  648.    {
  649.       return(kParamUnknown);
  650.    }
  651. }
  652.