Commit 0f4ed577 authored by stettberger's avatar stettberger

_GNU_SOURCE

parent ee54ea37
......@@ -20,6 +20,10 @@
*
*/
/* We like GNU :) */
#define _GNU_SOURCE
#include <silcincludes.h> /* Mandatory include for SILC applications */
#include <silcclient.h> /* SILC Client Library API */
#include <silcmime.h>
......@@ -27,11 +31,13 @@
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <signal.h>
#include <errno.h>
#include <getopt.h>
#include <dirent.h>
#include <time.h>
/* {{{ Structs, Globals Declarations */
#define VERSION "0.1"
......@@ -632,25 +638,29 @@ static void print_out(char *channel, char *buf, ...)
FILE *out;
static char buft[8];
time_t t = time(0);
char tmp[4096]; /* I Know a dirty hack :-\ */
char *tmp;
char *msg;
va_list va;
va_start(va, buf);
/* Ausgabestring vorbereiten */
create_filepath(outfile, sizeof(outfile), channel, "out");
out = fopen(outfile, "a");
#ifndef _GNU_SOURCE
tmp=malloc(4097);
NULL_TEST(tmp);
/* Outputstring */
vsnprintf(tmp, 4096, buf, va);
#else
vasprintf(&tmp, buf, va);
#endif
Utf8ToLocal(tmp, &msg);
create_filepath(outfile, sizeof(outfile), channel, "out");
out = fopen(outfile, "a");
strftime(buft, sizeof(buft), "%R ", localtime(&t));
/* Output */
fprintf(out, buft);
fprintf(out, msg);
putc('\n', out);
fprintf(out, "%s%s\n",buft, msg);
fclose(out);
free(msg);
free(tmp);
va_end(va);
}
/* }}} */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment