From fda9d499985c52667cf457c13872b8b176683e53 Mon Sep 17 00:00:00 2001 From: Emil Date: Wed, 2 Aug 2023 13:53:29 -0600 Subject: [PATCH] Main improved yet again. --- src/main.c | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/src/main.c b/src/main.c index c11583b..5001258 100644 --- a/src/main.c +++ b/src/main.c @@ -34,33 +34,26 @@ main(int argc, /* Usage */ if (argc > 5 || argc < 4) - { - ERRMSG("server port channel [username]"); - return 1; - } - else - { - /* Arguments */ - char const * username = "probotic"; - char const * server = argv[1]; - int const port = atoi(argv[2]); - channel = argv[3]; + { ERR(1, "server port channel [username]"); } + /* Arguments */ + char const * username = "probotic"; + char const * server = argv[1]; + int const port = atoi(argv[2]); + channel = argv[3]; - if (argc > 4) - { username = argv[4]; } + if (argc > 4) + { username = argv[4]; } #ifdef NDEBUG - fprintf(stderr, "-- %s:%d %s %s --\n", server, port, channel, username); + fprintf(stderr, "-- %s:%d %s %s --\n", server, port, channel, username); #endif /* NDEBUG */ - /* initialization (1 means bad , 0 mean good > ; ) */ - if (init(username, server, port)) - { return 1; } - atexit(rope); - /* We should figure out how the failure happens so we can tell the user that. */ - if (irc_run(session) != 0) - { ERR(1, "Error running IRC session\nPossible issue: bad URL," - " no network connection, bad port, refused connection."); } - return 0; - } + /* initialization (1 means bad , 0 mean good > ; ) */ + if (init(username, server, port)) + { return 1; } + atexit(rope); + /* We should figure out how the failure happens so we can tell the user that. */ + if (irc_run(session) != 0) + { ERR(1, "Error running IRC session\nPossible issue: bad URL," + " no network connection, bad port, refused connection."); } }