rename + modifications pour que ça compile => tcpd cleaned
This commit is contained in:
parent
fc44447e27
commit
f451e0f88d
@ -3,7 +3,7 @@ CFLAGS=-Wall -g
|
||||
LDFLAGS= -pthread
|
||||
CFILES=$(wildcard *.c) # CFILES => recompiles everything on a C file change
|
||||
EXEC=$(basename $(wildcard *.c))
|
||||
SOURCES=$(wildcard ../lib/communication.c ../lib/process.c)
|
||||
SOURCES=$(wildcard ../../lib/communication.c ../../lib/process.c)
|
||||
OBJECTS=$(SOURCES:.c=.o)
|
||||
TESTS=$(addsuffix .test, $(EXEC))
|
||||
LCBOR=-lbor
|
@ -1,4 +1,4 @@
|
||||
#include "tcpdserver.h"
|
||||
#include "tcpd.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
@ -6,7 +6,7 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "../lib/communication.h"
|
||||
#include "../../lib/communication.h"
|
||||
|
||||
typedef struct {
|
||||
struct sockaddr_in c_addr;
|
||||
@ -55,4 +55,4 @@ void request_print (const info_request *req);
|
||||
void main_loop(struct service *srv);
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
#include "../lib/communication.h"
|
||||
#include "../../lib/communication.h"
|
||||
#include <pthread.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
@ -9,16 +9,16 @@
|
||||
do { perror(msg); exit(EXIT_FAILURE); } while (0)
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
char *srv_message = malloc(1024);
|
||||
char *pidfile = malloc(1024);
|
||||
char *buffer = malloc(1024);
|
||||
char *srv_message = malloc(BUFSIZ);
|
||||
char *pidfile = malloc(BUFSIZ);
|
||||
char *buffer = malloc(BUFSIZ);
|
||||
|
||||
snprintf(srv_message , 1024, "%s %d 1 1" ,"connect 127.0.0.1 6000" , getpid());
|
||||
snprintf(pidfile, 1024,"%s%d-1-1", "/tmp/ipc/", getpid());
|
||||
snprintf(srv_message, BUFSIZ, "%s %d 1 1", "connect 127.0.0.1 6000", getpid());
|
||||
snprintf(pidfile, BUFSIZ, "%s%d-1-1", "/tmp/ipc/", getpid());
|
||||
|
||||
char *proc_message = "hello frero";
|
||||
|
||||
int sfd;
|
||||
int sfd;
|
||||
struct sockaddr_un my_addr;
|
||||
socklen_t peer_addr_size;
|
||||
|
||||
@ -33,10 +33,10 @@ int main(int argc, char * argv[]) {
|
||||
|
||||
peer_addr_size = sizeof(struct sockaddr_un);
|
||||
if(connect(sfd,(struct sockaddr *) &my_addr, peer_addr_size) == -1)
|
||||
{
|
||||
perror("connect()");
|
||||
exit(errno);
|
||||
}
|
||||
{
|
||||
perror("connect()");
|
||||
exit(errno);
|
||||
}
|
||||
//printf("connected...\n");
|
||||
file_write(sfd, srv_message, strlen(srv_message));
|
||||
//printf("%s\n", proc_message);
|
||||
@ -59,8 +59,8 @@ int main(int argc, char * argv[]) {
|
||||
// perror("connect()");
|
||||
// exit(errno);
|
||||
// }
|
||||
|
||||
|
||||
// close(cfd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user