changeset 55442:a47704955f8d

Throughout, replace 0 destined for `exit' arg with `EXIT_SUCCESS'. Likewise, replace 1 with `EXIT_FAILURE'. (main): Use `EXIT_SUCCESS' or `EXIT_FAILURE' for return value.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Sat, 08 May 2004 15:23:35 +0000
parents 406c79b8022c
children 720187bbd9d1
files lib-src/cvtmail.c lib-src/ebrowse.c lib-src/emacsclient.c lib-src/fakemail.c lib-src/hexl.c lib-src/make-docfile.c lib-src/movemail.c lib-src/profile.c lib-src/sorted-doc.c lib-src/test-distrib.c lib-src/update-game-score.c lib-src/yow.c
diffstat 12 files changed, 86 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/cvtmail.c	Sat May 08 15:00:20 2004 +0000
+++ b/lib-src/cvtmail.c	Sat May 08 15:23:35 2004 +0000
@@ -119,7 +119,7 @@
     }
   fclose (mddf);
   fclose (mfilef);
-  return 0;
+  return EXIT_SUCCESS;
 }
 
 void
@@ -148,7 +148,7 @@
      char *s1, *s2;
 {
   error (s1, s2);
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 void
@@ -157,7 +157,7 @@
 {
   fprintf (stderr, "cvtmail: ");
   perror (s);
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 char *
@@ -183,3 +183,5 @@
 
 /* arch-tag: b93c25a9-9012-44f1-b78b-9cc7aed44a7a
    (do not change this comment) */
+
+/* cvtmail.c ends here */
--- a/lib-src/ebrowse.c	Sat May 08 15:00:20 2004 +0000
+++ b/lib-src/ebrowse.c	Sat May 08 15:23:35 2004 +0000
@@ -564,7 +564,7 @@
   if (p == NULL)
     {
       yyerror ("out of memory", NULL);
-      exit (1);
+      exit (EXIT_FAILURE);
     }
   return p;
 }
@@ -581,7 +581,7 @@
   if (p == NULL)
     {
       yyerror ("out of memory", NULL);
-      exit (1);
+      exit (EXIT_FAILURE);
     }
   return p;
 }
@@ -3671,7 +3671,7 @@
      int error;
 {
   puts (USAGE);
-  exit (error ? 1 : 0);
+  exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
 
@@ -3688,7 +3688,7 @@
   printf ("ebrowse %s\n", VERSION);
   puts ("Copyright (C) 1992-1999, 2000, 2001 Free Software Foundation, Inc.");
   puts ("This program is distributed under the same terms as Emacs.");
-  exit (0);
+  exit (EXIT_SUCCESS);
 }
 
 
@@ -3925,7 +3925,7 @@
       if (yyout == NULL)
 	{
 	  yyerror ("cannot open output file `%s'", out_filename);
-	  exit (1);
+	  exit (EXIT_FAILURE);
 	}
     }
 
@@ -3970,11 +3970,10 @@
   if (yyout != stdout)
     fclose (yyout);
 
-  return 0;
+  return EXIT_SUCCESS;
 }
 
-
-/* ebrowse.c ends here.  */
-
 /* arch-tag: fc03b4bc-91a9-4c3d-b3b9-12a77fa86dd8
    (do not change this comment) */
+
+/* ebrowse.c ends here */
--- a/lib-src/emacsclient.c	Sat May 08 15:00:20 2004 +0000
+++ b/lib-src/emacsclient.c	Sat May 08 15:23:35 2004 +0000
@@ -44,9 +44,6 @@
 char *getenv (), *getwd ();
 char *getcwd ();
 
-/* This is defined with -D from the compilation command,
-   which extracts it from ../lisp/version.el.  */
-
 #ifndef VERSION
 #define VERSION "unspecified"
 #endif
@@ -131,7 +128,7 @@
 
 	case 'V':
 	  printf ("emacsclient %s\n", VERSION);
-	  exit (0);
+	  exit (EXIT_SUCCESS);
 	  break;
 
 	case 'H':
@@ -140,7 +137,7 @@
 
 	default:
 	  fprintf (stderr, "Try `%s --help' for more information\n", progname);
-	  exit (1);
+	  exit (EXIT_FAILURE);
 	  break;
 	}
     }
@@ -166,7 +163,7 @@
                         Editor to fallback to if the server is not running\n\
 \n\
 Report bugs to bug-gnu-emacs@gnu.org.\n", progname);
