foo-wm

(Archived) Experimental Zooming IPC-based WM
git clone http://milesalan.com/git/foo-wm
Log | Files | Refs | Mirror | README | LICENSE

commit dc6ef8f1c752232310a5a470734e961bd27ab62b
parent b845964d37e83c19688660c22eb27d8c488d5e5e
Author: = <miles.sandlar@gmail.com>
Date:   Tue,  4 Sep 2012 13:02:16 -0400

Include NULL byte in util, other socket bug fixes

Diffstat:
Msrc/client.c | 7+++----
Msrc/commands.c | 3++-
Msrc/util.c | 3++-
3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/client.c b/src/client.c @@ -20,12 +20,11 @@ int main(int argc, char **argv) { connect(socketFd, (struct sockaddr *)&socketAddress, sizeof(socketAddress)); send(socketFd, argv[2], strlen(argv[2]), 0); - /* Check if we recieved a response */ - while (recv(socketFd, buffer, sizeof(buffer), 0) > 0) { - printf("Buffer is %s", buffer); - } + while (recv(socketFd, buffer, sizeof(buffer), 0) > 0) + strcat(response, buffer); + printf("%s", response); /* Close and return */ close(socketFd); diff --git a/src/commands.c b/src/commands.c @@ -18,6 +18,8 @@ char * handleCommand(char * request) { i++; } + char * response = "Some arbitrary response back to the socket\0"; + if (!strcmp(tokens[0], "absorb")) absorb(tokens[1], tokens[2]); if (!strcmp(tokens[0], "containerize")) @@ -44,7 +46,6 @@ char * handleCommand(char * request) { zoom(atoi(tokens[1])); XFlush(display); - char * response = "I'm sending back to the socket\0"; return response; } diff --git a/src/util.c b/src/util.c @@ -86,5 +86,6 @@ int bytesUntilNull(char * string) { while (string[counter] != '\0') counter++; - return counter; + /* Include the NULL Byte */ + return ++counter; }