Files
ThomasandClaude Sonnet 5 1998bf4273 Strip dead Windows-only code paths, add LTO/march build flags, seed default GM account
Removes now-unreachable #ifdef _WIN32 branches across Common/ and the three
server binaries (all builds are Linux-only), deletes the entirely unused
SEH exception-handling shim and an orphaned vendored MySQL client header.
Enables LTO and -march=x86-64-v2 in Release builds for a small free perf win.

Also seeds a default GM account (gmadmin/changeme) via
database sql files/gm_account.sql so a fresh deploy has something to log
into the web admin panel with, switches the MariaDB data directory from a
Docker named volume to a host bind mount for visibility/backup, and expands
the README with a fuller Docker deployment walkthrough.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 15:42:36 +02:00

102 lines
2.6 KiB
C++

/*******************************************************************************************
___ ___ ___ ___
___| _ \/ _ \/ __| __|
/ -_) / (_) \__ \ _|
\___|_|_\\___/|___/___|
eROSE Server Develped by Brett19.
hROSE Team: Brett19 and bdaan
Year: 2006
Release Date: Summer-Winter 2006
*******************************************************************************************/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctype.h>
// Find the entry
bool ConfigGetEntry( const char *pcFile, const char *pcNameMust, char* &pcResult )
{
char pcBuffer[ 512 ];
char *pcName, *pcPar, *pcPoint;
unsigned len;
pcResult=0;
// Open file
FILE* fh = NULL;
fopen_s (&fh, pcFile, "r");
if ( fh == NULL ) return false;
do
{
fgets( pcBuffer, 510, fh );
len = (unsigned)strlen( pcBuffer );
if ( pcBuffer[ len-1 ] == '\n' ) --len;
pcBuffer[ len ] = 0;
pcName = pcBuffer;
while ( *pcName==' ' || *pcName=='\t' ) ++pcName;
if ( *pcName==0 || *pcName=='#' ) continue;
pcPoint = pcName;
while ( *pcPoint!=' ' && *pcPoint!='\t' && *pcPoint!='#' && *pcPoint!='=' && *pcPoint!=0 ) ++pcPoint;
if ( *pcPoint==0 || *pcPoint=='#' ) continue;
pcPar = pcPoint;
while ( *pcPar==' ' || *pcPar=='\t' || *pcPar=='=' ) ++pcPar;
*pcPoint=0;
if ( strcasecmp( pcName, pcNameMust )==0 )
{
pcResult = _strdup( pcPar );
pcPoint = pcResult + strlen( pcPar );
if ( *pcPoint==0 ) return true;
--pcPoint;
while( *pcPoint==' ' || *pcPoint=='\t' ) *pcPoint--=0;
return true;
}
} while ( !feof( fh ) );
// Close file
fclose( fh );
return true;
}
// -----------------------------------------------------------------------------------------
// Returns a text
// -----------------------------------------------------------------------------------------
char *ConfigGetString( const char *pcFile, const char *pcName, const char *pcDefault )
{
char *pcRet, *pcRetReal, *pcRetOld;
if ( !ConfigGetEntry( pcFile, pcName, pcRet ) ) return _strdup( pcDefault );
if (pcRet==0) return _strdup( pcDefault );
pcRetOld = pcRet;
if ( *pcRet=='"' )
{
++pcRet;
pcRet[ strlen(pcRet) - 1 ] = 0;
}
pcRetReal = _strdup( pcRet );
free( pcRetOld );
return pcRetReal;
}
// Returns a number
unsigned ConfigGetInt( const char *pcFile, const char *pcName, unsigned uDefault )
{
char *pcRet;
unsigned uRet;
if ( !ConfigGetEntry( pcFile, pcName, pcRet ) ) return uDefault;
if (pcRet==0) return uDefault;
uRet = atoi( pcRet );
free( pcRet );
return uRet;
}
// -----------------------------------------------------------------------------------------