mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-25 05:11:23 +00:00
fix knghtbrd's segfault. Make two passes at the config file just like the command line.
This commit is contained in:
parent
ede51b8e01
commit
e0d55e9c19
3 changed files with 36 additions and 23 deletions
30
common/cmd.c
30
common/cmd.c
|
@ -201,6 +201,7 @@ Cbuf_Execute (void)
|
|||
while (cmd_text.cursize) {
|
||||
extract_line (line);
|
||||
// execute the command line
|
||||
printf("+%s\n",line),
|
||||
Cmd_ExecuteString (line, src_command);
|
||||
|
||||
if (cmd_wait)
|
||||
|
@ -292,6 +293,35 @@ void Cmd_StuffCmds_f (void)
|
|||
Z_Free (build);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Cmd_Exec_File
|
||||
|
||||
*/
|
||||
void
|
||||
Cmd_Exec_File (char *path)
|
||||
{
|
||||
char *f;
|
||||
int mark;
|
||||
int len;
|
||||
char base[32];
|
||||
QFile *file;
|
||||
|
||||
if ((file = Qopen (path, "r")) != NULL) {
|
||||
// extract the filename base name for hunk tag
|
||||
COM_FileBase (path, base);
|
||||
len = COM_filelength (file);
|
||||
mark = Hunk_LowMark ();
|
||||
f = (char *)Hunk_AllocName (len+1, base);
|
||||
if (f) {
|
||||
f[len] = 0;
|
||||
Qread (file, f, len);
|
||||
Qclose (file);
|
||||
Cbuf_InsertText (f);
|
||||
}
|
||||
Hunk_FreeToLowMark (mark);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
|
|
|
@ -128,5 +128,6 @@ void Cmd_ForwardToServer (void);
|
|||
|
||||
void Cmd_StuffCmds_f (void);
|
||||
void Cmd_Echo_f (void);
|
||||
void Cmd_Exec_File (char *path);
|
||||
|
||||
#endif // _CMD_H
|
||||
|
|
|
@ -532,8 +532,6 @@ extern cvar_t *fs_basepath;
|
|||
void
|
||||
Host_Init (quakeparms_t *parms)
|
||||
{
|
||||
QFile *globalcfg;
|
||||
|
||||
COM_InitArgv (parms->argc, parms->argv);
|
||||
|
||||
if ( COM_CheckParm ("-minmemory") )
|
||||
|
@ -560,33 +558,17 @@ Host_Init (quakeparms_t *parms)
|
|||
// probably Not A Good Thing (tm).
|
||||
global_cfg_file = Cvar_Get("global_cfg_file", GLOBAL_CFG_FILE,
|
||||
CVAR_ROM, "global configuration file");
|
||||
if ((globalcfg = Qopen (global_cfg_file->string, "r")) != NULL) {
|
||||
char *f;
|
||||
int mark;
|
||||
int len;
|
||||
char base[32];
|
||||
|
||||
// extract the filename base name for hunk tag
|
||||
COM_FileBase (global_cfg_file->string, base);
|
||||
len = COM_filelength (globalcfg);
|
||||
mark = Hunk_LowMark ();
|
||||
f = (char *)Hunk_AllocName (len+1, base);
|
||||
if (f) {
|
||||
f[len] = 0;
|
||||
Qread (globalcfg, f, len);
|
||||
Qclose (globalcfg);
|
||||
Cbuf_InsertText (f);
|
||||
}
|
||||
Hunk_FreeToLowMark (mark);
|
||||
if (f)
|
||||
Cbuf_Execute ();
|
||||
}
|
||||
|
||||
Cmd_Exec_File (global_cfg_file->string);
|
||||
Cbuf_Execute_Sets ();
|
||||
|
||||
CL_InitCvars ();
|
||||
SCR_InitCvars ();
|
||||
VID_InitCvars ();
|
||||
|
||||
Cmd_Exec_File (global_cfg_file->string);
|
||||
Cbuf_Execute ();
|
||||
|
||||
// reparse the command line for + commands other than set (sets still done,
|
||||
// but it doesn't matter)
|
||||
Cmd_StuffCmds_f ();
|
||||
|
|
Loading…
Reference in a new issue