Skip to content

Commit

Permalink
Remove popt API calls that are no longer necessary.
Browse files Browse the repository at this point in the history
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@10187 4a71c877-e1ca-e34f-864e-861f7616d084
(cherry picked from commit bcb70cb)

Conflicts:

	src/clparse.c
  • Loading branch information
buginator committed Oct 24, 2010
1 parent 2aca760 commit d42d9ed
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions src/clparse.c
Expand Up @@ -47,7 +47,6 @@ BOOL bAllowDebugMode = false;
#define POPT_ARG_STRING true
#define POPT_ARG_NONE false
#define POPT_ERROR_BADOPT -1
#define POPT_ARGFLAG_DOC_HIDDEN 0

struct poptOption
{
Expand All @@ -69,11 +68,6 @@ typedef struct _poptContext
const struct poptOption *table;
} *poptContext;

static void poptPrintUsage(poptContext ctx, FILE *output, WZ_DECL_UNUSED int unused)
{
// TODO ?
}

static void poptPrintHelp(poptContext ctx, FILE *output, WZ_DECL_UNUSED int unused)
{
int i;
Expand Down Expand Up @@ -107,11 +101,6 @@ static void poptPrintHelp(poptContext ctx, FILE *output, WZ_DECL_UNUSED int unus
}
}

static void poptFreeContext(WZ_DECL_UNUSED poptContext ctx)
{
// Nothing!
}

static const char *poptBadOption(poptContext ctx, WZ_DECL_UNUSED int unused)
{
return ctx->bad;
Expand Down Expand Up @@ -222,7 +211,6 @@ typedef enum
CLI_MOD_CA,
CLI_MOD_MP,
CLI_SAVEGAME,
CLI_USAGE,
CLI_WINDOW,
CLI_VERSION,
CLI_RESOLUTION,
Expand Down Expand Up @@ -256,8 +244,6 @@ static const struct poptOption* getOptionsTable(void)
{ "noassert", '\0', POPT_ARG_NONE, NULL, CLI_NOASSERT, N_("Disable asserts"), NULL },
{ "crash", '\0', POPT_ARG_NONE, NULL, CLI_CRASH, N_("Causes a crash to test the crash handler"), NULL },
{ "savegame", '\0', POPT_ARG_STRING, NULL, CLI_SAVEGAME, N_("Load a saved game"), N_("savegame") },
{ "usage", '\0', POPT_ARG_NONE
| POPT_ARGFLAG_DOC_HIDDEN, NULL, CLI_USAGE, NULL, NULL, },
{ "window", '\0', POPT_ARG_NONE, NULL, CLI_WINDOW, N_("Play in windowed mode"), NULL },
{ "version", '\0', POPT_ARG_NONE, NULL, CLI_VERSION, N_("Show version information and exit"), NULL },
{ "resolution", '\0', POPT_ARG_STRING, NULL, CLI_RESOLUTION, N_("Set the resolution to use"), N_("WIDTHxHEIGHT") },
Expand Down Expand Up @@ -336,15 +322,13 @@ bool ParseCommandLineEarly(int argc, const char** argv)
if (token == NULL)
{
debug(LOG_FATAL, "Usage: --debug <flag>");
poptFreeContext(poptCon);
return false;
}

// Attempt to enable the given debug section
if (!debug_enable_switch(token))
{
debug(LOG_FATAL, "Debug flag \"%s\" not found!", token);
poptFreeContext(poptCon);
return false;
}
break;
Expand All @@ -355,7 +339,6 @@ bool ParseCommandLineEarly(int argc, const char** argv)
if (token == NULL)
{
debug(LOG_FATAL, "Missing debugfile filename?");
poptFreeContext(poptCon);
return false;
}
debug_register_callback( debug_callback_file, debug_callback_file_init, debug_callback_file_exit, (void*)token );
Expand All @@ -373,34 +356,24 @@ bool ParseCommandLineEarly(int argc, const char** argv)
if (token == NULL)
{
debug(LOG_FATAL, "Unrecognised configuration directory");
poptFreeContext(poptCon);
return false;
}
sstrcpy(configdir, token);
break;

case CLI_HELP:
poptPrintHelp(poptCon, stdout, 0);
poptFreeContext(poptCon);
return false;

case CLI_USAGE:
poptPrintUsage(poptCon, stdout, 0);
poptFreeContext(poptCon);
return false;

case CLI_VERSION:
printf("Warzone 2100 - %s\n", version_getFormattedVersionString());
poptFreeContext(poptCon);
return false;

default:
break;
};
}

