Properly take care of the underscore in command outputs

This commit is contained in:
Utkarsh Verma 2021-10-15 15:00:43 +05:30
parent 3fff34b8da
commit 22916019dc
No known key found for this signature in database
GPG Key ID: 817656CF818EFCCC

10
main.c
View File

@ -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() {