#include "race.h"
#include "options.h"
#include "macros.h"
#include "pace.h"
#include "fs.h"
#include "utils.h"
#include "logging.h"
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL.h>
Go to the source code of this file.
Defines | |
#define | DEFAULT_DATADIR CONFIG_DATADIR |
#define | DEFAULT_SAVEDIR (".") |
#define | ENVIRON_DATADIR ("BARIS_DATA") |
#define | ENVIRON_SAVEDIR ("BARIS_SAVE") |
Functions | |
static void | fixpath_options (void) |
static char * | get_homedir (void) |
LOG_DEFAULT_CATEGORY (config) | |
static int | parse_var_value (FILE *f, int index) |
static int | read_config_file (void) |
read the config file | |
int | setup_options (int argc, char *argv[]) |
read the commandline options | |
static void | shift_argv (char **argv, int len, int shift) |
static int | skip_past_newline (FILE *f) |
static void | usage (int fail) |
prints the minimal usage information to stderr | |
static int | write_default_config (void) |
Variables | |
struct { | |
char * comment | |
a note to the user | |
void * dest | |
pointer to the variable to hold the content | |
char * name | |
name of option | |
int need_alloc | |
max size of the data in byte ??? | |
char * type | |
type of the data we get | |
} | config_strings [] |
struct { | |
char * def_val | |
char ** dest | |
char * name | |
} | env_vars [] |
game_options | options |
#define ENVIRON_SAVEDIR ("BARIS_SAVE") |
Definition at line 311 of file options.c.
References game_options::dir_gamedata, game_options::dir_savegame, and fix_pathsep().
Referenced by setup_options().
static char* get_homedir | ( | void | ) | [static] |
Definition at line 284 of file options.c.
References xstrcat2(), and xstrdup().
Referenced by setup_options().
LOG_DEFAULT_CATEGORY | ( | config | ) |
static int parse_var_value | ( | FILE * | f, | |
int | index | |||
) | [static] |
Definition at line 138 of file options.c.
References ARRAY_LENGTH, config_strings, need_alloc, type, and xrealloc().
Referenced by read_config_file().
static int read_config_file | ( | void | ) | [static] |
read the config file
Definition at line 172 of file options.c.
References ARRAY_LENGTH, c, config_strings, name, NOTICE1, NOTICE2, open_savedat(), parse_var_value(), skip_past_newline(), and WARNING1.
Referenced by setup_options().
int setup_options | ( | int | argc, | |
char * | argv[] | |||
) |
read the commandline options
Definition at line 324 of file options.c.
References ARRAY_LENGTH, def_val, dest, env_vars, ENVIRON_SAVEDIR, ERROR2, fixpath_options(), get_homedir(), name, PACKAGE_TARNAME, read_config_file(), shift_argv(), usage(), game_options::want_audio, game_options::want_cheats, game_options::want_debug, game_options::want_fullscreen, game_options::want_intro, WARNING2, write_default_config(), xmalloc(), and xstrdup().
Referenced by main().
static void shift_argv | ( | char ** | argv, | |
int | len, | |||
int | shift | |||
) | [static] |
static int skip_past_newline | ( | FILE * | f | ) | [static] |
static void usage | ( | int | fail | ) | [static] |
static int write_default_config | ( | void | ) | [static] |
Definition at line 248 of file options.c.
References ARRAY_LENGTH, comment, config_strings, create_save_dir(), game_options::dir_savegame, name, NOTICE3, open_savedat(), PACKAGE_STRING, WARNING2, and WARNING4.
Referenced by setup_options().
char* comment |
struct { ... } config_strings[] [static] |
Referenced by parse_var_value(), read_config_file(), and write_default_config().
char* def_val |
char** dest |
struct { ... } env_vars[] [static] |
Referenced by setup_options().
char* name |
Definition at line 71 of file options.c.
Referenced by Best(), BuildVAB(), CalcSaf(), ChkDelVab(), DispVA(), DrawBudget(), Drec(), FillVab(), frm_read_tbl(), music_load(), play_audio(), PlaySequence(), read_config_file(), setup_options(), ShowVA(), SwapRec(), VAB(), VVals(), write_default_config(), and WriteRecord().
int need_alloc |
max size of the data in byte ???
Definition at line 83 of file options.c.
Referenced by parse_var_value().
Definition at line 65 of file options.c.
Referenced by av_setup(), create_save_dir(), first_saved_game(), main(), MisCheck(), remove_savedat(), and try_find_file().
char* type |
type of the data we get
Definition at line 82 of file options.c.
Referenced by Drec(), main(), parse_var_value(), RecChange(), write_image(), and WriteRecord().