-  exit (0);
+  exit (EXIT_SUCCESS);
 }
 
 /* In NAME, insert a & before each &, each space, each newline, and
@@ -221,7 +218,7 @@
   if (result == NULL)
   {
     perror ("malloc");
-    exit (1);
+    exit (EXIT_FAILURE);
   }
   return result;
 }
@@ -243,7 +240,7 @@
     }
   else
     {
-      exit (1);
+      exit (EXIT_FAILURE);
     }
 }
 
@@ -314,7 +311,7 @@
     {
       fprintf (stderr, "%s: file name or argument required\n", progname);
       fprintf (stderr, "Try `%s --help' for more information\n", progname);
-      exit (1);
+      exit (EXIT_FAILURE);
     }
 
   /*
@@ -356,7 +353,7 @@
       {
 	fprintf (stderr, "%s: socket-name %s too long",
 		 argv[0], socket_name);
-	exit (1);
+	exit (EXIT_FAILURE);
       }
 
     /* See if the socket exists, and if it's owned by us. */
@@ -391,7 +388,7 @@
 		  {
 		    fprintf (stderr, "%s: socket-name %s too long",
 			     argv[0], socket_name);
-		    exit (1);
+		    exit (EXIT_FAILURE);
 		  }
 
 		sock_status = socket_status (server.sun_path);
@@ -522,13 +519,13 @@
 	}
       fprintf (out, " ");
     }
-  
+
   fprintf (out, "\n");
   fflush (out);
 
   /* Maybe wait for an answer.   */
   if (nowait)
-    return 0;
+    return EXIT_SUCCESS;
 
   if (!eval)
     {
@@ -550,7 +547,7 @@
     printf ("\n");
   fflush (stdout);
 
-  return 0;
+  return EXIT_SUCCESS;
 }
 
 #endif /* HAVE_SOCKETS */
@@ -572,3 +569,5 @@
 
 /* arch-tag: f39bb9c4-73eb-477e-896d-50832e2ca9a7
    (do not change this comment) */
+
+/* emacsclient.c ends here */
--- a/lib-src/fakemail.c	Sat May 08 15:00:20 2004 +0000
+++ b/lib-src/fakemail.c	Sat May 08 15:23:35 2004 +0000
@@ -169,7 +169,7 @@
      char *s1, *s2;
 {
   error (s1, s2);
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 /* Like malloc but get fatal error if memory is exhausted.  */
@@ -410,7 +410,7 @@
     no_problems = (no_problems &&
 		   ((*rem->action) (rem->handle) == 0));
   the_streams = ((stream_list) NULL);
-  return (no_problems ? 0 : 1);
+  return (no_problems ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
 void
@@ -667,7 +667,7 @@
       if (next_line == ((line_list *) NULL))
 	{
 	  /* Not a valid header */
-	  exit (1);
+	  exit (EXIT_FAILURE);
 	}
       *next_line = new_list ();
       (*next_line)->string = alloc_string (length);
@@ -753,3 +753,5 @@
 
 /* arch-tag: acb0afa6-315a-4c5b-b9e3-def5725c8783
    (do not change this comment) */
+
+/* fakemail.c ends here */
--- a/lib-src/hexl.c	Sat May 08 15:00:20 2004 +0000
+++ b/lib-src/hexl.c	Sat May 08 15:23:35 2004 +0000
@@ -270,15 +270,17 @@
 	fclose (fp);
 
     } while (*argv != NULL);
-  return 0;
+  return EXIT_SUCCESS;
 }
 
 void
 usage ()
 {
   fprintf (stderr, "usage: %s [-de] [-iso]\n", progname);
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 /* arch-tag: 20e04fb7-926e-4e48-be86-64fe869ecdaa
    (do not change this comment) */
+
+/* hexl.c ends here */
--- a/lib-src/make-docfile.c	Sat May 08 15:00:20 2004 +0000
+++ b/lib-src/make-docfile.c	Sat May 08 15:23:35 2004 +0000
@@ -104,7 +104,7 @@
      char *s1, *s2;
 {
   error (s1, s2);
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 /* Like malloc but get fatal error if memory is exhausted.  */
@@ -1210,3 +1210,5 @@
 
 /* arch-tag: f7203aaf-991a-4238-acb5-601db56f2894
    (do not change this comment) */
+
+/* make-docfile.c ends here */
--- a/lib-src/movemail.c	Sat May 08 15:00:20 2004 +0000
+++ b/lib-src/movemail.c	Sat May 08 15:23:35 2004 +0000
@@ -216,7 +216,7 @@
 	preserve_mail++;
 	break;
       default:
-	exit(1);
+	exit (EXIT_FAILURE);
       }
     }
 
@@ -234,7 +234,7 @@
 #else
       fprintf (stderr, "Usage: movemail [-p] inbox destfile%s\n", "");
 #endif
