/* * XPilot NG, a multiplayer space war game. * * Copyright (C) 1991-2001 by * * Bjørn Stabell * Ken Ronny Schouten * Bert Gijsbers * Dick Balaska * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Original options parsing code contributed by Ted Lemon */ #include "xpserver.h" /* * Print the option list in "-help" format. * NT uses this to generate the ServerOpts.txt file */ static void Parse_help(char *progname) { int j, flags, all_flags, option_count; const char *str; option_desc *option_descs; char msg[MSG_LEN]; option_descs = Get_option_descs(&option_count); printf("Usage: %s [ options ]\n" "\n", progname); printf("Option flags specify where an option can be used and whether it\n" "is visible or not. Default flags are \"any\" if not otherwise\n" "specified by one or more of these keywords:\n" "\n"); printf("command May be specified on the command-line.\n" "passwordfile May be specified in the password file.\n" "defaults May be specified in the defaults file.\n" "any May be specified in the map file, defaults file,\n" " or on the command line.\n" "invisible Is not displayed when a list of options is\n" " requested from the server by an operator.\n" "\n"); printf("The possible options include:\n" "\n"); for (j = 0; j < option_count; j++) { printf(" %s%s", option_descs[j].type == valBool ? "-/+" : "-", option_descs[j].name); if (strcasecmp(option_descs[j].commandLineOption, option_descs[j].name)) xpprintf(" or %s", option_descs[j].commandLineOption); printf(" %s\n", option_descs[j].type == valInt ? "" : option_descs[j].type == valReal ? "" : option_descs[j].type == valString ? "" : option_descs[j].type == valIPos ? "" : option_descs[j].type == valList ? "" : ""); for (str = option_descs[j].helpLine; *str; str++) { if (str == option_descs[j].helpLine || str[-1] == '\n') putchar('\t'); putchar(*str); } if (str > option_descs[j].helpLine && str[-1] != '\n') putchar('\n'); flags = option_descs[j].flags; all_flags = (OPT_ORIGIN_ANY | OPT_VISIBLE); if ((flags & all_flags) != all_flags && flags != 0) { strlcpy(msg, "[ Flags: command, ", sizeof(msg)); if ((flags & OPT_PASSWORD) != 0) strlcat(msg, "passwordfile, ", sizeof(msg)); if ((flags & (OPT_DEFAULTS | OPT_MAP)) == OPT_DEFAULTS) strlcat(msg, "defaults, ", sizeof(msg)); if ((flags & OPT_MAP) != 0) strlcat(msg, "any, ", sizeof(msg)); if ((flags & OPT_VISIBLE) == 0) strlcat(msg, "invisible, ", sizeof(msg)); msg[strlen(msg) - 2] = '\0'; strlcat(msg, " ]", sizeof(msg)); printf("\t%s\n", msg); } putchar('\n'); } printf( " \n" " The probabilities are in the range [0.0-1.0] and they refer to the\n" " probability that an event will occur in a block per second.\n" " Boolean options are turned off by using +