rendered paste body#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <string.h>
#include "globales.h"
#include "log.h"
#define LG_BUFFER 512
char rbuffer[LG_BUFFER];
char wbuffer[LG_BUFFER];
int read_socket ()
{
int offset = 0;
int mon_n = 0;
int i,z;
while (! mon_n) {
z = recv(sockfd, rbuffer+offset, LG_BUFFER, 0);
if (z == -1) {
perror("read");
exit(EXIT_FAILURE);
}
if (z > 0) {
offset += z;
for (i=0; i+1 < z && rbuffer[i] != '\r' && rbuffer[i+1] != '\n'; i++){
fprintf(stdout, "%c", rbuffer[i]);
}
}
}
return 0;
}