From 22916019dcf1480b09dfc58c974627d5b55c5c81 Mon Sep 17 00:00:00 2001 From: Utkarsh Verma Date: Fri, 15 Oct 2021 15:00:43 +0530 Subject: [PATCH] Properly take care of the underscore in command outputs --- main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index 3e910a3..62ea485 100644 --- a/main.c +++ b/main.c @@ -78,7 +78,6 @@ int getStatus(char* new, char* old) { } void updateBlock(int i) { - char* output = outputs[i]; char buffer[LEN(outputs[0])]; int bytesRead = read(pipes[i][0], buffer, LEN(buffer)); buffer[bytesRead - 1] = '\0'; @@ -90,10 +89,13 @@ void updateBlock(int i) { ; } - if (blocks[i].signal > 0) - buffer[0] = blocks[i].signal; + char* output = outputs[i]; + if (blocks[i].signal > 0) { + output[0] = blocks[i].signal; + output++; + } - strcpy(output, buffer); + strcpy(output, buffer + 1); } void debug() {