diff options
author | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2023-11-11 21:28:12 +0100 |
---|---|---|
committer | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2023-11-11 21:28:12 +0100 |
commit | 915b208661ecac10f774d690bff792ec4f1683ee (patch) | |
tree | 2d87ae1a2f73b192064b5b9aa313a5c5c752ab18 | |
parent | 957af01fc24ef4fb2311431d0af9088575eba002 (diff) |
exit instead of return in main
-rw-r--r-- | rpt.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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; } |