From c5422c79e62f8a1417b60a3f22127396628efd10 Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Wed, 13 Sep 2023 11:24:05 -0500 Subject: client: refactor to make more sense Refactor several functions in the reference client such that they make more sense when reading. Signed-off-by: Danny Holman --- client/src/mini-rat.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/client/src/mini-rat.c b/client/src/mini-rat.c index cd521d4..53b91a5 100644 --- a/client/src/mini-rat.c +++ b/client/src/mini-rat.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -38,11 +39,8 @@ int open_connection(const char *addr, int port) { return sock; } -void hostinfo(int socket) { - send(socket, "NOT IMPLEMENTED\r\n", 17, 0); -} - -void run_exec(int socket, const char **argv) { +void run_exec(char **argv) { + const char** cargv = (const char**)argv; pid_t pid = fork(); if (pid == 0) { execvp(argv[0], argv); @@ -88,7 +86,7 @@ int main(int argc, char* argv[]) { while (1) { if (recv(socket, buffer, 4096, 0) <= 0) break; - if (handle_request(socket, buffer) == 1) + if (handle_request(buffer) == 1) break; memset(buffer, 0, 4096); } -- cgit v1.2.3