-      exit (1);
+      exit (EXIT_FAILURE);
     }
 
   inname = argv[optind];
@@ -536,12 +536,12 @@
       if (spool_name)
 	mailunlock ();
 #endif
-      exit (0);
+      exit (EXIT_SUCCESS);
     }
 
   wait (&status);
   if (!WIFEXITED (status))
-    exit (1);
+    exit (EXIT_FAILURE);
   else if (WRETCODE (status) != 0)
     exit (WRETCODE (status));
 
@@ -554,7 +554,7 @@
 
 #endif /* ! DISABLE_DIRECT_ACCESS */
 
-  return 0;
+  return EXIT_SUCCESS;
 }
 
 #ifdef MAIL_USE_MAILLOCK
@@ -607,7 +607,7 @@
   if (delete_lockname)
     unlink (delete_lockname);
   error (s1, s2, 0);
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 /* Print error message.  `s1' is printf control string, `s2' and `s3'
@@ -709,6 +709,8 @@
  * If the mailbox is in the form "po:username:hostname", then it is
  * modified by this function -- the second colon is replaced by a
  * null.
+ *
+ * Return a value suitable for passing to `exit'.
  */
 
 int
@@ -736,19 +738,19 @@
   if (! server)
     {
       error ("Error connecting to POP server: %s", pop_error, 0);
-      return (1);
+      return EXIT_FAILURE;
     }
 
   if (pop_stat (server, &nmsgs, &nbytes))
     {
       error ("Error getting message count from POP server: %s", pop_error, 0);
-      return (1);
+      return EXIT_FAILURE;
     }
 
   if (!nmsgs)
     {
       pop_close (server);
-      return (0);
+      return EXIT_SUCCESS;
     }
 
   mbfi = open (outfile, O_WRONLY | O_CREAT | O_EXCL, 0666);
@@ -756,7 +758,7 @@
     {
       pop_close (server);
       error ("Error in open: %s, %s", strerror (errno), outfile);
-      return (1);
+      return EXIT_FAILURE;
     }
   fchown (mbfi, getuid (), -1);
 
@@ -766,7 +768,7 @@
       error ("Error in fdopen: %s", strerror (errno), 0);
       close (mbfi);
       unlink (outfile);
-      return (1);
+      return EXIT_FAILURE;
     }
 
   if (reverse_order)
@@ -789,7 +791,7 @@
 	{
 	  error (Errmsg, 0, 0);
 	  close (mbfi);
-	  return (1);
+	  return EXIT_FAILURE;
 	}
       mbx_delimit_end (mbf);
       fflush (mbf);
@@ -798,7 +800,7 @@
 	  error ("Error in fflush: %s", strerror (errno), 0);
 	  pop_close (server);
 	  close (mbfi);
-	  return (1);
+	  return EXIT_FAILURE;
 	}
     }
 
@@ -812,14 +814,14 @@
   if (fsync (mbfi) < 0)
     {
       error ("Error in fsync: %s", strerror (errno), 0);
-      return (1);
+      return EXIT_FAILURE;
     }
 #endif
 
   if (close (mbfi) == -1)
     {
       error ("Error in close: %s", strerror (errno), 0);
-      return (1);
+      return EXIT_FAILURE;
     }
 
   if (! preserve)
@@ -829,17 +831,17 @@
 	  {
 	    error ("Error from POP server: %s", pop_error, 0);
 	    pop_close (server);
-	    return (1);
+	    return EXIT_FAILURE;
 	  }
       }
 
   if (pop_quit (server))
     {
       error ("Error from POP server: %s", pop_error, 0);
-      return (1);
+      return EXIT_FAILURE;
     }
 
-  return (0);
+  return EXIT_SUCCESS;
 }
 
 int
@@ -957,3 +959,5 @@
 
 /* arch-tag: 1c323112-41fe-4fe5-8de9-494de631f73f
    (do not change this comment) */
+
+/* movemail.c ends here */
--- a/lib-src/profile.c	Sat May 08 15:00:20 2004 +0000
+++ b/lib-src/profile.c	Sat May 08 15:23:35 2004 +0000
@@ -55,7 +55,7 @@
 get_time ()
 {
   if (watch_not_started)
-    exit (1);  /* call reset_watch first ! */
+    exit (EXIT_FAILURE);  /* call reset_watch first ! */
   EMACS_GET_TIME (TV2);
   EMACS_SUB_TIME (TV2, TV2, TV1);
   sprintf (time_string, "%lu.%06lu", (unsigned long)EMACS_SECS (TV2), (unsigned long)EMACS_USECS (TV2));
@@ -94,14 +94,16 @@
 	  puts (get_time ());
 	  break;
 	case 'q':
-	  exit (0);
+	  exit (EXIT_SUCCESS);
 	}
       /* Anything remaining on the line is ignored.  */
       while (c != '\n' && c != EOF)
 	c = getchar ();
     }
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 /* arch-tag: 8db68f7e-2322-4944-a315-dba349bdbf39
    (do not change this comment) */
