From f451e0f88de7cfd822b32f837fb936ef43a2eccf Mon Sep 17 00:00:00 2001
From: Philippe PITTOLI
Date: Wed, 14 Dec 2016 22:56:13 +0100
Subject: [PATCH] =?UTF-8?q?rename=20+=20modifications=20pour=20que=20?=
=?UTF-8?q?=C3=A7a=20compile=20=3D>=20tcpd=20cleaned?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
{remote => tcp/app}/Makefile | 2 +-
remote/tcpdserver.c => tcp/app/tcpd.c | 2 +-
remote/tcpdserver.h => tcp/app/tcpd.h | 4 ++--
{remote => tcp}/script/testClient.sh | 0
{remote => tcp}/script/testExit.sh | 0
{remote => tcp}/script/testServer.sh | 0
{remote => tcp}/script/testTcpd.sh | 0
{remote => tcp/test}/tcpdtest.c | 28 +++++++++++++--------------
8 files changed, 18 insertions(+), 18 deletions(-)
rename {remote => tcp/app}/Makefile (89%)
rename remote/tcpdserver.c => tcp/app/tcpd.c (99%)
rename remote/tcpdserver.h => tcp/app/tcpd.h (96%)
rename {remote => tcp}/script/testClient.sh (100%)
rename {remote => tcp}/script/testExit.sh (100%)
rename {remote => tcp}/script/testServer.sh (100%)
rename {remote => tcp}/script/testTcpd.sh (100%)
rename {remote => tcp/test}/tcpdtest.c (78%)
diff --git a/remote/Makefile b/tcp/app/Makefile
similarity index 89%
rename from remote/Makefile
rename to tcp/app/Makefile
index bf7edba..a1f80f9 100644
--- a/remote/Makefile
+++ b/tcp/app/Makefile
@@ -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
diff --git a/remote/tcpdserver.c b/tcp/app/tcpd.c
similarity index 99%
rename from remote/tcpdserver.c
rename to tcp/app/tcpd.c
index 7cadde0..56c365c 100644
--- a/remote/tcpdserver.c
+++ b/tcp/app/tcpd.c
@@ -1,4 +1,4 @@
-#include "tcpdserver.h"
+#include "tcpd.h"
#include
#include
diff --git a/remote/tcpdserver.h b/tcp/app/tcpd.h
similarity index 96%
rename from remote/tcpdserver.h
rename to tcp/app/tcpd.h
index 06d9399..9cc71b8 100644
--- a/remote/tcpdserver.h
+++ b/tcp/app/tcpd.h
@@ -6,7 +6,7 @@
#include
#include
-#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
\ No newline at end of file
+#endif
diff --git a/remote/script/testClient.sh b/tcp/script/testClient.sh
similarity index 100%
rename from remote/script/testClient.sh
rename to tcp/script/testClient.sh
diff --git a/remote/script/testExit.sh b/tcp/script/testExit.sh
similarity index 100%
rename from remote/script/testExit.sh
rename to tcp/script/testExit.sh
diff --git a/remote/script/testServer.sh b/tcp/script/testServer.sh
similarity index 100%
rename from remote/script/testServer.sh
rename to tcp/script/testServer.sh
diff --git a/remote/script/testTcpd.sh b/tcp/script/testTcpd.sh
similarity index 100%
rename from remote/script/testTcpd.sh
rename to tcp/script/testTcpd.sh
diff --git a/remote/tcpdtest.c b/tcp/test/tcpdtest.c
similarity index 78%
rename from remote/tcpdtest.c
rename to tcp/test/tcpdtest.c
index 7a88870..fea5ca8 100644
--- a/remote/tcpdtest.c
+++ b/tcp/test/tcpdtest.c
@@ -1,4 +1,4 @@
-#include "../lib/communication.h"
+#include "../../lib/communication.h"
#include
#include
#include
@@ -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;
-}
\ No newline at end of file
+ return 0;
+}