Main improved yet again.
This commit is contained in:
parent
2bca0f6fea
commit
fda9d49998
41
src/main.c
41
src/main.c
@ -34,33 +34,26 @@ main(int argc,
|
|||||||
|
|
||||||
/* Usage */
|
/* Usage */
|
||||||
if (argc > 5 || argc < 4)
|
if (argc > 5 || argc < 4)
|
||||||
{
|
{ ERR(1, "server port channel [username]"); }
|
||||||
ERRMSG("server port channel [username]");
|
/* Arguments */
|
||||||
return 1;
|
char const * username = "probotic";
|
||||||
}
|
char const * server = argv[1];
|
||||||
else
|
int const port = atoi(argv[2]);
|
||||||
{
|
channel = argv[3];
|
||||||
/* Arguments */
|
|
||||||
char const * username = "probotic";
|
|
||||||
char const * server = argv[1];
|
|
||||||
int const port = atoi(argv[2]);
|
|
||||||
channel = argv[3];
|
|
||||||
|
|
||||||
if (argc > 4)
|
if (argc > 4)
|
||||||
{ username = argv[4]; }
|
{ username = argv[4]; }
|
||||||
|
|
||||||
#ifdef NDEBUG
|
#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 */
|
#endif /* NDEBUG */
|
||||||
|
|
||||||
/* initialization (1 means bad , 0 mean good > ; ) */
|
/* initialization (1 means bad , 0 mean good > ; ) */
|
||||||
if (init(username, server, port))
|
if (init(username, server, port))
|
||||||
{ return 1; }
|
{ return 1; }
|
||||||
atexit(rope);
|
atexit(rope);
|
||||||
/* We should figure out how the failure happens so we can tell the user that. */
|
/* We should figure out how the failure happens so we can tell the user that. */
|
||||||
if (irc_run(session) != 0)
|
if (irc_run(session) != 0)
|
||||||
{ ERR(1, "Error running IRC session\nPossible issue: bad URL,"
|
{ ERR(1, "Error running IRC session\nPossible issue: bad URL,"
|
||||||
" no network connection, bad port, refused connection."); }
|
" no network connection, bad port, refused connection."); }
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user