remove exit() from simple main()

This commit is contained in:
Michael Mann 2025-04-21 12:17:28 -04:00
parent 45a753194d
commit f08a6507dd
5 changed files with 8 additions and 16 deletions

View File

@ -133,18 +133,15 @@ main(int argc, char *argv[])
case 'h': case 'h':
show_help_header("Print the file types of capture files."); show_help_header("Print the file types of capture files.");
print_usage(stdout); print_usage(stdout);
exit(0); return EXIT_SUCCESS;
break;
case 'v': case 'v':
show_version(); show_version();
exit(0); return EXIT_SUCCESS;
break;
case '?': /* Bad flag - print usage message */ case '?': /* Bad flag - print usage message */
print_usage(stderr); print_usage(stderr);
exit(1); return EXIT_FAILURE;
break;
} }
} }

View File

@ -17,7 +17,6 @@
#include <glib.h> #include <glib.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> /* exit() */
#include "ws_attributes.h" #include "ws_attributes.h"
typedef struct _dtd_build_data_t { typedef struct _dtd_build_data_t {

View File

@ -211,7 +211,7 @@ int main(void)
except_init(); except_init();
run_tests(); run_tests();
except_deinit(); except_deinit();
exit(failed?1:0); return failed ? EXIT_FAILURE:EXIT_SUCCESS;
} }
/* /*

View File

@ -817,7 +817,7 @@ main(void)
varint_tests(); varint_tests();
zstd_tests (); zstd_tests ();
except_deinit(); except_deinit();
exit(failed?1:0); return failed ? EXIT_FAILURE : EXIT_SUCCESS;
} }
/* /*

View File

@ -53,11 +53,6 @@ static const char **lookup_keys[] = {
empty_key empty_key
}; };
static void exit_err(void) {
fprintf(stderr, "Usage: mmdbresolve -f db_file [-f db_file ...]\n");
exit(1);
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -110,7 +105,8 @@ main(int argc, char *argv[])
fflush(stdout); fflush(stdout);
if (arg_idx != argc || mmdb_count < 1) { if (arg_idx != argc || mmdb_count < 1) {
exit_err(); fprintf(stderr, "Usage: mmdbresolve -f db_file [-f db_file ...]\n");
return EXIT_FAILURE;
} }
int in_items = 0; int in_items = 0;
@ -186,7 +182,7 @@ main(int argc, char *argv[])
free(mmdbs); free(mmdbs);
return 0; return EXIT_SUCCESS;
} }
/* /*