config.c cosmetics: Make local functions static.
SVN revision: 7137
This commit is contained in:
parent
99a879cf34
commit
932971833c
40
src/E.h
40
src/E.h
|
@ -2478,43 +2478,17 @@ void ModifyCMClass(char *name, int rnum, unsigned char *rpx,
|
||||||
unsigned char *bpy);
|
unsigned char *bpy);
|
||||||
|
|
||||||
/* config.c functions */
|
/* config.c functions */
|
||||||
char *GetLine(char *s, int size, FILE * f);
|
char *FindFile(const char *file);
|
||||||
int testForComment(char *line);
|
int LoadConfigFile(const char *file);
|
||||||
int GetNextLine(char *line, FILE * ConfigFile);
|
|
||||||
void Config_Text(FILE * ConfigFile);
|
|
||||||
void Config_Slideout(FILE * ConfigFile);
|
|
||||||
void Config_Control(FILE * ConfigFile);
|
|
||||||
void Config_MenuStyle(FILE * ConfigFile);
|
|
||||||
void Config_Menu(FILE * ConfigFile);
|
|
||||||
void BorderPartLoad(FILE * ConfigFile, char type, Border * b);
|
|
||||||
void Config_Border(FILE * ConfigFile);
|
|
||||||
void Config_Button(FILE * ConfigFile);
|
|
||||||
void Config_Desktop(FILE * ConfigFile);
|
|
||||||
void Config_ECursor(FILE * ConfigFile);
|
|
||||||
void Config_Iconbox(FILE * ConfigFile);
|
|
||||||
void Config_Sound(FILE * ConfigFile);
|
|
||||||
void Config_ActionClass(FILE * ConfigFile);
|
|
||||||
void Config_ImageClass(FILE * ConfigFile);
|
|
||||||
void Config_ColorModifier(FILE * ConfigFile);
|
|
||||||
void Config_Extras(FILE * ConfigFile);
|
|
||||||
void Config_Ibox(FILE * ConfigFile);
|
|
||||||
void Config_FX(FILE * ConfigFile);
|
|
||||||
void Config_WindowMatch(FILE * ConfigFile);
|
|
||||||
int IsWhitespace(const char *s);
|
|
||||||
FILE *OpenConfigFileForReading(char *path, char preprocess);
|
|
||||||
void Config_ToolTip(FILE * ConfigFile);
|
|
||||||
int LoadConfigFile(char *file);
|
|
||||||
int LoadOpenConfigFile(FILE * ConfigFile);
|
|
||||||
int LoadStringFiles(void);
|
|
||||||
char *ExtractTheme(char *theme);
|
|
||||||
char *FindFile(char *file);
|
|
||||||
char *FindNoThemeFile(char *file);
|
|
||||||
char *FindTheme(char *theme);
|
|
||||||
void BadThemeDialog(void);
|
|
||||||
int LoadEConfig(char *themelocation);
|
int LoadEConfig(char *themelocation);
|
||||||
void SaveUserControlConfig(FILE * autosavefile);
|
void SaveUserControlConfig(FILE * autosavefile);
|
||||||
void RecoverUserConfig(void);
|
void RecoverUserConfig(void);
|
||||||
|
|
||||||
|
/* theme.c functions */
|
||||||
|
void BadThemeDialog(void);
|
||||||
|
char *FindTheme(char *theme);
|
||||||
|
char *ExtractTheme(char *theme);
|
||||||
|
|
||||||
void HKeyPress(XEvent * ev);
|
void HKeyPress(XEvent * ev);
|
||||||
void HKeyRelease(XEvent * ev);
|
void HKeyRelease(XEvent * ev);
|
||||||
void HButtonPress(XEvent * ev);
|
void HButtonPress(XEvent * ev);
|
||||||
|
|
318
src/config.c
318
src/config.c
|
@ -41,23 +41,21 @@ if (FindItem(name, 0, LIST_FINDBY_NAME, type)) \
|
||||||
return;\
|
return;\
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
SkipTillEnd(FILE * ConfigFile)
|
IsWhitespace(const char *s)
|
||||||
{
|
{
|
||||||
char s[FILEPATH_LEN_MAX];
|
int i = 0;
|
||||||
int i1, i2, fields;
|
|
||||||
|
|
||||||
while (GetLine(s, sizeof(s), ConfigFile))
|
while (s[i])
|
||||||
{
|
{
|
||||||
fields = sscanf(s, "%i %i", &i1, &i2);
|
if ((s[i] != ' ') && (s[i] != '\n') && (s[i] != '\t'))
|
||||||
if (i1 == CONFIG_CLOSE)
|
return 0;
|
||||||
return;
|
i++;
|
||||||
if (i2 == CONFIG_OPEN)
|
|
||||||
SkipTillEnd(ConfigFile);
|
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
GetLine(char *s, int size, FILE * f)
|
GetLine(char *s, int size, FILE * f)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -211,7 +209,23 @@ GetLine(char *s, int size, FILE * f)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
|
SkipTillEnd(FILE * ConfigFile)
|
||||||
|
{
|
||||||
|
char s[FILEPATH_LEN_MAX];
|
||||||
|
int i1, i2, fields;
|
||||||
|
|
||||||
|
while (GetLine(s, sizeof(s), ConfigFile))
|
||||||
|
{
|
||||||
|
fields = sscanf(s, "%i %i", &i1, &i2);
|
||||||
|
if (i1 == CONFIG_CLOSE)
|
||||||
|
return;
|
||||||
|
if (i2 == CONFIG_OPEN)
|
||||||
|
SkipTillEnd(ConfigFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
Config_Text(FILE * ConfigFile)
|
Config_Text(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -445,7 +459,7 @@ Config_Text(FILE * ConfigFile)
|
||||||
"Done loading a text block. Outcome is likely not good.\n"));
|
"Done loading a text block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_Slideout(FILE * ConfigFile)
|
Config_Slideout(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -523,7 +537,7 @@ Config_Slideout(FILE * ConfigFile)
|
||||||
"Done loading a Slideout block. Outcome is likely not good.\n"));
|
"Done loading a Slideout block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_Control(FILE * ConfigFile)
|
Config_Control(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -842,7 +856,7 @@ Config_Control(FILE * ConfigFile)
|
||||||
"Done loading a Control block. Outcome is likely not good.\n"));
|
"Done loading a Control block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_MenuStyle(FILE * ConfigFile)
|
Config_MenuStyle(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
char s[FILEPATH_LEN_MAX];
|
char s[FILEPATH_LEN_MAX];
|
||||||
|
@ -952,7 +966,7 @@ Config_MenuStyle(FILE * ConfigFile)
|
||||||
"Done loading a Menu block. Outcome is likely not good.\n"));
|
"Done loading a Menu block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_Menu(FILE * ConfigFile)
|
Config_Menu(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
char s[FILEPATH_LEN_MAX];
|
char s[FILEPATH_LEN_MAX];
|
||||||
|
@ -1185,7 +1199,7 @@ Config_Menu(FILE * ConfigFile)
|
||||||
"Done loading a Menu block. Outcome is likely not good.\n"));
|
"Done loading a Menu block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
BorderPartLoad(FILE * ConfigFile, char type, Border * b)
|
BorderPartLoad(FILE * ConfigFile, char type, Border * b)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1322,7 +1336,7 @@ BorderPartLoad(FILE * ConfigFile, char type, Border * b)
|
||||||
"Done loading a BorderPart block. Outcome is likely not good.\n"));
|
"Done loading a BorderPart block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_Border(FILE * ConfigFile)
|
Config_Border(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1412,7 +1426,7 @@ Config_Border(FILE * ConfigFile)
|
||||||
"Done loading a Main Border block. Outcome is likely not good.\n"));
|
"Done loading a Main Border block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_Button(FILE * ConfigFile)
|
Config_Button(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1633,7 +1647,7 @@ Config_Button(FILE * ConfigFile)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_Desktop(FILE * ConfigFile)
|
Config_Desktop(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
/* this sets desktop settings */
|
/* this sets desktop settings */
|
||||||
|
@ -1889,7 +1903,7 @@ Config_Desktop(FILE * ConfigFile)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_ECursor(FILE * ConfigFile)
|
Config_ECursor(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
ImlibColor icl, icl2;
|
ImlibColor icl, icl2;
|
||||||
|
@ -1970,7 +1984,7 @@ Config_ECursor(FILE * ConfigFile)
|
||||||
"Done loading a Desktop block. Outcome is likely not good.\n"));
|
"Done loading a Desktop block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_Iconbox(FILE * ConfigFile)
|
Config_Iconbox(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
char s[FILEPATH_LEN_MAX];
|
char s[FILEPATH_LEN_MAX];
|
||||||
|
@ -2013,7 +2027,7 @@ Config_Iconbox(FILE * ConfigFile)
|
||||||
"Done loading an Iconbox block. Outcome is likely not good.\n"));
|
"Done loading an Iconbox block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_Sound(FILE * ConfigFile)
|
Config_Sound(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -2049,7 +2063,7 @@ Config_Sound(FILE * ConfigFile)
|
||||||
"Done loading an Sound block. Outcome is likely not good.\n"));
|
"Done loading an Sound block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_ActionClass(FILE * ConfigFile)
|
Config_ActionClass(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -2318,7 +2332,7 @@ Config_ActionClass(FILE * ConfigFile)
|
||||||
"Done loading an Action Class block. Outcome is likely not good.\n"));
|
"Done loading an Action Class block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_ImageClass(FILE * ConfigFile)
|
Config_ImageClass(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -2525,7 +2539,7 @@ Config_ImageClass(FILE * ConfigFile)
|
||||||
"Done loading an ImageClass block. Outcome is likely not good.\n"));
|
"Done loading an ImageClass block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_ColorModifier(FILE * ConfigFile)
|
Config_ColorModifier(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
char s[FILEPATH_LEN_MAX];
|
char s[FILEPATH_LEN_MAX];
|
||||||
|
@ -2793,7 +2807,7 @@ Config_ColorModifier(FILE * ConfigFile)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_ToolTip(FILE * ConfigFile)
|
Config_ToolTip(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -2891,7 +2905,7 @@ Config_ToolTip(FILE * ConfigFile)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_FX(FILE * ConfigFile)
|
Config_FX(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -2929,53 +2943,7 @@ Config_FX(FILE * ConfigFile)
|
||||||
"Done loading an FX block. Outcome is likely not good.\n"));
|
"Done loading an FX block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Config_Extras(FILE * ConfigFile)
|
|
||||||
{
|
|
||||||
char s[FILEPATH_LEN_MAX];
|
|
||||||
char s2[FILEPATH_LEN_MAX];
|
|
||||||
int i1;
|
|
||||||
int fields;
|
|
||||||
Iconbox **ib;
|
|
||||||
int i, num;
|
|
||||||
|
|
||||||
ib = ListAllIconboxes(&num);
|
|
||||||
if (ib)
|
|
||||||
{
|
|
||||||
for (i = 0; i < num; i++)
|
|
||||||
FreeIconbox(ib[i]);
|
|
||||||
Efree(ib);
|
|
||||||
}
|
|
||||||
while (GetLine(s, sizeof(s), ConfigFile))
|
|
||||||
{
|
|
||||||
s2[0] = 0;
|
|
||||||
i1 = CONFIG_INVALID;
|
|
||||||
|
|
||||||
fields = sscanf(s, "%i %4000s", &i1, s2);
|
|
||||||
switch (i1)
|
|
||||||
{
|
|
||||||
case CONFIG_IBOX:
|
|
||||||
Config_Ibox(ConfigFile);
|
|
||||||
break;
|
|
||||||
case CONFIG_CLOSE:
|
|
||||||
return;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Alert(_
|
|
||||||
("Warning: unable to determine what to do with\n"
|
|
||||||
"the following text in the middle of current "
|
|
||||||
"Extras definition:\n"
|
|
||||||
"%s\nWill ignore and continue...\n"), s);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RecoverUserConfig();
|
|
||||||
Alert(_
|
|
||||||
("Warning: Configuration appears to have ended before we were\n"
|
|
||||||
"Done loading an Extras block. Outcome is likely not good.\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Config_Ibox(FILE * ConfigFile)
|
Config_Ibox(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -3075,7 +3043,53 @@ Config_Ibox(FILE * ConfigFile)
|
||||||
"Done loading an Iconbox block. Outcome is likely not good.\n"));
|
"Done loading an Iconbox block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
|
Config_Extras(FILE * ConfigFile)
|
||||||
|
{
|
||||||
|
char s[FILEPATH_LEN_MAX];
|
||||||
|
char s2[FILEPATH_LEN_MAX];
|
||||||
|
int i1;
|
||||||
|
int fields;
|
||||||
|
Iconbox **ib;
|
||||||
|
int i, num;
|
||||||
|
|
||||||
|
ib = ListAllIconboxes(&num);
|
||||||
|
if (ib)
|
||||||
|
{
|
||||||
|
for (i = 0; i < num; i++)
|
||||||
|
FreeIconbox(ib[i]);
|
||||||
|
Efree(ib);
|
||||||
|
}
|
||||||
|
while (GetLine(s, sizeof(s), ConfigFile))
|
||||||
|
{
|
||||||
|
s2[0] = 0;
|
||||||
|
i1 = CONFIG_INVALID;
|
||||||
|
|
||||||
|
fields = sscanf(s, "%i %4000s", &i1, s2);
|
||||||
|
switch (i1)
|
||||||
|
{
|
||||||
|
case CONFIG_IBOX:
|
||||||
|
Config_Ibox(ConfigFile);
|
||||||
|
break;
|
||||||
|
case CONFIG_CLOSE:
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Alert(_
|
||||||
|
("Warning: unable to determine what to do with\n"
|
||||||
|
"the following text in the middle of current "
|
||||||
|
"Extras definition:\n"
|
||||||
|
"%s\nWill ignore and continue...\n"), s);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RecoverUserConfig();
|
||||||
|
Alert(_
|
||||||
|
("Warning: Configuration appears to have ended before we were\n"
|
||||||
|
"Done loading an Extras block. Outcome is likely not good.\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
Config_WindowMatch(FILE * ConfigFile)
|
Config_WindowMatch(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -3190,23 +3204,9 @@ Config_WindowMatch(FILE * ConfigFile)
|
||||||
"Done loading an WindowMatch block. Outcome is likely not good.\n"));
|
"Done loading an WindowMatch block. Outcome is likely not good.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
IsWhitespace(const char *s)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
while (s[i])
|
|
||||||
{
|
|
||||||
if ((s[i] != ' ') && (s[i] != '\n') && (s[i] != '\t'))
|
|
||||||
return 0;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *cfg_tmpfile = NULL;
|
static char *cfg_tmpfile = NULL;
|
||||||
|
|
||||||
FILE *
|
static FILE *
|
||||||
OpenConfigFileForReading(char *path, char preprocess)
|
OpenConfigFileForReading(char *path, char preprocess)
|
||||||
{
|
{
|
||||||
/* This function will open a file at location path for */
|
/* This function will open a file at location path for */
|
||||||
|
@ -3318,71 +3318,8 @@ OpenConfigFileForReading(char *path, char preprocess)
|
||||||
EDBUG_RETURN(0);
|
EDBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
LoadConfigFile(char *f)
|
|
||||||
{
|
|
||||||
FILE *ConfigFile;
|
|
||||||
char s[FILEPATH_LEN_MAX], s2[FILEPATH_LEN_MAX];
|
|
||||||
char *file, *ppfile;
|
|
||||||
int i;
|
|
||||||
char notheme = 0;
|
|
||||||
|
|
||||||
EDBUG(5, "LoadConfigFile");
|
|
||||||
|
|
||||||
Esnprintf(s, sizeof(s), "%s", f);
|
|
||||||
file = FindFile(s);
|
|
||||||
if (!file)
|
|
||||||
EDBUG_RETURN(0);
|
|
||||||
|
|
||||||
strcpy(s2, file);
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
while (s2[i])
|
|
||||||
{
|
|
||||||
#ifndef __EMX__
|
|
||||||
if (s2[i] == '/')
|
|
||||||
#else
|
|
||||||
if (s2[i] == '/' || s2[i] == '\\' || s2[i] == ':')
|
|
||||||
#endif
|
|
||||||
s2[i] = '.';
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
Esnprintf(s, sizeof(s), "%s/cached/cfg/%s.preparsed", UserCacheDir(), s2);
|
|
||||||
|
|
||||||
if (strstr(f, "control.cfg"))
|
|
||||||
notheme = 1;
|
|
||||||
else if (strstr(f, "menus.cfg"))
|
|
||||||
notheme = 1;
|
|
||||||
else if (strstr(f, "keybindings.cfg"))
|
|
||||||
notheme = 1;
|
|
||||||
if (notheme)
|
|
||||||
ppfile = FindNoThemeFile(s);
|
|
||||||
else
|
|
||||||
ppfile = FindFile(s);
|
|
||||||
|
|
||||||
if (!ppfile)
|
|
||||||
{
|
|
||||||
if (file)
|
|
||||||
Efree(file);
|
|
||||||
if (notheme)
|
|
||||||
file = FindNoThemeFile(f);
|
|
||||||
else
|
|
||||||
file = FindFile(f);
|
|
||||||
}
|
|
||||||
if ((ppfile) && (exists(ppfile)) && (moddate(file) < moddate(ppfile)))
|
|
||||||
ConfigFile = OpenConfigFileForReading(ppfile, 0);
|
|
||||||
else
|
|
||||||
ConfigFile = OpenConfigFileForReading(file, 1);
|
|
||||||
if (ppfile)
|
|
||||||
Efree(ppfile);
|
|
||||||
if (file)
|
|
||||||
Efree(file);
|
|
||||||
return LoadOpenConfigFile(ConfigFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Split the process of finding the file from the process of loading it */
|
/* Split the process of finding the file from the process of loading it */
|
||||||
int
|
static int
|
||||||
LoadOpenConfigFile(FILE * ConfigFile)
|
LoadOpenConfigFile(FILE * ConfigFile)
|
||||||
{
|
{
|
||||||
int i1, i2, fields;
|
int i1, i2, fields;
|
||||||
|
@ -3559,7 +3496,7 @@ LoadOpenConfigFile(FILE * ConfigFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
FindFile(char *file)
|
FindFile(const char *file)
|
||||||
{
|
{
|
||||||
char s[FILEPATH_LEN_MAX];
|
char s[FILEPATH_LEN_MAX];
|
||||||
|
|
||||||
|
@ -3609,8 +3546,8 @@ FindFile(char *file)
|
||||||
EDBUG_RETURN(NULL);
|
EDBUG_RETURN(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
FindNoThemeFile(char *file)
|
FindNoThemeFile(const char *file)
|
||||||
{
|
{
|
||||||
char s[FILEPATH_LEN_MAX];
|
char s[FILEPATH_LEN_MAX];
|
||||||
|
|
||||||
|
@ -3654,6 +3591,69 @@ FindNoThemeFile(char *file)
|
||||||
EDBUG_RETURN(NULL);
|
EDBUG_RETURN(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
LoadConfigFile(const char *f)
|
||||||
|
{
|
||||||
|
FILE *ConfigFile;
|
||||||
|
char s[FILEPATH_LEN_MAX], s2[FILEPATH_LEN_MAX];
|
||||||
|
char *file, *ppfile;
|
||||||
|
int i;
|
||||||
|
char notheme = 0;
|
||||||
|
|
||||||
|
EDBUG(5, "LoadConfigFile");
|
||||||
|
|
||||||
|
Esnprintf(s, sizeof(s), "%s", f);
|
||||||
|
file = FindFile(s);
|
||||||
|
if (!file)
|
||||||
|
EDBUG_RETURN(0);
|
||||||
|
|
||||||
|
strcpy(s2, file);
|
||||||
|
i = 0;
|
||||||
|
|
||||||
|
while (s2[i])
|
||||||
|
{
|
||||||
|
#ifndef __EMX__
|
||||||
|
if (s2[i] == '/')
|
||||||
|
#else
|
||||||
|
if (s2[i] == '/' || s2[i] == '\\' || s2[i] == ':')
|
||||||
|
#endif
|
||||||
|
s2[i] = '.';
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Esnprintf(s, sizeof(s), "%s/cached/cfg/%s.preparsed", UserCacheDir(), s2);
|
||||||
|
|
||||||
|
if (strstr(f, "control.cfg"))
|
||||||
|
notheme = 1;
|
||||||
|
else if (strstr(f, "menus.cfg"))
|
||||||
|
notheme = 1;
|
||||||
|
else if (strstr(f, "keybindings.cfg"))
|
||||||
|
notheme = 1;
|
||||||
|
if (notheme)
|
||||||
|
ppfile = FindNoThemeFile(s);
|
||||||
|
else
|
||||||
|
ppfile = FindFile(s);
|
||||||
|
|
||||||
|
if (!ppfile)
|
||||||
|
{
|
||||||
|
if (file)
|
||||||
|
Efree(file);
|
||||||
|
if (notheme)
|
||||||
|
file = FindNoThemeFile(f);
|
||||||
|
else
|
||||||
|
file = FindFile(f);
|
||||||
|
}
|
||||||
|
if ((ppfile) && (exists(ppfile)) && (moddate(file) < moddate(ppfile)))
|
||||||
|
ConfigFile = OpenConfigFileForReading(ppfile, 0);
|
||||||
|
else
|
||||||
|
ConfigFile = OpenConfigFileForReading(file, 1);
|
||||||
|
if (ppfile)
|
||||||
|
Efree(ppfile);
|
||||||
|
if (file)
|
||||||
|
Efree(file);
|
||||||
|
return LoadOpenConfigFile(ConfigFile);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
LoadEConfig(char *themelocation)
|
LoadEConfig(char *themelocation)
|
||||||
{
|
{
|
||||||
|
@ -3727,7 +3727,7 @@ LoadEConfig(char *themelocation)
|
||||||
{
|
{
|
||||||
Progressbar *p = NULL;
|
Progressbar *p = NULL;
|
||||||
int i;
|
int i;
|
||||||
char *config_files[] = {
|
static const char *const config_files[] = {
|
||||||
"init.cfg",
|
"init.cfg",
|
||||||
"control.cfg",
|
"control.cfg",
|
||||||
"textclasses.cfg",
|
"textclasses.cfg",
|
||||||
|
|
Loading…
Reference in New Issue