Use EXIT_SUCCESS or EXIT_FAILURE for exit() calls for portability.
authorDavid Griffith <dave@661.org>
Thu, 24 Oct 2019 00:04:32 +0000 (17:04 -0700)
committerDavid Griffith <dave@661.org>
Thu, 24 Oct 2019 00:04:32 +0000 (17:04 -0700)
src/curses/ux_audio.c
src/curses/ux_audio_oss.c
src/curses/ux_init.c
src/dos/bcinit.c

index 4982df4a23e5b8d08a6ec29ff696e07788b04449..336d9ff0135562b3712929f3ee74133837c028a1 100644 (file)
@@ -879,7 +879,7 @@ os_init_sound(void)
        err = pthread_create(&unused_id, &attr, &audio_loop, NULL);
        if (err != 0) {
                fprintf(stderr, "Can't create audio thread :[%s]", strerror(err));
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 }
 
index 2e344a482ae994c887c4f528a5ea0b85d12e3325..b65e73a2ddec6249b5f59f79a65da298b023d189 100644 (file)
@@ -78,7 +78,7 @@ static void sigterm_handler(int signal) {
        ioctl(dsp_fd, SNDCTL_DSP_RESET, 0);
        if (mixer_fd >= 0)
                ioctl(mixer_fd, SOUND_MIXER_WRITE_VOLUME, &old_volume);
-       _exit(0);
+       _exit(EXIT_SUCCESS);
 }
 
 static void oss_sigint_handler(int signal) {
@@ -93,7 +93,7 @@ static void play_sound(int volume, int repeats) {
        dsp_fd = open(SOUND_DEV, O_WRONLY);
        if (dsp_fd < 0) {
                perror(SOUND_DEV);
-               _exit(1);
+               _exit(EXIT_FAILURE);
        }
 
 
@@ -103,19 +103,19 @@ static void play_sound(int volume, int repeats) {
         */
        if (ioctl(dsp_fd, SNDCTL_DSP_SETFMT, &format) == -1) {
                perror(SOUND_DEV);
-               exit(1);
+               exit(EXIT_FAILURE);
        }
        if (format != AFMT_U8) {
                fprintf(stderr, "bad sound format\n");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
        if (ioctl(dsp_fd, SNDCTL_DSP_CHANNELS, &channels) == -1) {
                perror(SOUND_DEV);
-               exit(1);
+               exit(EXIT_FAILURE);
        }
        if (channels != 1) {
                fprintf(stderr, "bad channels\n");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
        /* End sound fix from Torbjorn Andersson (no dot thingies) */
 
@@ -165,7 +165,7 @@ finish:
        ioctl(dsp_fd, SNDCTL_DSP_SYNC, 0);
        if (mixer_fd >= 0)
                ioctl(mixer_fd, SOUND_MIXER_WRITE_VOLUME, &old_volume);
-       _exit(0);
+       _exit(EXIT_SUCCESS);
 }
 
 
index 74fa8e9a41d1b183b481d921531ed0acb9871d38..63ef72b88efddf4ba318a08755e49462abd765dc 100644 (file)
@@ -162,7 +162,7 @@ void os_fatal (const char *s, ...)
                } else {
                        os_reset_screen();
                        ux_blorb_stop();
-                       exit(1);
+                       exit(EXIT_FAILURE);
                }
        }
 
@@ -175,7 +175,7 @@ void os_fatal (const char *s, ...)
 
        fputs ("\n\n", stderr);
 
-       exit (1);
+       exit (EXIT_FAILURE);
 } /* os_fatal */
 
 /* extern char script_name[]; */
@@ -208,7 +208,7 @@ void os_process_arguments (int argc, char *argv[])
 #ifndef WIN32
        if ((getuid() == 0) || (geteuid() == 0)) {
                printf("I won't run as root!\n");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 #endif
 
@@ -220,7 +220,7 @@ void os_process_arguments (int argc, char *argv[])
 
        if ((home = getenv(HOMEDIR)) == NULL) {
                printf("Hard drive on fire!\n");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
 
@@ -310,7 +310,7 @@ void os_process_arguments (int argc, char *argv[])
                case 'S': f_setup.script_cols = atoi(zoptarg); break;
                case 't': u_setup.tandy_bit = 1; break;
                case 'u': f_setup.undo_slots = atoi(zoptarg); break;
-               case 'v': print_version(); exit(0); break;
+               case 'v': print_version(); exit(EXIT_SUCCESS); break;
                case 'w': u_setup.screen_width = atoi(zoptarg); break;
                case 'x': f_setup.expand_abbreviations = 1; break;
                case 'Z':
@@ -334,7 +334,7 @@ void os_process_arguments (int argc, char *argv[])
 
                puts (INFORMATION);
                puts (INFO2);
-               exit (0);
+               exit (EXIT_SUCCESS);
        }
 
        /* This section is exceedingly messy and really can't be fixed
@@ -448,7 +448,7 @@ void os_init_screen (void)
 
        if (initscr() == NULL) {    /* Set up curses */
                os_fatal("Unable to initialize curses. Maybe your $TERM setting is bad.");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
        u_setup.curses_active = 1;      /* Let os_fatal know curses is running */
        raw();                          /* Raw input mode, no line processing */
@@ -581,7 +581,7 @@ void os_quit(void)
                refresh();
                endwin();
        }
-       exit(1);
+       exit(EXIT_FAILURE);
 } /* os_quit */
 
 
index e3e07c2e68faceba8f0239a31d8015f6b6df4c4e..60cdab10a4b53c9c5e97d2169f7dc831bdf3a967 100644 (file)
@@ -371,7 +371,7 @@ void os_process_arguments(int argc, char *argv[])
        if (zoptind != argc - 1) {
                printf("FROTZ V%s\tMSDOS / PCDOS Edition\n", VERSION);
                puts(information);
-               exit(EXIT_FAILURE);
+               exit(EXIT_SUCCESS);
        }
 
        /* Set the story file name */