
#include<stdio.h>
#include<string.h>
#include<unistd.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<pthread.h>
#include<stdlib.h>

#include"zither.h"
#include<almemsys/almemsys.h>


/*
int put_log(char *);
*/

// V6 対応

int put_log(int fd, char *data, char * user, unsigned char * chIpadd)
{
int ret, a;
char * putlog_data = (char *)calloc(BUF_DEFLEN, sizeof(char));

ret = 0;

swap_mem(data, '\n', ' ');

putlog_data = safe_sprintf(putlog_data, BUF_MAX, "%s,%s,%s\n",
  chIpadd,
  user, data);

#ifdef DEBUG
printf("DEBUG: put_log(): ERR_LOG %s", putlog_data);
#endif

a = strlen(putlog_data);
ret = write(fd, putlog_data, a);

free(putlog_data);

return(ret);
}




