strlrm() und main() in eine eigene Datei
This commit is contained in:
parent
24b4cc5baa
commit
baf6349ff1
18
Makefile
18
Makefile
|
@ -251,10 +251,11 @@ SERVER_OBJS = \
|
||||||
|
|
||||||
# POSIX platform objects
|
# POSIX platform objects
|
||||||
POSIX_OBJS = \
|
POSIX_OBJS = \
|
||||||
|
build/unix/glob.o \
|
||||||
build/unix/network.o \
|
build/unix/network.o \
|
||||||
build/unix/hunk.o \
|
build/unix/hunk.o \
|
||||||
|
build/unix/misc.o \
|
||||||
build/unix/system.o \
|
build/unix/system.o \
|
||||||
build/unix/glob.o \
|
|
||||||
build/unix/vid/menu.o \
|
build/unix/vid/menu.o \
|
||||||
build/unix/vid/refresh.o
|
build/unix/vid/refresh.o
|
||||||
|
|
||||||
|
@ -311,6 +312,7 @@ DEDICATED_SERVER_COMMON_OBJS = \
|
||||||
# Dedicated server POSIX platform objects
|
# Dedicated server POSIX platform objects
|
||||||
DEDICATED_SERVER_POSIX_OBJS = \
|
DEDICATED_SERVER_POSIX_OBJS = \
|
||||||
build/dedicated_server_unix/glob.o \
|
build/dedicated_server_unix/glob.o \
|
||||||
|
build/dedicated_server_unix/misc.o \
|
||||||
build/dedicated_server_unix/network.o \
|
build/dedicated_server_unix/network.o \
|
||||||
build/dedicated_server_unix/hunk.o \
|
build/dedicated_server_unix/hunk.o \
|
||||||
build/dedicated_server_unix/system.o
|
build/dedicated_server_unix/system.o
|
||||||
|
@ -342,8 +344,9 @@ OPENGL_POSIX_OBJS = \
|
||||||
build/ref_gl_unix/input.o \
|
build/ref_gl_unix/input.o \
|
||||||
build/ref_gl_unix/glob.o \
|
build/ref_gl_unix/glob.o \
|
||||||
build/ref_gl_unix/hunk.o \
|
build/ref_gl_unix/hunk.o \
|
||||||
|
build/ref_gl_unix/misc.o \
|
||||||
build/ref_gl_unix/qgl.o \
|
build/ref_gl_unix/qgl.o \
|
||||||
build/ref_gl_unix/refresh.o
|
build/ref_gl_unix/refresh.o
|
||||||
|
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
|
@ -621,6 +624,9 @@ build/unix/network.o : src/unix/network.c
|
||||||
build/unix/hunk.o : src/unix/hunk.c
|
build/unix/hunk.o : src/unix/hunk.c
|
||||||
$(CC) $(CFLAGS_CLIENT) -o $@ -c $<
|
$(CC) $(CFLAGS_CLIENT) -o $@ -c $<
|
||||||
|
|
||||||
|
build/unix/misc.o : src/unix/misc.c
|
||||||
|
$(CC) $(CFLAGS_CLIENT) -o $@ -c $<
|
||||||
|
|
||||||
build/unix/system.o : src/unix/system.c
|
build/unix/system.o : src/unix/system.c
|
||||||
$(CC) $(CFLAGS_CLIENT) -o $@ -c $<
|
$(CC) $(CFLAGS_CLIENT) -o $@ -c $<
|
||||||
|
|
||||||
|
@ -745,6 +751,9 @@ build/dedicated_server_common/unzip/unzip.o : src/common/unzip/unzip.c
|
||||||
build/dedicated_server_unix/glob.o : src/unix/glob.c
|
build/dedicated_server_unix/glob.o : src/unix/glob.c
|
||||||
$(CC) $(CFLAGS_DEDICATED_SERVER) -o $@ -c $<
|
$(CC) $(CFLAGS_DEDICATED_SERVER) -o $@ -c $<
|
||||||
|
|
||||||
|
build/dedicated_server_unix/misc.o : src/unix/misc.c
|
||||||
|
$(CC) $(CFLAGS_DEDICATED_SERVER) -o $@ -c $<
|
||||||
|
|
||||||
build/dedicated_server_unix/network.o : src/unix/network.c
|
build/dedicated_server_unix/network.o : src/unix/network.c
|
||||||
$(CC) $(CFLAGS_DEDICATED_SERVER) -o $@ -c $<
|
$(CC) $(CFLAGS_DEDICATED_SERVER) -o $@ -c $<
|
||||||
|
|
||||||
|
@ -800,7 +809,10 @@ build/ref_gl_unix/glob.o: src/unix/glob.c
|
||||||
|
|
||||||
build/ref_gl_unix/hunk.o: src/unix/hunk.c
|
build/ref_gl_unix/hunk.o: src/unix/hunk.c
|
||||||
$(CC) $(CFLAGS_OPENGL) -o $@ -c $<
|
$(CC) $(CFLAGS_OPENGL) -o $@ -c $<
|
||||||
|
|
||||||
|
build/ref_gl_unix/misc.o: src/unix/misc.c
|
||||||
|
$(CC) $(CFLAGS_OPENGL) -o $@ -c $<
|
||||||
|
|
||||||
build/ref_gl_unix/qgl.o: src/unix/qgl/qgl.c
|
build/ref_gl_unix/qgl.o: src/unix/qgl/qgl.c
|
||||||
$(CC) $(CFLAGS_OPENGL) -o $@ -c $<
|
$(CC) $(CFLAGS_OPENGL) -o $@ -c $<
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ static cvar_t *m_yaw;
|
||||||
static cvar_t *m_pitch;
|
static cvar_t *m_pitch;
|
||||||
static cvar_t *m_forward;
|
static cvar_t *m_forward;
|
||||||
static cvar_t *freelook;
|
static cvar_t *freelook;
|
||||||
static cvar_t *m_filter;
|
static cvar_t *m_filter;
|
||||||
static cvar_t *in_mouse;
|
static cvar_t *in_mouse;
|
||||||
|
|
||||||
static int mouse_x, mouse_y;
|
static int mouse_x, mouse_y;
|
||||||
static int old_mouse_x, old_mouse_y;
|
static int old_mouse_x, old_mouse_y;
|
||||||
|
|
|
@ -58,9 +58,40 @@ static char findpath [ MAX_OSPATH ];
|
||||||
static char findpattern [ MAX_OSPATH ];
|
static char findpattern [ MAX_OSPATH ];
|
||||||
static DIR *fdir;
|
static DIR *fdir;
|
||||||
|
|
||||||
cvar_t *nostdout;
|
|
||||||
uid_t saved_euid;
|
|
||||||
qboolean stdin_active = true;
|
qboolean stdin_active = true;
|
||||||
|
extern cvar_t *nostdout;
|
||||||
|
|
||||||
|
static qboolean
|
||||||
|
CompareAttributes ( char *path, char *name, unsigned musthave, unsigned canthave )
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
char fn [ MAX_OSPATH ];
|
||||||
|
|
||||||
|
/* . and .. never match */
|
||||||
|
if ( ( strcmp( name, "." ) == 0 ) || ( strcmp( name, ".." ) == 0 ) )
|
||||||
|
{
|
||||||
|
return ( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( true );
|
||||||
|
|
||||||
|
if ( stat( fn, &st ) == -1 )
|
||||||
|
{
|
||||||
|
return ( false ); /* shouldn't happen */
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ( st.st_mode & S_IFDIR ) && ( canthave & SFF_SUBDIR ) )
|
||||||
|
{
|
||||||
|
return ( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ( musthave & SFF_SUBDIR ) && !( st.st_mode & S_IFDIR ) )
|
||||||
|
{
|
||||||
|
return ( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( true );
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Sys_Milliseconds ( void )
|
Sys_Milliseconds ( void )
|
||||||
|
@ -107,52 +138,6 @@ Sys_GetCurrentDirectory ( void )
|
||||||
return ( dir );
|
return ( dir );
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
|
||||||
strlwr ( char *s )
|
|
||||||
{
|
|
||||||
char *p = s;
|
|
||||||
|
|
||||||
while ( *s )
|
|
||||||
{
|
|
||||||
*s = tolower( *s );
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ( p );
|
|
||||||
}
|
|
||||||
|
|
||||||
static qboolean
|
|
||||||
CompareAttributes ( char *path, char *name, unsigned musthave, unsigned canthave )
|
|
||||||
{
|
|
||||||
struct stat st;
|
|
||||||
char fn [ MAX_OSPATH ];
|
|
||||||
|
|
||||||
/* . and .. never match */
|
|
||||||
if ( ( strcmp( name, "." ) == 0 ) || ( strcmp( name, ".." ) == 0 ) )
|
|
||||||
{
|
|
||||||
return ( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
return ( true );
|
|
||||||
|
|
||||||
if ( stat( fn, &st ) == -1 )
|
|
||||||
{
|
|
||||||
return ( false ); /* shouldn't happen */
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ( st.st_mode & S_IFDIR ) && ( canthave & SFF_SUBDIR ) )
|
|
||||||
{
|
|
||||||
return ( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ( musthave & SFF_SUBDIR ) && !( st.st_mode & S_IFDIR ) )
|
|
||||||
{
|
|
||||||
return ( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
return ( true );
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
Sys_FindFirst ( char *path, unsigned musthave, unsigned canhave )
|
Sys_FindFirst ( char *path, unsigned musthave, unsigned canhave )
|
||||||
{
|
{
|
||||||
|
@ -507,43 +492,3 @@ Sys_SendKeyEvents ( void )
|
||||||
sys_frame_time = Sys_Milliseconds();
|
sys_frame_time = Sys_Milliseconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
main ( int argc, char **argv )
|
|
||||||
{
|
|
||||||
int time, oldtime, newtime;
|
|
||||||
|
|
||||||
/* go back to real user for config loads */
|
|
||||||
saved_euid = geteuid();
|
|
||||||
seteuid( getuid() );
|
|
||||||
|
|
||||||
printf( "Quake 2\n" );
|
|
||||||
|
|
||||||
Qcommon_Init( argc, argv );
|
|
||||||
|
|
||||||
fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) | FNDELAY );
|
|
||||||
|
|
||||||
nostdout = Cvar_Get( "nostdout", "0", 0 );
|
|
||||||
|
|
||||||
if ( !nostdout->value )
|
|
||||||
{
|
|
||||||
fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) | FNDELAY );
|
|
||||||
}
|
|
||||||
|
|
||||||
oldtime = Sys_Milliseconds();
|
|
||||||
|
|
||||||
/* The legendary Quake II mainloop */
|
|
||||||
while ( 1 )
|
|
||||||
{
|
|
||||||
/* find time spent rendering last frame */
|
|
||||||
do
|
|
||||||
{
|
|
||||||
newtime = Sys_Milliseconds();
|
|
||||||
time = newtime - oldtime;
|
|
||||||
}
|
|
||||||
while ( time < 1 );
|
|
||||||
|
|
||||||
Qcommon_Frame( time );
|
|
||||||
oldtime = newtime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -305,10 +305,8 @@ VID_LoadRefresh ( char *name )
|
||||||
|
|
||||||
if ( ( ( RW_IN_Init_fp = dlsym( reflib_library, "RW_IN_Init" ) ) == NULL ) ||
|
if ( ( ( RW_IN_Init_fp = dlsym( reflib_library, "RW_IN_Init" ) ) == NULL ) ||
|
||||||
( ( RW_IN_Shutdown_fp = dlsym( reflib_library, "RW_IN_Shutdown" ) ) == NULL ) ||
|
( ( RW_IN_Shutdown_fp = dlsym( reflib_library, "RW_IN_Shutdown" ) ) == NULL ) ||
|
||||||
( ( RW_IN_Activate_fp = dlsym( reflib_library, "RW_IN_Activate" ) ) == NULL ) ||
|
|
||||||
( ( RW_IN_Commands_fp = dlsym( reflib_library, "RW_IN_Commands" ) ) == NULL ) ||
|
( ( RW_IN_Commands_fp = dlsym( reflib_library, "RW_IN_Commands" ) ) == NULL ) ||
|
||||||
( ( RW_IN_Move_fp = dlsym( reflib_library, "RW_IN_Move" ) ) == NULL ) ||
|
( ( RW_IN_Move_fp = dlsym( reflib_library, "RW_IN_Move" ) ) == NULL ) )
|
||||||
( ( RW_IN_Frame_fp = dlsym( reflib_library, "RW_IN_Frame" ) ) == NULL ) )
|
|
||||||
{
|
{
|
||||||
Sys_Error( "No RW_IN functions in REF.\n" );
|
Sys_Error( "No RW_IN functions in REF.\n" );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue