diff --git a/find/find.c b/find/find.c index 1d5a74be..4e87023d 100644 --- a/find/find.c +++ b/find/find.c @@ -30,9 +30,9 @@ #else #include #endif -#include +#include "../gnulib/lib/human.h" #include -#include +#include "../gnulib/lib/savedir.h" #ifdef HAVE_LOCALE_H #include @@ -316,7 +316,7 @@ main (int argc, char **argv) if (i == 1) process_top_path ("."); - exit (exit_status); + return exit_status; } /* Safely go back to the starting directory. */ diff --git a/locate/bigram.c b/locate/bigram.c index a4734fe8..1e78bf19 100644 --- a/locate/bigram.c +++ b/locate/bigram.c @@ -118,5 +118,5 @@ main (int argc, char **argv) free (path); free (oldpath); - exit (0); + return 0; } diff --git a/locate/code.c b/locate/code.c index aa9b181f..96f60a81 100644 --- a/locate/code.c +++ b/locate/code.c @@ -144,7 +144,7 @@ main (int argc, char **argv) { fprintf (stderr, _("Usage: %s most_common_bigrams < list > coded_list\n"), argv[0]); - exit (2); + return 2; } fp = fopen (argv[1], "r"); @@ -152,7 +152,7 @@ main (int argc, char **argv) { fprintf (stderr, "%s: ", argv[0]); perror (argv[1]); - exit (1); + return 1; } pathsize = oldpathsize = 1026; /* Increased as necessary by getline. */ @@ -229,5 +229,5 @@ main (int argc, char **argv) free (path); free (oldpath); - exit (0); + return 0; } diff --git a/locate/frcode.c b/locate/frcode.c index 6fd7cbb1..575c471d 100644 --- a/locate/frcode.c +++ b/locate/frcode.c @@ -171,5 +171,5 @@ main (int argc, char **argv) free (path); free (oldpath); - exit (0); + return 0; } diff --git a/locate/locate.c b/locate/locate.c index 0ea36c95..e433f3f6 100644 --- a/locate/locate.c +++ b/locate/locate.c @@ -465,16 +465,14 @@ extern char *version_string; char *program_name; static void -usage (stream, status) +usage (stream) FILE *stream; - int status; { fprintf (stream, _("\ Usage: %s [-d path | --database=path] [-e | --existing]\n\ [-i | --ignore-case] [--version] [--help] pattern...\n"), program_name); fputs (_("\nReport bugs to .\n"), stream); - exit (status); } static struct option const longopts[] = @@ -528,18 +526,24 @@ main (argc, argv) break; case 'h': - usage (stdout, 0); + usage (stdout); + return 0; case 'v': printf (_("GNU locate version %s\n"), version_string); - exit (0); + return 0; default: - usage (stderr, 1); + usage (stderr); + return 1; } if (optind == argc) - usage (stderr, 1); + { + usage (stderr); + return 1; + } + for (; optind < argc; optind++) { @@ -549,5 +553,8 @@ main (argc, argv) found |= locate (argv[optind], e, ignore_case); } - exit (!found); + if (found) + return 0; + else + return 1; } diff --git a/xargs/xargs.c b/xargs/xargs.c index 29717f7c..d68d58c7 100644 --- a/xargs/xargs.c +++ b/xargs/xargs.c @@ -295,7 +295,7 @@ static void add_proc PARAMS ((pid_t pid)); static void wait_for_proc PARAMS ((boolean all)); static long parse_num PARAMS ((char *str, int option, long min, long max)); static long env_size PARAMS ((char **envp)); -static void usage PARAMS ((FILE * stream, int status)); +static void usage PARAMS ((FILE * stream)); int main (int argc, char **argv) @@ -347,7 +347,8 @@ main (int argc, char **argv) break; case 'h': - usage (stdout, 0); + usage (stdout); + return 0; case 'i': if (optarg) @@ -407,10 +408,11 @@ main (int argc, char **argv) case 'v': printf (_("GNU xargs version %s\n"), version_string); - exit (0); + return 0; default: - usage (stderr, 1); + usage (stderr); + return 1; } } @@ -483,7 +485,7 @@ main (int argc, char **argv) } wait_for_proc (true); - exit (child_error); + return child_error; } #if 0 @@ -943,6 +945,7 @@ do_exec (void) execvp (cmd_argv[0], cmd_argv); error (0, errno, "%s", cmd_argv[0]); _exit (errno == ENOENT ? 127 : 126); + /*NOTREACHED*/ } add_proc (child); } @@ -1044,19 +1047,22 @@ parse_num (char *str, int option, long int min, long int max) { fprintf (stderr, _("%s: invalid number for -%c option\n"), program_name, option); - usage (stderr, 1); + usage (stderr); + exit(1); } else if (val < min) { fprintf (stderr, _("%s: value for -%c option must be >= %ld\n"), program_name, option, min); - usage (stderr, 1); + usage (stderr); + exit(1); } else if (max >= 0 && val > max) { fprintf (stderr, _("%s: value for -%c option must be < %ld\n"), program_name, option, max); - usage (stderr, 1); + usage (stderr); + exit(1); } return val; } @@ -1075,7 +1081,7 @@ env_size (char **envp) } static void -usage (FILE *stream, int status) +usage (FILE *stream) { fprintf (stream, _("\ Usage: %s [-0prtx] [-e[eof-str]] [-i[replace-str]] [-l[max-lines]]\n\ @@ -1086,5 +1092,4 @@ Usage: %s [-0prtx] [-e[eof-str]] [-i[replace-str]] [-l[max-lines]]\n\ [command [initial-arguments]]\n"), program_name); fputs (_("\nReport bugs to .\n"), stream); - exit (status); }