Main improved yet again.

This commit is contained in:
Emil 2023-08-02 13:53:29 -06:00
parent 2bca0f6fea
commit fda9d49998

View File

@ -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."); }
}