diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-03-13 14:59:16 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-03-20 23:44:59 +0800 |
| commit | fea358866596890d3effbca343fc8f62d7b5a485 (patch) | |
| tree | 4ee355f321b2e0b8e525ec8aa30a53b31f9df413 /src/main.cpp | |
| parent | 2ee35210b655bc9292cc32e4d5f3ac329836fd8a (diff) | |
misc: use EXIT_SUCCESS and EXIT_FAILURE instead of 0 and 1
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index 0ecd727..8b32a44 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,23 +38,24 @@ int main(int argc, char *argv[]) { std::vector<std::string> args{argv + 1, argv + argc}; if (args.empty()) { help(); - return 1; + + return EXIT_FAILURE; } uint16_t port = 0; for (const auto &arg : args) { if (arg == "-h" || arg == "--help") { help(); - return 0; + return EXIT_SUCCESS; } else if (std::ranges::all_of(arg, ::isdigit)) { port = std::stoi(arg); if (std::stoi(arg) < 0) { log(ERR, "Port number must be greater than 0"); - return 1; + return EXIT_FAILURE; } else if (std::stoi(arg) > 65535) { log(ERR, "Port number must be less than 65536"); - return 1; + return EXIT_FAILURE; } port = std::stoi(arg); @@ -66,7 +67,7 @@ int main(int argc, char *argv[]) { log(ERR, "Port number is required"); help(); - return 1; + return EXIT_FAILURE; } registerSignals(); @@ -78,5 +79,5 @@ int main(int argc, char *argv[]) { g_pChatServer->cleanup(); g_pChatServer.reset(); - return 0; + return EXIT_SUCCESS; } |
