Change equality and add missing option

This commit is contained in:
Alex D. 2021-01-09 15:46:59 +00:00
parent d6491bb593
commit f9931033b4
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 5 additions and 8 deletions

View File

@ -46,7 +46,7 @@ parse_args(int argc, char** argv, Connection* conn)
unsigned long chanindex = 0;
while ((c = getopt(argc,
argv,
"V:a:p:t:N:U:R:P:q:c:k:"
"V:a:p:d:t:N:U:R:P:q:c:k:"
#ifdef UIRCD_FEATURE_LIBCONFIG
"C:"
#endif /* UIRCD_FEATURE_LIBCONFIG */
@ -56,6 +56,7 @@ parse_args(int argc, char** argv, Connection* conn)
case 'V': loglevel = atoi(optarg); break;
case 'a': allocate_copy(&conn->data.address, optarg); break;
case 'p': allocate_copy(&conn->data.service, optarg); break;
case 'd': allocate_copy(&conn->data.path, optarg); break;
case 't': conn->data.timeout = (unsigned int) atoi(optarg); break;
case 'N': allocate_copy(&conn->user.nickname, optarg); break;
case 'U': allocate_copy(&conn->user.username, optarg); break;
@ -100,7 +101,7 @@ print_help(void)
{ 'P', "str", "Password for registration", NULL },
{ 'd', "str", "Directory for logs", "current dir" },
{ 'q', "str", "Quit message", UIRCD_DEFAULT_QUITMSG },
{ 't', "uint", "Timeout duration", "20 seconds" },
{ 't', "uint", "Timeout duration", NULL },
{ 'V', "int", "Log level", "0 [LOG_FATAL]" },
{ 'c', "str", "Channel", NULL },
{ 'k', "str", "Channel key", NULL },
@ -190,12 +191,8 @@ main(int argc, char* argv[])
/* Reset all state-dependent values to empty */
memset(&buf, '\0', sizeof(buf));
buf.recv.fd = -1;
buf.send.fd = -1;
buf.fifo.fd = -1;
connection.info.l_ping = 0;
connection.info.l_pong = 0;
connection.info.l_message = 0;
buf.recv.fd = buf.send.fd = buf.fifo.fd = -1;
connection.info.l_ping = connection.info.l_pong = connection.info.l_message = 0;
if ((buf.send.fd = init_connection(&connection)) > 0) {
buf.recv.fd = buf.send.fd;