poptFreeContext(poptCon);

return true;
}

Expand Down Expand Up @@ -429,7 +402,6 @@ bool ParseCommandLine(int argc, const char** argv)
case CLI_FLUSHDEBUGSTDERR:
case CLI_CONFIGDIR:
case CLI_HELP:
case CLI_USAGE:
case CLI_VERSION:
// These options are parsed in ParseCommandLineEarly() already, so ignore them
break;
Expand Down Expand Up @@ -457,7 +429,6 @@ bool ParseCommandLine(int argc, const char** argv)
if (token == NULL)
{
debug(LOG_FATAL, "Unrecognised datadir");
poptFreeContext(poptCon);
return false;
}
sstrcpy(datadir, token);
Expand All @@ -472,7 +443,6 @@ bool ParseCommandLine(int argc, const char** argv)
if (token == NULL)
{
debug(LOG_FATAL, "No IP/hostname given");
poptFreeContext(poptCon);
return false;
}
sstrcpy(iptoconnect, token);
Expand All @@ -487,7 +457,6 @@ bool ParseCommandLine(int argc, const char** argv)
if (token == NULL)
{
debug(LOG_POPUP, "No game name");
poptFreeContext(poptCon);
return false;
}
if (strcmp(token, "CAM_1A") && strcmp(token, "CAM_2A") && strcmp(token, "CAM_3A")
Expand Down Expand Up @@ -521,7 +490,6 @@ bool ParseCommandLine(int argc, const char** argv)
if (token == NULL)
{
debug(LOG_FATAL, "Missing mod name?");
poptFreeContext(poptCon);
return false;
}

Expand All @@ -530,7 +498,6 @@ bool ParseCommandLine(int argc, const char** argv)
if (i >= 100 || global_mods[i] != NULL)
{
debug(LOG_FATAL, "Too many mods registered! Aborting!");
poptFreeContext(poptCon);
return false;
}
global_mods[i] = strdup(token);
Expand All @@ -545,7 +512,6 @@ bool ParseCommandLine(int argc, const char** argv)
if (token == NULL)
{
debug(LOG_FATAL, "Missing mod name?");
poptFreeContext(poptCon);
return false;
}

Expand All @@ -554,7 +520,6 @@ bool ParseCommandLine(int argc, const char** argv)
if (i >= 100 || campaign_mods[i] != NULL)
{
debug(LOG_FATAL, "Too many mods registered! Aborting!");
poptFreeContext(poptCon);
return false;
}
campaign_mods[i] = strdup(token);
Expand All @@ -569,15 +534,13 @@ bool ParseCommandLine(int argc, const char** argv)
if (token == NULL)
{
debug(LOG_FATAL, "Missing mod name?");
poptFreeContext(poptCon);
return false;
}

for (i = 0; i < 100 && multiplay_mods[i] != NULL; ++i);
if (i >= 100 || multiplay_mods[i] != NULL)
{
debug(LOG_FATAL, "Too many mods registered! Aborting!");
poptFreeContext(poptCon);
return false;
}
multiplay_mods[i] = strdup(token);
Expand Down Expand Up @@ -615,7 +578,6 @@ bool ParseCommandLine(int argc, const char** argv)
if (token == NULL)
{
debug(LOG_POPUP, "Unrecognised savegame name");
poptFreeContext(poptCon);
return false;
}
snprintf(saveGameName, sizeof(saveGameName), "%s/%s", SaveGamePath, token);
Expand Down Expand Up @@ -648,7 +610,5 @@ bool ParseCommandLine(int argc, const char** argv)
};
}

poptFreeContext(poptCon);

return true;
}

0 comments on commit d42d9ed

Please sign in to comment.