maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exit
authorJim Meyering <meyering@redhat.com>
Sat, 7 Nov 2009 15:47:37 +0000 (16:47 +0100)
committerJim Meyering <meyering@redhat.com>
Sat, 7 Nov 2009 15:53:00 +0000 (16:53 +0100)
Convert all uses automatically, via these two commands:
git grep -l '\<exit *(1)'|xargs --no-run-if-empty \
  perl -pi -e 's/\b(exit ?)\(1\)/$1(EXIT_FAILURE)/'
git grep -l '\<exit *(0)'|xargs --no-run-if-empty \
  perl -pi -e 's/\b(exit ?)\(0\)/$1(EXIT_SUCCESS)/'
* libparted/fs/fat/table.c (fat_table_get): Use symbolic exit codes.
* libparted/labels/vtoc.c (vtoc_update_format5_label_add): Likewise.
(vtoc_update_format5_label_del): Likewise.
(vtoc_update_format7_label_add): Likewise.
(vtoc_update_format7_label_del): Likewise.
* m4/parted.m4 (PARTED_CHECK_LIBPARTED): Likewise.
* parted/parted.c (do_quit): Likewise.
* parted/strlist.c (gettext_to_wchar, wchar_to_str): Likewise.
* parted/ui.c (reset_env, help_msg, non_interactive_mode): Likewise.

libparted/fs/fat/table.c
libparted/labels/vtoc.c
m4/parted.m4
parted/parted.c
parted/strlist.c
parted/ui.c

index 6ef208d..284250e 100644 (file)
@@ -300,7 +300,7 @@ fat_table_get (const FatTable* ft, FatCluster cluster)
                                     _("fat_table_get: cluster %ld outside "
                                       "file system"),
                                     (long) cluster);
-               exit (1);       /* FIXME */
+               exit (EXIT_FAILURE);    /* FIXME */
        }
 
        switch (ft->fat_type) {
index bdcb9f4..35b26e1 100644 (file)
@@ -732,7 +732,7 @@ vtoc_update_format5_label_add (format5_label_t *f5, int verbose, int cyl,
                {
                        puts ("BUG: overlapping free space extents "
                              "in FMT5 DSCB!\nexiting...");
-                       exit(1);
+                       exit(EXIT_FAILURE);
                }
 
                if ((ext->t + ext->fc + ext->ft) == 0x0000) {
@@ -749,7 +749,7 @@ vtoc_update_format5_label_add (format5_label_t *f5, int verbose, int cyl,
        if (tmp == NULL) {
                /* BUG: no free extent found */
                puts ("BUG: no free FMT5 DSCB extent found!\nexiting...");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        for (i=0; i<26; i++) {
@@ -895,7 +895,7 @@ vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl,
                        puts ("BUG: corresponding free space extent "
                              "doesn't match free space currently shown "
                              "in FMT5 DSCB!\nexiting...");
-                       exit(1);
+                       exit(EXIT_FAILURE);
                }
 
                if ((a > ext->t) && (a < ext->t + ext->fc*trk + ext->ft)
@@ -905,7 +905,7 @@ vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl,
                              "deleting doesn't match free space "
                              "currently shown in FMT5 DSCB!\n"
                              "exiting...");
-                       exit(1);
+                       exit(EXIT_FAILURE);
                }
        }
 
@@ -915,7 +915,7 @@ vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl,
        puts ("BUG: specified free space extent for "
              "deleting not found in FMT5 DSCB!\n"
              "exiting...");
-       exit(1);
+       exit(EXIT_FAILURE);
 }
 
 /*
@@ -976,7 +976,7 @@ vtoc_update_format7_label_add (format7_label_t *f7, int verbose,
                {
                        puts ("BUG: overlapping free space extents "
                              "in FMT7 DSCB!\nexiting...");
-                       exit(1);
+                       exit(EXIT_FAILURE);
                }
 
                if ((ext->a + ext->b) == 0x00000000) {
@@ -994,7 +994,7 @@ vtoc_update_format7_label_add (format7_label_t *f7, int verbose,
        if (tmp == NULL) {
                /* BUG: no free extent found */
                puts ("BUG: no free FMT7 DSCB extent found!\nexiting...");
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        for (i=0; i<16; i++) {
@@ -1102,7 +1102,7 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose,
                               "doesn't match free space currently shown in "
                               "FMT7 DSCB!\nexiting...");
                        printf ("%d %d %d %d\n", a, b, ext->a, ext->b);
-                       exit(1);
+                       exit(EXIT_FAILURE);
                }
        }
 
@@ -1112,7 +1112,7 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose,
        puts ("BUG: specified free space extent for "
              "deleting not found in FMT7 DSCB!\n"
              "exiting...");
-       exit(1);
+       exit(EXIT_FAILURE);
 }
 
 void
index 3f6e2e3..0dc7a7e 100644 (file)
@@ -73,10 +73,10 @@ int main ()
        const char      *version;
 
        if ( !(version = ped_get_version ()) )
-               exit(1);
+               exit(EXIT_FAILURE);
        if (sscanf(version, "%d.%d.%d", &major, &minor, &micro) != 3) {
                printf("%s, bad version string\n", version);
-               exit(1);
+               exit(EXIT_FAILURE);
        }
 
        if ((major > $parted_config_major_version) ||
index bc55bc9..d9c4333 100644 (file)
@@ -1616,7 +1616,7 @@ static int
 do_quit (PedDevice** dev)
 {
         _done (*dev);
-        exit (0);
+        exit (EXIT_SUCCESS);
 }
 
 static PedPartitionType
index 4d173a9..5a9053a 100644 (file)
@@ -128,7 +128,7 @@ gettext_to_wchar (const char* str)
 
 error:
        printf ("Error during translation: %s\n", strerror (errno));
-       exit (1);
+       exit (EXIT_FAILURE);
 }
 
 #else /* ENABLE_NLS */
@@ -177,7 +177,7 @@ wchar_to_str (const wchar_t* str, size_t count)
 
 error:
        printf ("Error during translation: %s\n", strerror (errno));
-       exit (1);
+       exit (EXIT_FAILURE);
 }
 
 #else /* ENABLE_NLS */
index c63df8a..58fb80c 100644 (file)
@@ -314,7 +314,7 @@ reset_env (int quit)
         if (in_readline) {
                 putchar ('\n');
                 if (quit)
-                        exit (0);
+                        exit (EXIT_SUCCESS);
 
                 siglongjmp (readline_state.jmp_state, 1);
         }
@@ -1471,7 +1471,7 @@ help_msg ()
         fputs (_("COMMANDs:"), stdout);
         putchar ('\n');
         print_commands_help ();
-        exit (0);
+        exit (EXIT_SUCCESS);
 }
 
 void
@@ -1553,7 +1553,7 @@ non_interactive_mode (PedDevice** dev, Command* cmd_list[],
                 if (!(cmd->non_interactive)) {
                         fputs(_("This command does not make sense in "
                                 "non-interactive mode.\n"), stdout);
-                        exit(1);
+                        exit(EXIT_FAILURE);
                         goto error;
                 }