From: Bastien Dejean Date: Sat, 15 Aug 2015 08:55:40 +0000 (+0200) Subject: Just print the server response as is X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=5f74f080b3b864b14a8461f7ddb7caac97a17a79;p=bspwm.git Just print the server response as is Fixes #284. --- diff --git a/bspc.c b/bspc.c index feda9e3..416edd7 100644 --- a/bspc.c +++ b/bspc.c @@ -73,9 +73,8 @@ int main(int argc, char *argv[]) if (send(fd, msg, msg_len, 0) == -1) err("Failed to send the data.\n"); - int ret = 0, nb, p; + int ret = 0, nb; while ((nb = recv(fd, rsp, sizeof(rsp)-1, 0)) > 0) { - int peek = recv(fd, &p, 1, MSG_PEEK); if (nb == 1 && rsp[0] < MSG_LENGTH) { ret = rsp[0]; if (ret == MSG_UNKNOWN) { @@ -84,15 +83,8 @@ int main(int argc, char *argv[]) warn("Invalid syntax.\n"); } } else { - rsp[nb--] = '\0'; - if (peek > 0) { - printf("%s", rsp); - } else { - while (nb >= 0 && isspace(rsp[nb])) { - rsp[nb--] = '\0'; - } - printf("%s\n", rsp); - } + rsp[nb] = '\0'; + printf("%s", rsp); fflush(stdout); } } diff --git a/messages.c b/messages.c index 66bcd87..339428d 100644 --- a/messages.c +++ b/messages.c @@ -1148,6 +1148,7 @@ int get_setting(coordinates_t loc, char *name, FILE* rsp) #undef GETBOOL else return MSG_FAILURE; + fprintf(rsp, "\n"); return MSG_SUCCESS; }