From 915b208661ecac10f774d690bff792ec4f1683ee Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Sat, 11 Nov 2023 21:28:12 +0100 Subject: exit instead of return in main --- rpt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rpt.c b/rpt.c index d6adb31..d6476ad 100644 --- a/rpt.c +++ b/rpt.c @@ -207,17 +207,17 @@ main(int argc, char* argv[]) break; case 'h': print_help(); - return 0; + exit(EXIT_SUCCESS); case 'V': print_version(); - return 0; + exit(EXIT_SUCCESS); case ':': fprintf(stderr, "rpt: COUNT value missing\n"); print_usage(stderr); - return 1; /* invalid option */ + exit(EXIT_INVALID_ARG); default: print_usage(stderr); - return 1; /* invalid option */ + exit(EXIT_INVALID_ARG); } } @@ -230,7 +230,7 @@ main(int argc, char* argv[]) { fprintf(stderr, "rpt: failed to convert COUNT : '%s'\n", strcount); - return 2; + exit(EXIT_INVALID_COUNT); } } @@ -245,7 +245,7 @@ main(int argc, char* argv[]) if (poll(&pollfd, 1, 0) < 0) { perror("poll"); - return 4; + exit(EXIT_OTHER); } if (pollfd.revents & POLLIN) @@ -256,5 +256,5 @@ main(int argc, char* argv[]) if (stdin_clone) fclose(stdin_clone); - return 0; + return EXIT_SUCCESS; } -- cgit v1.2.3