fade.c: replace args_info by conf
[paraslash.git] / sdl_gui.c
index 3cfabbb5c8f2887444858362d029377dbcbcb935..ca3bcc1f2b15cd3921af3b6647b3bdcf3f3337f3 100644 (file)
--- a/sdl_gui.c
+++ b/sdl_gui.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2006 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2003-2007 Andre Noll <maan@systemlinux.org>
  *
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
@@ -739,10 +739,11 @@ static int configfile_exists(void)
  */
 int main(int argc, char *argv[])
 {
-       int i, ret, fd;
+       int i, ret, fd = -1;
        SDLKey sym;
 
        sdl_gui_cmdline_parser(argc, argv, &args_info);
+       HANDLE_VERSION_FLAG("sdl_gui", args_info);
        ret = configfile_exists();
 //     printf("w=%i,h=%i,ret=%i, cf=%s\n", width, height, ret, args_info.config_file_arg);
 
@@ -759,7 +760,6 @@ int main(int argc, char *argv[])
        height = args_info.height_arg;
 //     printf("w=%i,h=%i,ret=%i, cf=%s\n", width, height, ret, args_info.config_file_arg);
        init_stat_items();
-       fd = para_open_audiod_pipe(args_info.stat_cmd_arg);
        init_SDL();
        for (i = 0; fonts[i].name[0]; i++) {
                char buf[MAXLINE];
@@ -775,6 +775,11 @@ int main(int argc, char *argv[])
                update_input();
        }
        for (;;) {
+               if (fd < 0) {
+                       fd = para_open_audiod_pipe(args_info.stat_cmd_arg);
+                       if (fd < 0)
+                               clean_exit(EXIT_FAILURE);
+               }
                ret = draw_status(fd);
                if (ret < 0) {
                        close(fd);
@@ -802,10 +807,6 @@ int main(int argc, char *argv[])
                                || sym == SDLK_COMPOSE
                                )
                                continue;
-                       if (fd < 0) {
-                               kill(0, SIGINT);
-                               close(fd);
-                       }
                        fill_input_rect();
                        update_input();
                        if (!command_handler())
@@ -814,7 +815,6 @@ int main(int argc, char *argv[])
                        print_help();
                        update_pic();
                        SDL_UpdateRect(screen, 0, 0, 0, 0);
-                       fd = para_open_audiod_pipe(args_info.stat_cmd_arg);
                        break;
                }
        }