Загрузить файлы в «»
This commit is contained in:
parent
7a81db868b
commit
1c4180cc36
2
cfg.h
2
cfg.h
@ -10,4 +10,4 @@ char *channels[] = {"#channel"};
|
||||
#define FORMAT_HTML "[%s] %s<br>\n"
|
||||
#define FORMAT FORMAT_TXT
|
||||
|
||||
#define OUTPUT ".txt"
|
||||
#define EXT ".txt"
|
||||
|
8
main.c
8
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)
|
||||
|
Loading…
Reference in New Issue
Block a user