From 1c4180cc36f585ff075821c9a13f85621e15da42 Mon Sep 17 00:00:00 2001 From: 8nlight <8nlight@disroot.org> Date: Sun, 6 Aug 2023 20:16:49 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cfg.h | 2 +- main.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cfg.h b/cfg.h index 425a097..4f6367c 100644 --- a/cfg.h +++ b/cfg.h @@ -10,4 +10,4 @@ char *channels[] = {"#channel"}; #define FORMAT_HTML "[%s] %s
\n" #define FORMAT FORMAT_TXT -#define OUTPUT ".txt" +#define EXT ".txt" diff --git a/main.c b/main.c index 15c13fc..e20af23 100644 --- a/main.c +++ b/main.c @@ -18,12 +18,12 @@ char *GetFilename(void) { //Get filename + date struct tm tm = GetTime(); - size_t filename_size = strlen(client.channel + 1) + (sizeof(tm.tm_year) * 3) + strlen(OUTPUT) + 3; + size_t filename_size = strlen(client.channel + 1) + (sizeof(tm.tm_year) * 3) + strlen(EXT) + 3; char *filename = malloc(filename_size + 1); if (filename == NULL) die("malloc returned NULL"); - snprintf(filename, filename_size, "%s-%d-%d-%d%s", client.channel + 1, tm.tm_year + 1900, tm.tm_mon, tm.tm_mday, OUTPUT); + snprintf(filename, filename_size, "%s-%d-%d-%d%s", client.channel + 1, tm.tm_year + 1900, tm.tm_mon, tm.tm_mday, EXT); return filename; } @@ -48,7 +48,7 @@ int main(void) { if (chdir(DIR)) die("Cant chdir"); - //512 - size of raw buffer (max) + //512 - size of raw buffer (max irc) IRCC_init(&client, 512); int status = IRCC_connect(&client, HOST, PORT); if (status == IRCC_ERROR) @@ -57,7 +57,7 @@ int main(void) { //Register and join in channel IRCC_register(&client, NICK); for (size_t i = 0; i < sizeof(channels) / sizeof(char *); i++) { - sleep(1); + sleep(3); size_t join_size = strlen("JOIN \r\n") + strlen(channels[i]) + 1; char *tmp = malloc(join_size); if (tmp == NULL)