ODCmdLn.c 22 KB

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