Commit 65396510 authored by Thien-Thi Nguyen's avatar Thien-Thi Nguyen

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.
parent 28712a21
2004-05-08 Thien-Thi Nguyen <ttn@gnu.org>
* cvtmail.c: 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.
* ebrowse.c, emacsclient.c, fakemail.c, hexl.c,
make-docfile.c, movemail.c, profile.c, sorted-doc.c,
test-distrib.c, update-game-score.c, yow.c: Likewise.
2004-05-08 Thien-Thi Nguyen <ttn@gnu.org>
* Makefile.in (emacsclient${EXEEXT}): Use makefile var `version'.
......
......@@ -119,7 +119,7 @@ main (argc, argv)
}
fclose (mddf);
fclose (mfilef);
return 0;
return EXIT_SUCCESS;
}
void
......@@ -148,7 +148,7 @@ fatal (s1, s2)
char *s1, *s2;
{
error (s1, s2);
exit (1);
exit (EXIT_FAILURE);
}
void
......@@ -157,7 +157,7 @@ sysfail (s)
{
fprintf (stderr, "cvtmail: ");
perror (s);
exit (1);
exit (EXIT_FAILURE);
}
char *
......@@ -183,3 +183,5 @@ xrealloc (ptr, size)
/* arch-tag: b93c25a9-9012-44f1-b78b-9cc7aed44a7a
(do not change this comment) */
/* cvtmail.c ends here */
......@@ -564,7 +564,7 @@ xmalloc (nbytes)
if (p == NULL)
{
yyerror ("out of memory", NULL);
exit (1);
exit (EXIT_FAILURE);
}
return p;
}
......@@ -581,7 +581,7 @@ xrealloc (p, sz)
if (p == NULL)
{
yyerror ("out of memory", NULL);
exit (1);
exit (EXIT_FAILURE);
}
return p;
}
......@@ -3671,7 +3671,7 @@ usage (error)
int error;
{
puts (USAGE);
exit (error ? 1 : 0);
exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
}
......@@ -3688,7 +3688,7 @@ version ()
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 @@ main (argc, argv)
if (yyout == NULL)
{
yyerror ("cannot open output file `%s'", out_filename);
exit (1);
exit (EXIT_FAILURE);
}
}
......@@ -3970,11 +3970,10 @@ main (argc, argv)
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 */
......@@ -44,9 +44,6 @@ Boston, MA 02111-1307, USA. */
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 @@ decode_options (argc, argv)
case 'V':
printf ("emacsclient %s\n", VERSION);
exit (0);
exit (EXIT_SUCCESS);
break;
case 'H':
......@@ -140,7 +137,7 @@ decode_options (argc, argv)
default:
fprintf (stderr, "Try `%s --help' for more information\n", progname);
exit (1);
exit (EXIT_FAILURE);
break;
}
}
......@@ -166,7 +163,7 @@ The following OPTIONS are accepted:\n\
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 @@ xmalloc (size)
if (result == NULL)
{
perror ("malloc");
exit (1);
exit (EXIT_FAILURE);
}
return result;
}
......@@ -243,7 +240,7 @@ fail (argc, argv)
}
else
{
exit (1);
exit (EXIT_FAILURE);
}
}
......@@ -314,7 +311,7 @@ main (argc, argv)
{
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 @@ main (argc, argv)
{
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 @@ main (argc, argv)
{
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 @@ To start the server in Emacs, type \"M-x server-start\".\n",
}
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 @@ To start the server in Emacs, type \"M-x server-start\".\n",
printf ("\n");
fflush (stdout);
return 0;
return EXIT_SUCCESS;
}
#endif /* HAVE_SOCKETS */
......@@ -572,3 +569,5 @@ strerror (errnum)
/* arch-tag: f39bb9c4-73eb-477e-896d-50832e2ca9a7
(do not change this comment) */
/* emacsclient.c ends here */
......@@ -169,7 +169,7 @@ fatal (s1, s2)
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 @@ close_the_streams ()
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 @@ read_header ()
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 @@ main (argc, argv)
/* arch-tag: acb0afa6-315a-4c5b-b9e3-def5725c8783
(do not change this comment) */
/* fakemail.c ends here */
......@@ -270,15 +270,17 @@ main (argc, argv)
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 */
......@@ -104,7 +104,7 @@ fatal (s1, s2)
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 @@ scan_lisp_file (filename, mode)
/* arch-tag: f7203aaf-991a-4238-acb5-601db56f2894
(do not change this comment) */
/* make-docfile.c ends here */
......@@ -216,7 +216,7 @@ main (argc, argv)
preserve_mail++;
break;
default:
exit(1);
exit (EXIT_FAILURE);
}
}
......@@ -234,7 +234,7 @@ main (argc, argv)
#else
fprintf (stderr, "Usage: movemail [-p] inbox destfile%s\n", "");
#endif
exit (1);
exit (EXIT_FAILURE);
}
inname = argv[optind];
......@@ -536,12 +536,12 @@ main (argc, argv)
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 @@ main (argc, argv)
#endif /* ! DISABLE_DIRECT_ACCESS */
return 0;
return EXIT_SUCCESS;
}
#ifdef MAIL_USE_MAILLOCK
......@@ -607,7 +607,7 @@ fatal (s1, s2)
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 @@ char Errmsg[200]; /* POP errors, at least, can exceed
* 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 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
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 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
{
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 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
error ("Error in fdopen: %s", strerror (errno), 0);
close (mbfi);
unlink (outfile);
return (1);
return EXIT_FAILURE;
}
if (reverse_order)
......@@ -789,7 +791,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
{
error (Errmsg, 0, 0);
close (mbfi);
return (1);
return EXIT_FAILURE;
}
mbx_delimit_end (mbf);
fflush (mbf);
......@@ -798,7 +800,7 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
error ("Error in fflush: %s", strerror (errno), 0);
pop_close (server);
close (mbfi);
return (1);
return EXIT_FAILURE;
}
}
......@@ -812,14 +814,14 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
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 @@ popmail (mailbox, outfile, preserve, password, reverse_order)
{
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 @@ strerror (errnum)
/* arch-tag: 1c323112-41fe-4fe5-8de9-494de631f73f
(do not change this comment) */
/* movemail.c ends here */
......@@ -55,7 +55,7 @@ char *
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 @@ main ()
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 */
......@@ -75,7 +75,7 @@ fatal (s1, s2)
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 @@ main ()
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 */
......@@ -100,11 +100,10 @@ have been corrupted in the files of Emacs, and it will not work.\n",
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 */
......@@ -111,7 +111,7 @@ lose (msg)
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 @@ lose_syserr (msg)
const char *msg;
{
fprintf (stderr, "%s: %s\n", msg, strerror (errno));
exit (1);
exit (EXIT_FAILURE);
}
char *
......@@ -199,7 +199,7 @@ main (argc, argv)
switch (c)
{
case 'h':
usage (0);
usage (EXIT_SUCCESS);
break;
case 'd':
user_prefix = optarg;
......@@ -213,11 +213,11 @@ main (argc, argv)
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 @@ main (argc, argv)
lose_syserr ("Failed to write scores file");
}
unlock_file (scorefile, lockstate);
exit (0);
exit (EXIT_SUCCESS);
}
int
......@@ -531,3 +531,5 @@ unlock_file (filename, state)
/* arch-tag: 2bf5c52e-4beb-463a-954e-c58b9c64736b
(do not change this comment) */
/* update-game-score.c ends here */
......@@ -73,7 +73,7 @@ main (argc, argv)
if ((fp = fopen(file, "r")) == NULL) {
fprintf(stderr, "yow: ");
perror(file);
exit(1);
exit(EXIT_FAILURE);
}
/* initialize random seed */
......@@ -82,7 +82,7 @@ main (argc, argv)
setup_yow(fp);
yow(fp);
fclose(fp);
return 0;
return EXIT_SUCCESS;
}
static long len = -1;
......@@ -113,7 +113,7 @@ setup_yow(fp)
if (fseek(fp, 0L, 2) == -1) {
perror("yow");
exit(1);
exit(EXIT_FAILURE);
}
len = ftell(fp) - header_len;
}
......@@ -132,7 +132,7 @@ yow (fp)
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 @@ yow (fp)
/* arch-tag: e40fc0df-bafb-4001-af24-5c883d1c685e
(do not change this comment) */
/* yow.c ends here */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment