commit c009e2aca51c9011e74cd5e084f3752f82a9f82d
parent 4039acfc61c5d22db371970b44bfc8607f269e18
Author: Dominik Schmidt <dominik@schm1dt.ch>
Date: Tue, 23 Jul 2019 15:47:46 +0200
Ignore trailing newline when calling getline
This makes matching against command codes on siproc-stdin easier (and work)
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/src/siproc.cpp b/src/siproc.cpp
@@ -423,6 +423,7 @@ int main(int argc, char **argv){
if(ptr == &line_length){
ssize_t bytes = getline(&line, &line_length, stdin);
if(bytes > 0){
+ line[--bytes]='\0';
printf("Got line with length %lu:\n", bytes);
fwrite(line, 1, bytes, stdout);
if(strncmp(line, "QUIT", line_length)==0){