+
+/* profile.c ends here */
--- a/lib-src/sorted-doc.c	Sat May 08 15:00:20 2004 +0000
+++ b/lib-src/sorted-doc.c	Sat May 08 15:23:35 2004 +0000
@@ -75,7 +75,7 @@
      char *s1, *s2;
 {
   error (s1, s2);
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 /* Like malloc but get fatal error if memory is exhausted.  */
@@ -279,8 +279,10 @@
     printf ("@bye\n");
   }
 
-  return 0;
+  return EXIT_SUCCESS;
 }
 
 /* arch-tag: ce28f204-1e70-4b34-8210-3d54a5662071
    (do not change this comment) */
+
+/* sorted-doc.c ends here */
--- a/lib-src/test-distrib.c	Sat May 08 15:00:20 2004 +0000
+++ b/lib-src/test-distrib.c	Sat May 08 15:23:35 2004 +0000
@@ -100,11 +100,10 @@
       exit (2);
     }
   close (fd);
-#ifdef VMS
-  exit (1);			/* On VMS, success is 1.  */
-#endif
-  return (0);
+  return EXIT_SUCCESS;
 }
 
 /* arch-tag: 3a89005d-df98-4c32-aa9f-33570e16a26a
    (do not change this comment) */
+
+/* test-distrib.c ends here */
--- a/lib-src/update-game-score.c	Sat May 08 15:00:20 2004 +0000
+++ b/lib-src/update-game-score.c	Sat May 08 15:23:35 2004 +0000
@@ -111,7 +111,7 @@
      const char *msg;
 {
   fprintf (stderr, "%s\n", msg);
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 void lose_syserr P_ ((const char *msg)) NO_RETURN;
@@ -138,7 +138,7 @@
      const char *msg;
 {
   fprintf (stderr, "%s: %s\n", msg, strerror (errno));
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 char *
@@ -199,7 +199,7 @@
     switch (c)
       {
       case 'h':
-	usage (0);
+	usage (EXIT_SUCCESS);
 	break;
       case 'd':
 	user_prefix = optarg;
@@ -213,11 +213,11 @@
 	  max = MAX_SCORES;
 	break;
       default:
-	usage (1);
+	usage (EXIT_FAILURE);
       }
 
   if (optind+3 != argc)
-    usage (1);
+    usage (EXIT_FAILURE);
 
   running_suid = (getuid () != geteuid ());
 
@@ -266,7 +266,7 @@
       lose_syserr ("Failed to write scores file");
     }
   unlock_file (scorefile, lockstate);
-  exit (0);
+  exit (EXIT_SUCCESS);
 }
 
 int
@@ -531,3 +531,5 @@
 
 /* arch-tag: 2bf5c52e-4beb-463a-954e-c58b9c64736b
    (do not change this comment) */
+
+/* update-game-score.c ends here */
--- a/lib-src/yow.c	Sat May 08 15:00:20 2004 +0000
+++ b/lib-src/yow.c	Sat May 08 15:23:35 2004 +0000
@@ -73,7 +73,7 @@
   if ((fp = fopen(file, "r")) == NULL) {
     fprintf(stderr, "yow: ");
     perror(file);
-    exit(1);
+    exit(EXIT_FAILURE);
   }
 
   /* initialize random seed */
@@ -82,7 +82,7 @@
   setup_yow(fp);
   yow(fp);
   fclose(fp);
-  return 0;
+  return EXIT_SUCCESS;
 }
 
 static long len = -1;
@@ -113,7 +113,7 @@
 
   if (fseek(fp, 0L, 2) == -1) {
     perror("yow");
-    exit(1);
+    exit(EXIT_FAILURE);
   }
   len = ftell(fp) - header_len;
 }
@@ -132,7 +132,7 @@
   offset = rand() % len + header_len;
   if (fseek(fp, offset, 0) == -1) {
     perror("yow");
-    exit(1);
+    exit(EXIT_FAILURE);
   }
 
   /* Read until SEP, read next line, print it.
@@ -180,3 +180,5 @@
 
 /* arch-tag: e40fc0df-bafb-4001-af24-5c883d1c685e
    (do not change this comment) */
+
+/* yow.c ends here */