]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
audited all Sys_Quit calls and gave them return values indicating
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 24 Apr 2007 06:56:37 +0000 (06:56 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 24 Apr 2007 06:56:37 +0000 (06:56 +0000)
whether the game quit normally, so shell scripts get a useful value

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7165 d7cf8633-e32d-0410-b094-e92efae38249

host_cmd.c
sys.h
sys_shared.c
vid_agl.c
vid_glx.c
vid_null.c
vid_sdl.c
vid_wgl.c

index 2ea15b8155c6bc6e08a9002592b60d0c2d174f2a..a740a416c329ab36d6995d6ab2efb77b7299121f 100644 (file)
@@ -38,7 +38,7 @@ Host_Quit_f
 
 void Host_Quit_f (void)
 {
 
 void Host_Quit_f (void)
 {
-       Sys_Quit ();
+       Sys_Quit (0);
 }
 
 
 }
 
 
diff --git a/sys.h b/sys.h
index 41deb0170ee6934b7009c5d89e44c0524ce56f35..42838e319f9b658e4bba3ae6840303e799e34031 100644 (file)
--- a/sys.h
+++ b/sys.h
@@ -68,7 +68,7 @@ void Sys_PrintToTerminal(const char *text);
 // (may) output text to terminal which launched program
 
 void Sys_Shutdown (void); //INFO: This is only called by Host_Shutdown so we dont need testing for recursion
 // (may) output text to terminal which launched program
 
 void Sys_Shutdown (void); //INFO: This is only called by Host_Shutdown so we dont need testing for recursion
-void Sys_Quit (void);
+void Sys_Quit (int returnvalue);
 
 double Sys_DoubleTime (void);
 
 
 double Sys_DoubleTime (void);
 
index 9abc08d4926dcca45503509a1f8317637e04aca2..f636ff310285ba8a06405f31e96b9f58ba3b271b 100644 (file)
@@ -17,11 +17,11 @@ char *Sys_TimeString(const char *timeformat)
 
 
 extern qboolean host_shuttingdown;
 
 
 extern qboolean host_shuttingdown;
-void Sys_Quit (void)
+void Sys_Quit (int returnvalue)
 {
        host_shuttingdown = true;
        Host_Shutdown();
 {
        host_shuttingdown = true;
        Host_Shutdown();
-       exit(0);
+       exit(returnvalue);
 }
 
 /*
 }
 
 /*
index cc1bb0c6e2d9dbdb5a9a7a53ee66a5bde81a0e95..4ecbd2ee4b0a1ee74ead33481d4322b01847cb58 100644 (file)
--- a/vid_agl.c
+++ b/vid_agl.c
@@ -254,8 +254,7 @@ void signal_handler(int sig)
 {
        printf("Received signal %d, exiting...\n", sig);
        VID_RestoreSystemGamma();
 {
        printf("Received signal %d, exiting...\n", sig);
        VID_RestoreSystemGamma();
-       Sys_Quit();
-       exit(0);
+       Sys_Quit(1);
 }
 
 void InitSig(void)
 }
 
 void InitSig(void)
@@ -422,7 +421,7 @@ static void VID_ProcessPendingAsyncEvents (void)
 
        // Closed
        if (AsyncEvent_Quitting)
 
        // Closed
        if (AsyncEvent_Quitting)
-               Sys_Quit();
+               Sys_Quit(0);
 }
 
 static void VID_BuildAGLAttrib(GLint *attrib, qboolean stencil, qboolean fullscreen, qboolean stereobuffer)
 }
 
 static void VID_BuildAGLAttrib(GLint *attrib, qboolean stencil, qboolean fullscreen, qboolean stereobuffer)
@@ -980,7 +979,7 @@ void Sys_SendKeyEvents(void)
                                                VID_AppFocusChanged(false);
                                                break;
                                        case kEventAppQuit:
                                                VID_AppFocusChanged(false);
                                                break;
                                        case kEventAppQuit:
-                                               Sys_Quit();
+                                               Sys_Quit(0);
                                                break;
                                        case kEventAppActiveWindowChanged:
                                                break;
                                                break;
                                        case kEventAppActiveWindowChanged:
                                                break;
index 5f92ed1ac191e9bc79d262f7af534a2d67e5fdd8..291f5d5a10cdddeb5a4b414f3b9d936b56b5a850 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -425,12 +425,12 @@ static void HandleEvents(void)
                        break;
                case DestroyNotify:
                        // window has been destroyed
                        break;
                case DestroyNotify:
                        // window has been destroyed
-                       Sys_Quit();
+                       Sys_Quit(0);
                        break;
                case ClientMessage:
                        // window manager messages
                        if ((event.xclient.format == 32) && ((unsigned int)event.xclient.data.l[0] == wm_delete_window_atom))
                        break;
                case ClientMessage:
                        // window manager messages
                        if ((event.xclient.format == 32) && ((unsigned int)event.xclient.data.l[0] == wm_delete_window_atom))
-                               Sys_Quit();
+                               Sys_Quit(0);
                        break;
                case MapNotify:
                        // window restored
                        break;
                case MapNotify:
                        // window restored
@@ -537,8 +537,7 @@ void signal_handler(int sig)
 {
        Con_Printf("Received signal %d, exiting...\n", sig);
        VID_RestoreSystemGamma();
 {
        Con_Printf("Received signal %d, exiting...\n", sig);
        VID_RestoreSystemGamma();
-       Sys_Quit();
-       exit(0);
+       Sys_Quit(1);
 }
 
 void InitSig(void)
 }
 
 void InitSig(void)
index e70e745704632641dd016fd0559226db1bdebb82..28f92f8cb46bef2fec55c6914db1fc30ca4748c5 100644 (file)
@@ -31,8 +31,7 @@ void VID_Shutdown(void)
 void signal_handler(int sig)
 {
        Con_Printf("Received signal %d, exiting...\n", sig);
 void signal_handler(int sig)
 {
        Con_Printf("Received signal %d, exiting...\n", sig);
-       Sys_Quit();
-       exit(0);
+       Sys_Quit(1);
 }
 
 void InitSig(void)
 }
 
 void InitSig(void)
index af30f9cb7059451baeba06a3eff2be2edc98178e..7ac1e4ec8e367ead582b82a1dcc8c11db14a5c00 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -341,7 +341,7 @@ void Sys_SendKeyEvents( void )
        while( SDL_PollEvent( &event ) )
                switch( event.type ) {
                        case SDL_QUIT:
        while( SDL_PollEvent( &event ) )
                switch( event.type ) {
                        case SDL_QUIT:
-                               Sys_Quit();
+                               Sys_Quit(0);
                                break;
                        case SDL_KEYDOWN:
                        case SDL_KEYUP:
                                break;
                        case SDL_KEYDOWN:
                        case SDL_KEYUP:
index 104f283793c3ed2da89e4eeb2a5b300721964e81..79505efd6d429ef06420c41744cb62560ad4704d 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -465,7 +465,7 @@ void Sys_SendKeyEvents (void)
        while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
        {
                if (!GetMessage (&msg, NULL, 0, 0))
        while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
        {
                if (!GetMessage (&msg, NULL, 0, 0))
-                       Sys_Quit ();
+                       Sys_Quit (1);
 
                TranslateMessage (&msg);
                DispatchMessage (&msg);
 
                TranslateMessage (&msg);
                DispatchMessage (&msg);
@@ -618,7 +618,7 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM  wParam, LPARAM lParam)
 
                case WM_CLOSE:
                        if (MessageBox (mainwindow, "Are you sure you want to quit?", "Confirm Exit", MB_YESNO | MB_SETFOREGROUND | MB_ICONQUESTION) == IDYES)
 
                case WM_CLOSE:
                        if (MessageBox (mainwindow, "Are you sure you want to quit?", "Confirm Exit", MB_YESNO | MB_SETFOREGROUND | MB_ICONQUESTION) == IDYES)
-                               Sys_Quit ();
+                               Sys_Quit (0);
 
                        break;
 
 
                        break;