From 0a8421fa4c4bc5934bfee606f13a7466b0ff8dd1 Mon Sep 17 00:00:00 2001 From: ALittlePatate Date: Sat, 20 Jan 2024 18:10:36 +0100 Subject: [PATCH] add: "end" to quit the program --- tests/lib_use.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/lib_use.c b/tests/lib_use.c index f19b088..303975e 100644 --- a/tests/lib_use.c +++ b/tests/lib_use.c @@ -1,3 +1,6 @@ +/* This example shows how you can connect to a server, */ +/* and send the output of the program through a socket.*/ + #include "../include/pasm.h" #include #include @@ -43,6 +46,8 @@ int main() { buffer[bytesRead] = '\0'; // Null-terminate the received data if (bytesRead > 0 && buffer[bytesRead - 1] == '\n') buffer[bytesRead - 1] = '\0'; //deletes \n + if (strcmp(buffer, "end") == 0) + break; printf("script path: %s\n", buffer); pasm_run_script(buffer, 0, 0, clientSocket); //considering buffer is the path of a valid .pasm script }