]> git.lizzy.rs Git - bspwm.git/commitdiff
Just print the server response as is
authorBastien Dejean <nihilhill@gmail.com>
Sat, 15 Aug 2015 08:55:40 +0000 (10:55 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Sat, 15 Aug 2015 09:02:46 +0000 (11:02 +0200)
Fixes #284.

bspc.c
messages.c

diff --git a/bspc.c b/bspc.c
index feda9e379d0a9fb00a6e50304116b8af870ac1e6..416edd727a7595991a33eb28c09d24da4ef29721 100644 (file)
--- 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);
                }
        }
index 66bcd872e43f892057327616b7dd1a038f690d57..339428d53707673901a83c886404136b15a797d0 100644 (file)
@@ -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;
 }