From: Dylan Lloyd Date: Sun, 29 Jan 2012 19:43:23 +0000 (-0500) Subject: Fixed bug in client which didn't send the null byte. added fork for notify-send X-Git-Url: https://disinclined.org/git/?a=commitdiff_plain;h=4579a35748c79bfdf33d3f7f654d831534238663;p=irssi-notify.git Fixed bug in client which didn't send the null byte. added fork for notify-send --- diff --git a/client.c b/client.c index 57078dc..463dd38 100644 --- a/client.c +++ b/client.c @@ -36,8 +36,8 @@ int main(int argc, char *argv[]) int rv; char s[INET6_ADDRSTRLEN]; - if (argc != 2) { - fprintf(stderr,"usage: client hostname\n"); + if (argc != 3) { + fprintf(stderr,"usage: client hostname 'message'\n"); exit(1); } @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) return 2; } - if (send(sockfd, "Hello, world!", 13, 0) == -1) + if (send(sockfd, argv[2], strlen(argv[2])+1, 0) == -1) perror("send"); printf("connected\n"); diff --git a/server.c b/server.c index 1da2bcd..df70fb4 100644 --- a/server.c +++ b/server.c @@ -122,6 +122,8 @@ int main(void) } buf[100] = '\0'; printf("server: recieved '%s'\n", buf); + if (!fork()) + execl("/home/dylan/test", "irssi", buf, NULL); close(new_fd); exit(0); }