From f99c8d0bb76dfe985cbc311d4cd66e74a3482fd7 Mon Sep 17 00:00:00 2001 From: Andreas Tonnesen Date: Wed, 17 Nov 2004 19:34:11 +0000 Subject: [PATCH] Cleanups --- gui/linux-gtk/src/ipc.c | 43 +++++----------------------------------- gui/linux-gtk/src/main.c | 2 +- 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/gui/linux-gtk/src/ipc.c b/gui/linux-gtk/src/ipc.c index 348de582..54eae8e8 100644 --- a/gui/linux-gtk/src/ipc.c +++ b/gui/linux-gtk/src/ipc.c @@ -36,43 +36,6 @@ int ipc_socket = 0; -int -ipc_get_socket() -{ - int sock; - //int flags; - - /* grab an UNIX domain socket */ - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) - { - perror("socket"); - exit(1); - } - - printf("Socket: %d\n", sock); - - /* Setting socket non-blocking */ - /* - if ((flags = fcntl(sock, F_GETFL, 0)) < 0) - { - fprintf(stderr,"Error getting socket flags!\n"); - exit(1); - } - - - if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) - { - fprintf(stderr,"Error setting socket flags!\n"); - exit(1); - } - */ - - return sock; - -} - - - int ipc_close() { @@ -98,7 +61,11 @@ ipc_connect(struct sockaddr_in *pin) connected = 0; if(!ipc_socket) - ipc_socket = ipc_get_socket(); + if((ipc_socket = socket(AF_INET, SOCK_STREAM, 0)) == -1) + { + perror("socket"); + exit(1); + } printf("Attempting connect..."); diff --git a/gui/linux-gtk/src/main.c b/gui/linux-gtk/src/main.c index 8fa208a8..30620492 100644 --- a/gui/linux-gtk/src/main.c +++ b/gui/linux-gtk/src/main.c @@ -48,7 +48,7 @@ main (int argc, char *argv[]) /* Get IP */ if ((hp = gethostbyname(argc > 1 ? argv[1] : "localhost")) == 0) { - perror("Not a valid host"); + fprintf(stderr, "Not a valid host \"%s\"\n", argv[1]); exit(1); } -- 2.20.1