Skip to content

Commit

Permalink
vi: cleanup code for configuration file handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed Aug 5, 2024
1 parent 27fdceb commit f72b400
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
3 changes: 1 addition & 2 deletions bld/vi/win/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2015-2023 The Open Watcom Contributors. All Rights Reserved.
* Copyright (c) 2015-2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -150,7 +150,6 @@ int PASCAL WinMain( HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show )
#else
GlobVarAddStr( GLOBVAR_OS, "winnt" );
#endif
SetConfigFileName( CFG_NAME );
ReadProfile();

initApplication();
Expand Down
26 changes: 14 additions & 12 deletions bld/vi/win/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2015-2022 The Open Watcom Contributors. All Rights Reserved.
* Copyright (c) 2015-2024 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -43,6 +43,14 @@
#define CONFIG_DIR "Open Watcom"
#define INI_FILE "watcom.ini"

#if defined(__WINDOWS_386__)
#define STUPIDINT short
#elif defined(__NT__)
#define STUPIDINT LONG
#else
#define STUPIDINT int
#endif

static char *iniFile = NULL;
static char *iniPath = NULL;
static char *cfgFile = NULL;
Expand All @@ -55,13 +63,6 @@ static char *keyChildrenMaximized = "ChildrenMaximized";
static time_t cfgTime;

static bool saveConfig;
#if defined(__WINDOWS_386__)
#define STUPIDINT short
#elif defined(__NT__)
#define STUPIDINT LONG
#else
#define STUPIDINT int
#endif

/*
* getProfileString - get a string from the profile
Expand Down Expand Up @@ -224,9 +225,9 @@ static void getConfigFilePaths( void )
} /* getConfigFilePaths */

/*
* readConfigFile - get the name of the config file that we are to read
* getConfigFile - get the name of the config file that we are to read
*/
static void readConfigFile( void )
static void getConfigFile( void )
{
char cname[_MAX_PATH];
//char str[MAX_STR]; // not used if not prompting for new cfg files
Expand All @@ -236,6 +237,7 @@ static void readConfigFile( void )
time_t new_cfgtime = 0;

cfgTime = (time_t)getProfileLong( keyCfgTime );
SetConfigFileName( CFG_NAME );
cfgname = GetConfigFileName();
GetFromEnv( cfgname, cname );
if( cname[0] != '\0' ) {
Expand Down Expand Up @@ -268,7 +270,7 @@ static void readConfigFile( void )
}
saveConfig = ( getProfileLong( keySaveConfig ) != 0 );

} /* readConfigFile */
} /* getConfigFile */

/*
* writeConfigFile - write the current config file name
Expand Down Expand Up @@ -306,7 +308,7 @@ void ReadProfile( void )
getConfigFilePaths(); /* get paths to ini files */
readToolBarSize();
readInitialPosition();
readConfigFile();
getConfigFile();

} /* ReadProfile */

Expand Down

0 comments on commit f72b400

Please sign in to comment.