From: Thien-Thi Nguyen Date: Sun, 9 May 2004 16:20:36 +0000 (+0000) Subject: Throughout, replace 0 destined for `exit' arg X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bd4ff48e09723bb297208c40bcd3b58cea255a4d;p=emacs.git 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. --- diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 85131192cbe..97a653afc37 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,13 @@ +2004-05-09 Thien-Thi Nguyen + + * 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, emacsserver.c, fakemail.c, + hexl.c, make-docfile.c, movemail.c, profile.c, sorted-doc.c, + test-distrib.c, yow.c: Likewise. + 2004-05-08 Thien-Thi Nguyen * etags.c: [VMS] Include lib$routines.h. diff --git a/lib-src/cvtmail.c b/lib-src/cvtmail.c index 85c5512abfc..70eda8006b5 100644 --- a/lib-src/cvtmail.c +++ b/lib-src/cvtmail.c @@ -29,7 +29,7 @@ Boston, MA 02111-1307, USA. */ * * In order to get rmail to read the messages, the resulting file must * be mv'ed to ~/mbox, and then have rmail invoked on them. - * + * * Author: Larry Kolodney, 1985 */ @@ -115,8 +115,8 @@ main (argc, argv) } } fclose (mddf); - fclose (mfilef); - return 0; + fclose (mfilef); + return EXIT_SUCCESS; } void @@ -145,7 +145,7 @@ fatal (s1, s2) char *s1, *s2; { error (s1, s2); - exit (1); + exit (EXIT_FAILURE); } void @@ -154,7 +154,7 @@ sysfail (s) { fprintf (stderr, "cvtmail: "); perror (s); - exit (1); + exit (EXIT_FAILURE); } char * @@ -177,3 +177,5 @@ xrealloc (ptr, size) fatal ("virtual memory exhausted", 0); return result; } + +/* cvtmail.c ends here */ diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 69bd057a59c..36a3c02d5d9 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -6,7 +6,7 @@ Author: Gerd Moellmann Maintainer: FSF - + This file is part of GNU Emacs. GNU Emacs is free software; you can redistribute it and/or modify @@ -400,7 +400,7 @@ int inbuffer_size; #define BUFFER_POS() (in - inbuffer) -/* If current lookahead is CSTRING, the following points to the +/* If current lookahead is CSTRING, the following points to the first character in the string constant. Used for recognizing extern "C". */ @@ -560,7 +560,7 @@ xmalloc (nbytes) if (p == NULL) { yyerror ("out of memory", NULL); - exit (1); + exit (EXIT_FAILURE); } return p; } @@ -577,7 +577,7 @@ xrealloc (p, sz) if (p == NULL) { yyerror ("out of memory", NULL); - exit (1); + exit (EXIT_FAILURE); } return p; } @@ -686,7 +686,7 @@ add_link (super, sub) { lnk = (struct link *) xmalloc (sizeof *lnk); lnk2 = (struct link *) xmalloc (sizeof *lnk2); - + lnk->sym = sub; lnk->next = p; @@ -728,15 +728,15 @@ find_member (cls, name, var, sc, hash) case SC_FRIEND: list = &cls->friends; break; - + case SC_TYPE: list = &cls->types; break; - + case SC_STATIC: list = var ? &cls->static_vars : &cls->static_fns; break; - + default: list = var ? &cls->vars : &cls->fns; break; @@ -928,7 +928,7 @@ add_global_defn (name, regexp, pos, hash, var, sc, flags) a bit set giving additional information about the member (see the F_* defines). */ -void +void add_global_decl (name, regexp, pos, hash, var, sc, flags) char *name, *regexp; int pos; @@ -1008,15 +1008,15 @@ add_member (cls, name, var, sc, hash) case SC_FRIEND: list = &cls->friends; break; - + case SC_TYPE: list = &cls->types; break; - + case SC_STATIC: list = var ? &cls->static_vars : &cls->static_fns; break; - + default: list = var ? &cls->vars : &cls->fns; break; @@ -1112,7 +1112,7 @@ check_namespace (name, context) struct sym *context; { struct sym *p = NULL; - + for (p = all_namespaces; p; p = p->next) { if (streq (p->name, name) && (p->namesp == context)) @@ -1137,7 +1137,7 @@ find_namespace (name, context) return p; } - + /* Find namespace alias with name NAME. If not found return NULL. */ @@ -1210,7 +1210,7 @@ enter_namespace (name) size * sizeof *namespace_stack); namespace_stack_size = size; } - + namespace_stack[namespace_sp++] = current_namespace; current_namespace = p; } @@ -1282,7 +1282,7 @@ sym_scope_1 (p) struct sym *p; { int len; - + if (p->namesp) sym_scope_1 (p->namesp); @@ -1297,14 +1297,14 @@ sym_scope_1 (p) ensure_scope_buffer_room (len + 1); strcat (scope_buffer, p->name); scope_buffer_len += len; - + if (HAS_FLAG (p->flags, F_TEMPLATE)) { ensure_scope_buffer_room (3); strcat (scope_buffer, "<>"); scope_buffer_len += 2; } - + return scope_buffer; } @@ -1321,10 +1321,10 @@ sym_scope (p) scope_buffer_size = 1024; scope_buffer = (char *) xmalloc (scope_buffer_size); } - + *scope_buffer = '\0'; scope_buffer_len = 0; - + if (p->namesp) sym_scope_1 (p->namesp); @@ -1377,13 +1377,13 @@ dump_sym (fp, root) { fputs (CLASS_STRUCT, fp); PUTSTR (root->name, fp); - + /* Print scope, if any. */ if (root->namesp) PUTSTR (sym_scope (root), fp); else PUTSTR (NULL, fp); - + /* Print flags. */ fprintf (fp, "%u", root->flags); PUTSTR (root->filename, fp); @@ -1563,7 +1563,7 @@ process_pp_line () add_define (yytext, regexp, pos); } } - + while (c && (c != '\n' || in_comment || in_string)) { if (c == '\\') @@ -1580,7 +1580,7 @@ process_pp_line () } else if (c == '"') in_string = !in_string; - + if (c == '\n') INCREMENT_LINENO; @@ -2184,7 +2184,7 @@ re_init_scanner () { in = inbuffer; yyline = 1; - + if (yytext == NULL) { int size = 256; @@ -2386,19 +2386,19 @@ skip_matching () case '{': close = '}'; break; - + case '(': close = ')'; break; - + case '<': close = '>'; break; - + case '[': close = ']'; break; - + default: abort (); } @@ -2483,7 +2483,7 @@ parm_list (flags) { switch (LA1) { - /* Skip over grouping parens or parameter lists in parameter + /* Skip over grouping parens or parameter lists in parameter declarations. */ case '(': skip_matching (); @@ -2505,7 +2505,7 @@ parm_list (flags) { char *last_id; unsigned ident_type_hash = 0; - + parse_qualified_param_ident_or_type (&last_id); if (last_id) { @@ -2533,7 +2533,7 @@ parm_list (flags) case DOUBLE: case ENUM: case FLOAT: case INT: case LONG: case SHORT: case SIGNED: case STRUCT: case UNION: case UNSIGNED: case VOLATILE: case WCHAR: - case ELLIPSIS: + case ELLIPSIS: type_seen = 1; hash = (hash << 1) ^ LA1; MATCH (); @@ -2553,7 +2553,7 @@ parm_list (flags) if (LOOKING_AT (')')) { MATCH (); - + if (LOOKING_AT (CONST)) { /* We can overload the same function on `const' */ @@ -2638,7 +2638,7 @@ member (cls, vis) case EXPLICIT: SET_FLAG (flags, F_EXPLICIT); goto typeseen; - + case MUTABLE: SET_FLAG (flags, F_MUTABLE); goto typeseen; @@ -2773,7 +2773,7 @@ member (cls, vis) { regexp = matching_regexp (); pos = BUFFER_POS (); - + if (cls != NULL) { if (type_seen || !paren_seen) @@ -2782,7 +2782,7 @@ member (cls, vis) add_member_decl (cls, id, regexp, pos, hash, 0, sc, vis, 0); } } - + MATCH (); print_info (); } @@ -2879,7 +2879,7 @@ struct sym * parse_classname () { struct sym *last_class = NULL; - + while (LOOKING_AT (IDENT)) { last_class = add_sym (yytext, last_class); @@ -2890,10 +2890,10 @@ parse_classname () skip_matching (); SET_FLAG (last_class->flags, F_TEMPLATE); } - + if (!LOOKING_AT (DCOLON)) break; - + MATCH (); } @@ -2913,7 +2913,7 @@ operator_name (sc) static char *id = NULL; char *s; int len; - + MATCH (); if (LOOKING_AT2 (NEW, DELETE)) @@ -2924,7 +2924,7 @@ operator_name (sc) s = token_string (LA1); MATCH (); - + len = strlen (s) + 10; if (len > id_size) { @@ -2939,7 +2939,7 @@ operator_name (sc) { strcat (id, "["); MATCH (); - + if (LOOKING_AT (']')) { strcat (id, "]"); @@ -3004,7 +3004,7 @@ parse_qualified_ident_or_type (last_id) char *id = NULL; size_t id_size = 0; int enter = 0; - + while (LOOKING_AT (IDENT)) { int len = strlen (yytext) + 1; @@ -3120,7 +3120,7 @@ class_definition (containing, tag, flags, nested) settings. */ if ((tag != CLASS && !f_structs) || (nested && !f_nested_classes)) current = NULL; - else + else { current = add_sym (yytext, containing); current->pos = BUFFER_POS (); @@ -3139,7 +3139,7 @@ class_definition (containing, tag, flags, nested) { switch (LA1) { - case VIRTUAL: case PUBLIC: case PROTECTED: case PRIVATE: + case VIRTUAL: case PUBLIC: case PROTECTED: case PRIVATE: MATCH (); break; @@ -3233,7 +3233,7 @@ declaration (flags) sc = SC_TYPE; MATCH (); break; - + case STATIC: sc = SC_STATIC; MATCH (); @@ -3361,7 +3361,7 @@ declaration (flags) else add_global_defn (id, regexp, pos, 0, 1, sc, flags); } - + MATCH (); print_info (); } @@ -3399,7 +3399,7 @@ globals (start_flags) for (;;) { char *prev_in = in; - + switch (LA1) { case NAMESPACE: @@ -3410,13 +3410,13 @@ globals (start_flags) { char *namespace_name = xstrdup (yytext); MATCH (); - + if (LOOKING_AT ('=')) { struct link *qna = match_qualified_namespace_alias (); if (qna) register_namespace_alias (namespace_name, qna); - + if (skip_to (';') == ';') MATCH (); } @@ -3441,7 +3441,7 @@ globals (start_flags) { /* This is `extern "C"'. */ MATCH (); - + if (LOOKING_AT ('{')) { MATCH (); @@ -3452,7 +3452,7 @@ globals (start_flags) SET_FLAG (flags, F_EXTERNC); } break; - + case TEMPLATE: MATCH (); SKIP_MATCHING_IF ('<'); @@ -3492,7 +3492,7 @@ globals (start_flags) case '}': return 0; - + default: declaration (flags); flags = start_flags; @@ -3531,10 +3531,10 @@ add_search_path (path_list) { char *start = path_list; struct search_path *p; - + while (*path_list && *path_list != PATH_LIST_SEPARATOR) ++path_list; - + p = (struct search_path *) xmalloc (sizeof *p); p->path = (char *) xmalloc (path_list - start + 1); memcpy (p->path, start, path_list - start); @@ -3568,7 +3568,7 @@ open_file (file) static int buffer_size; struct search_path *path; int flen = strlen (file) + 1; /* +1 for the slash */ - + filename = xstrdup (file); for (path = search_path; path && fp == NULL; path = path->next) @@ -3580,20 +3580,20 @@ open_file (file) buffer_size = max (len + 1, 2 * buffer_size); buffer = (char *) xrealloc (buffer, buffer_size); } - + strcpy (buffer, path->path); strcat (buffer, "/"); strcat (buffer, file); fp = fopen (buffer, "r"); } - + /* Try the original file name. */ if (fp == NULL) fp = fopen (file, "r"); if (fp == NULL) yyerror ("cannot open", NULL); - + return fp; } @@ -3624,7 +3624,7 @@ usage (error) int error; { puts (USAGE); - exit (error ? 1 : 0); + exit (error ? EXIT_FAILURE : EXIT_SUCCESS); } @@ -3641,7 +3641,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); } @@ -3653,10 +3653,10 @@ process_file (file) char *file; { FILE *fp; - + fp = open_file (file); if (fp) - { + { int nread, nbytes; /* Give a progress indication if needed. */ @@ -3679,7 +3679,7 @@ process_file (file) inbuffer_size = nread + READ_CHUNK_SIZE + 1; inbuffer = (char *) xrealloc (inbuffer, inbuffer_size); } - + nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp); if (nbytes <= 0) break; @@ -3722,10 +3722,10 @@ read_line (fp) buffer[i++] = c; } - + if (c == EOF && i == 0) return NULL; - + if (i == buffer_size) { buffer_size = max (100, buffer_size * 2); @@ -3765,7 +3765,7 @@ main (argc, argv) case 'p': info_position = atoi (optarg); break; - + case 'n': f_nested_classes = 0; break; @@ -3773,7 +3773,7 @@ main (argc, argv) case 'x': f_regexps = 0; break; - + /* Add the name of a file containing more input files. */ case 'f': if (n_input_files == input_filenames_size) @@ -3870,15 +3870,15 @@ main (argc, argv) yyerror ("error getting size of file `%s'", out_filename); else if (rc == 0) yyerror ("file `%s' is empty", out_filename); - + fclose (fp); } - + yyout = fopen (out_filename, f_append ? "a" : "w"); if (yyout == NULL) { yyerror ("cannot open output file `%s'", out_filename); - exit (1); + exit (EXIT_FAILURE); } } @@ -3903,7 +3903,7 @@ main (argc, argv) for (i = 0; i < n_input_files; ++i) { FILE *fp = fopen (input_filenames[i], "r"); - + if (fp == NULL) yyerror ("cannot open input file `%s'", input_filenames[i]); else @@ -3923,8 +3923,7 @@ main (argc, argv) if (yyout != stdout) fclose (yyout); - return 0; + return EXIT_SUCCESS; } - /* ebrowse.c ends here. */ diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 65438de5fba..9ef2e12129b 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA. */ #include <../src/config.h> #undef signal -#include +#include #include #include #ifdef HAVE_UNISTD_H @@ -84,25 +84,25 @@ decode_options (argc, argv) break; alternate_editor = getenv ("ALTERNATE_EDITOR"); - + switch (opt) { case 0: /* If getopt returns 0, then it has already processed a long-named option. We should do nothing. */ break; - + case 'a': alternate_editor = optarg; break; - + case 'n': nowait = 1; break; case 'V': fprintf (stderr, "emacsclient %s\n", VERSION); - exit (1); + exit (EXIT_FAILURE); break; case 'H': @@ -123,7 +123,7 @@ print_help_and_exit () progname); fprintf (stderr, "Report bugs to bug-gnu-emacs@gnu.org.\n"); - exit (1); + exit (EXIT_FAILURE); } /* Return a copy of NAME, inserting a & @@ -157,7 +157,7 @@ quote_file_name (name) } *q++ = 0; - + return copy; } @@ -171,7 +171,7 @@ xmalloc (size) if (result == NULL) { perror ("malloc"); - exit (1); + exit (EXIT_FAILURE); } return result; } @@ -193,12 +193,12 @@ fail (argc, argv) } else { - exit (1); + exit (EXIT_FAILURE); } } - + #if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC) @@ -272,7 +272,7 @@ main (argc, argv) if (argc - optind < 1) print_help_and_exit (); - /* + /* * Open up an AF_UNIX socket in this person's home directory */ @@ -282,7 +282,7 @@ main (argc, argv) perror ("socket"); fail (argc, argv); } - + server.sun_family = AF_UNIX; { @@ -317,11 +317,11 @@ main (argc, argv) our euid. If so, look for a socket based on the UID associated with the name. This is reminiscent of the logic that init_editfns uses to set the global Vuser_full_name. */ - + char *user_name = (char *) getenv ("LOGNAME"); if (!user_name) user_name = (char *) getenv ("USER"); - + if (user_name) { struct passwd *pw = getpwnam (user_name); @@ -334,7 +334,7 @@ main (argc, argv) } } } - + switch (sock_status) { case 1: @@ -346,7 +346,7 @@ main (argc, argv) fail (argc, argv); } break; - + case 2: /* `stat' failed */ if (errno == ENOENT) @@ -439,7 +439,7 @@ main (argc, argv) /* Maybe wait for an answer. */ if (nowait) - return 0; + return EXIT_SUCCESS; printf ("Waiting for Emacs..."); fflush (stdout); @@ -448,11 +448,11 @@ main (argc, argv) the first line we read will actually be the output we just sent. We can't predict whether that will happen, so if it does, we detect it by recognizing `Client: ' at the beginning. */ - + while (str = fgets (string, BUFSIZ, in)) printf ("%s", str); - return 0; + return EXIT_SUCCESS; } #else /* This is the SYSV IPC section */ @@ -500,7 +500,7 @@ main (argc, argv) if ((homedir = getenv ("HOME")) == NULL) { fprintf (stderr, "%s: No home directory\n", argv[0]); - exit (1); + exit (EXIT_FAILURE); } strcpy (buf, homedir); #ifndef HAVE_LONG_FILE_NAMES @@ -518,7 +518,7 @@ main (argc, argv) { fprintf (stderr, "%s: ", argv[0]); perror ("msgget"); - exit (1); + exit (EXIT_FAILURE); } /* Determine working dir, so we can prefix it to all the arguments. */ @@ -615,7 +615,7 @@ main (argc, argv) /* Maybe wait for an answer. */ if (nowait) - return 0; + return EXIT_SUCCESS; printf ("Waiting for Emacs..."); fflush (stdout); @@ -626,7 +626,7 @@ main (argc, argv) printf ("\n"); if (*buf) printf ("%s\n", buf); - exit (0); + exit (EXIT_SUCCESS); } #endif /* HAVE_SYSVIPC */ @@ -647,3 +647,5 @@ strerror (errnum) } #endif /* ! HAVE_STRERROR */ + +/* emacsclient.c ends here */ diff --git a/lib-src/emacsserver.c b/lib-src/emacsserver.c index 23623292d7e..da74a94f4c8 100644 --- a/lib-src/emacsserver.c +++ b/lib-src/emacsserver.c @@ -38,7 +38,7 @@ main () { fprintf (stderr, "Sorry, the Emacs server is supported only on systems\n"); fprintf (stderr, "with Berkeley sockets or System V IPC.\n"); - exit (1); + exit (EXIT_FAILURE); } #else /* HAVE_SOCKETS or HAVE_SYSVIPC */ @@ -191,7 +191,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. */ @@ -240,14 +240,14 @@ main (argc, argv) if (openfiles == 0) abort (); - /* + /* * Open up an AF_UNIX socket in this person's home directory */ if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) { perror_1 ("socket"); - exit (1); + exit (EXIT_FAILURE); } server.sun_family = AF_UNIX; @@ -272,9 +272,9 @@ main (argc, argv) if (unlink (server.sun_path) == -1 && errno != ENOENT) { perror_1 ("unlink"); - exit (1); + exit (EXIT_FAILURE); } -#else +#else if ((homedir = getenv ("HOME")) == NULL) fatal_error ("No home directory\n"); @@ -294,13 +294,13 @@ main (argc, argv) if (bind (s, (struct sockaddr *) &server, strlen (server.sun_path) + 2) < 0) { perror_1 ("bind"); - exit (1); + exit (EXIT_FAILURE); } /* Only this user can send commands to this Emacs. */ if (stat (server.sun_path, &statbuf) < 0) { perror_1 ("bind"); - exit (1); + exit (EXIT_FAILURE); } chmod (server.sun_path, statbuf.st_mode & 0600); @@ -310,7 +310,7 @@ main (argc, argv) if (listen (s, 5) < 0) { perror_1 ("listen"); - exit (1); + exit (EXIT_FAILURE); } /* Disable sigpipes in case luser kills client... */ @@ -398,14 +398,14 @@ main (argc, argv) fflush (infile); /* If command is close, close connection to client. */ - if (strncmp (code, "Close:", 6) == 0) - if (infd > 2) + if (strncmp (code, "Close:", 6) == 0) + if (infd > 2) { fclose (infile); close (infd); } continue; - } + } } } @@ -472,7 +472,7 @@ main () if (s == -1) { perror_1 ("msgget"); - exit (1); + exit (EXIT_FAILURE); } /* Fork so we can close connection even if parent dies */ @@ -482,7 +482,7 @@ main () msgctl (s, IPC_RMID, 0); if (p > 0) kill (p, SIGKILL); - exit (0); + exit (EXIT_SUCCESS); } signal (SIGTERM, msgcatch); signal (SIGINT, msgcatch); @@ -499,7 +499,7 @@ main () if (kill (p, 0) < 0) { msgctl (s, IPC_RMID, 0); - exit (0); + exit (EXIT_SUCCESS); } sleep (10); } @@ -519,7 +519,7 @@ main () msgp->mtype = 1; msgsnd (s, msgp, strlen (msgp->mtext) + 1, 0); } - exit (1); + exit (EXIT_FAILURE); } /* In the process c1, @@ -533,7 +533,7 @@ main () continue; #endif perror_1 ("msgrcv"); - exit (1); + exit (EXIT_FAILURE); } else { @@ -590,6 +590,8 @@ fatal_error (string) { fprintf (stderr, "%s", "Error: "); fprintf (stderr, string); - exit (1); + exit (EXIT_FAILURE); } #endif /* HAVE_SOCKETS or HAVE_SYSVIPC */ + +/* emacsserver.c ends here */ diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c index 588496a8ed4..40ba29f8877 100644 --- a/lib-src/fakemail.c +++ b/lib-src/fakemail.c @@ -85,7 +85,7 @@ struct header_record struct header_record *previous; }; typedef struct header_record *header; - + struct stream_record { FILE *handle; @@ -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. */ @@ -206,7 +206,7 @@ init_linebuffer (linebuffer) } /* Read a line of text from `stream' into `linebuffer'. - * Return the length of the line. + * Return the length of the line. */ long @@ -411,7 +411,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 @@ -622,13 +622,13 @@ parse_header (the_header, where) *where = '\0'; return; } - + /* Read lines from the input until we get a blank line. Create a list of `header' objects, one for each header field, each of which points to a list of `line_list' objects, one for each line in that field. Continuation lines are grouped in the headers they continue. */ - + header read_header () { @@ -668,7 +668,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); @@ -728,7 +728,7 @@ main (argc, argv) command_line = alloc_string (name_length + args_size (the_header)); strcpy (command_line, mail_program_name); parse_header (the_header, &command_line[name_length]); - + the_pipe = popen (command_line, "w"); if (the_pipe == ((FILE *) NULL)) fatal ("cannot open pipe to real mailer"); @@ -751,3 +751,5 @@ main (argc, argv) #endif /* not MSDOS */ #endif /* not BSD 4.2 (or newer) */ + +/* fakemail.c ends here */ diff --git a/lib-src/hexl.c b/lib-src/hexl.c index 9c40b0e3d94..db58ea02cc0 100644 --- a/lib-src/hexl.c +++ b/lib-src/hexl.c @@ -73,7 +73,7 @@ main (argc, argv) ** dump filename ** - (as filename == stdin) */ - + while (*argv && *argv[0] == '-' && (*argv)[1]) { /* A switch! */ @@ -270,12 +270,14 @@ 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); } + +/* hexl.c ends here */ diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 793c5e4211a..27f64145c85 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -99,7 +99,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. */ @@ -174,10 +174,7 @@ main (argc, argv) if (j == i) err_count += scan_file (argv[i]); } -#ifndef VMS - exit (err_count > 0); -#endif /* VMS */ - return err_count > 0; + return (err_count > 0 ? EXIT_FAILURE : EXIT_SUCCESS); } /* Read file FILENAME and output its doc strings to outfile. */ @@ -544,14 +541,14 @@ scan_c_file (filename, mode) When we find that, we save it for the following defining-form, and we use that instead of reading a doc string within that defining-form. - For defvar, defconst, and fset we skip to the docstring with a kludgy + For defvar, defconst, and fset we skip to the docstring with a kludgy formatting convention: all docstrings must appear on the same line as the - initial open-paren (the one in column zero) and must contain a backslash + initial open-paren (the one in column zero) and must contain a backslash and a newline immediately after the initial double-quote. No newlines must appear between the beginning of the form and the first double-quote. For defun, defmacro, and autoload, we know how to skip over the arglist, but the doc string must still have a backslash and newline - immediately after the double quote. + immediately after the double quote. The only source files that must follow this convention are preloaded uncompiled ones like loaddefs.el and bindings.el; aside from that, it is always the .elc file that we look at, and they are no @@ -597,7 +594,7 @@ read_lisp_symbol (infile, buffer) if (! buffer[0]) fprintf (stderr, "## expected a symbol, got '%c'\n", c); - + skip_white (infile); } @@ -741,7 +738,7 @@ scan_lisp_file (filename, mode) c1 = c; c = getc (infile); } - + /* If two previous characters were " and \, this is a doc string. Otherwise, there is none. */ if (c2 != '"' || c1 != '\\') @@ -800,7 +797,7 @@ scan_lisp_file (filename, mode) c1 = c; c = getc (infile); } - + /* If two previous characters were " and \, this is a doc string. Otherwise, there is none. */ if (c2 != '"' || c1 != '\\') @@ -857,7 +854,7 @@ scan_lisp_file (filename, mode) c1 = c; c = getc (infile); } - + /* If two previous characters were " and \, this is a doc string. Otherwise, there is none. */ if (c2 != '"' || c1 != '\\') @@ -967,3 +964,5 @@ scan_lisp_file (filename, mode) fclose (infile); return 0; } + +/* make-docfile.c ends here */ diff --git a/lib-src/movemail.c b/lib-src/movemail.c index be0e9d3ce94..563d6ac2c22 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -39,11 +39,11 @@ Boston, MA 02111-1307, USA. */ * "po:username". This will cause movemail to open a connection to * a pop server running on $MAILHOST (environment variable). Movemail * must be setuid to root in order to work with POP. - * + * * New module: popmail.c * Modified routines: * main - added code within #ifdef MAIL_USE_POP; added setuid (getuid ()) - * after POP code. + * after POP code. * New routines in movemail.c: * get_errmsg - return pointer to system error message * @@ -215,7 +215,7 @@ main (argc, argv) preserve_mail++; break; default: - exit(1); + exit (EXIT_FAILURE); } } @@ -234,7 +234,7 @@ main (argc, argv) "" #endif ); - exit (1); + exit (EXIT_FAILURE); } inname = argv[optind]; @@ -458,7 +458,7 @@ main (argc, argv) pfatal_with_name (inname); } - + { char buf[1024]; @@ -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' @@ -736,19 +736,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 +756,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 +766,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 +789,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 +798,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 +812,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 +829,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 @@ -912,7 +912,7 @@ mbx_write (line, len, mbf) line++; len--; } - if (fwrite (line, 1, len, mbf) != len) + if (fwrite (line, 1, len, mbf) != len) return (NOTOK); if (fputc (0x0a, mbf) == EOF) return (NOTOK); @@ -953,3 +953,5 @@ strerror (errnum) } #endif /* ! HAVE_STRERROR */ + +/* movemail.c ends here */ diff --git a/lib-src/profile.c b/lib-src/profile.c index 8c60042acac..85c13958a16 100644 --- a/lib-src/profile.c +++ b/lib-src/profile.c @@ -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,13 +94,13 @@ 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); } /* profile.c ends here */ diff --git a/lib-src/sorted-doc.c b/lib-src/sorted-doc.c index e0526dd3e7f..e585959d76b 100644 --- a/lib-src/sorted-doc.c +++ b/lib-src/sorted-doc.c @@ -1,6 +1,6 @@ /* Give this program DOCSTR.mm.nn as standard input and it outputs to standard output a file of texinfo input containing the doc strings. - + Copyright (C) 1989, 1992, 1994, 1996, 1999, 2000, 2001 Free Software Foundation Inc. @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License along with GNU Emacs; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - + This version sorts the output by function name. */ #include "config.h" @@ -71,7 +71,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. */ @@ -117,7 +117,7 @@ char *states[] = { "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET" }; - + int main () { @@ -129,7 +129,7 @@ main () DOCSTR *docs; /* chain of allocated DOCSTRS */ char buf[512]; /* line buffer */ - + while (1) /* process one char at a time */ { /* this char from the DOCSTR file */ @@ -177,7 +177,7 @@ main () bp = buf; state = DESC_GET; } - + /* process gets */ if (state == NAME_GET || state == DESC_GET) @@ -275,5 +275,7 @@ main () printf ("@bye\n"); } - return 0; + return EXIT_SUCCESS; } + +/* sorted-doc.c ends here */ diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c index 52ffbb96438..56bfc42d975 100644 --- a/lib-src/test-distrib.c +++ b/lib-src/test-distrib.c @@ -45,7 +45,7 @@ This file is read by the `test-distribution' program.\n\ If you change it, you will make that program fail.\n"; char buf[300]; - + /* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */ int cool_read (fd, buf, size) @@ -95,8 +95,7 @@ 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; } + +/* test-distrib.c ends here */ diff --git a/lib-src/yow.c b/lib-src/yow.c index 4efe8153415..2cbb4e8240b 100644 --- a/lib-src/yow.c +++ b/lib-src/yow.c @@ -1,12 +1,12 @@ /* * yow.c - * + * * Print a quotation from Zippy the Pinhead. * Qux March 6, 1986 * * This file is in the public domain because the author published it * with no copyright notice before the US signed the Bern Convention. - * + * * With dynamic memory allocation. */ @@ -58,7 +58,7 @@ main (argc, argv) if ((fp = fopen(file, "r")) == NULL) { fprintf(stderr, "yow: "); perror(file); - exit(1); + exit(EXIT_FAILURE); } /* initialize random seed */ @@ -67,7 +67,7 @@ main (argc, argv) setup_yow(fp); yow(fp); fclose(fp); - return 0; + return EXIT_SUCCESS; } static long len = -1; @@ -95,10 +95,10 @@ setup_yow(fp) header_len = ftell(fp); if (header_len > AVG_LEN) header_len -= AVG_LEN; /* allow the first quotation to appear */ - + if (fseek(fp, 0L, 2) == -1) { perror("yow"); - exit(1); + exit(EXIT_FAILURE); } len = ftell(fp) - header_len; } @@ -117,7 +117,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. @@ -148,7 +148,7 @@ yow (fp) buf[i++] = c; while ((c = getc(fp)) != SEP && c != EOF) { buf[i++] = c; - + if (i == bufsize-1) { /* Yow! Is this quotation too long yet? */ bufsize *= 2; @@ -163,3 +163,4 @@ yow (fp) printf("%s\n", buf); } +/* yow.c ends here */