diff options
Diffstat (limited to 'alarm-tools')
-rw-r--r-- | alarm-tools/alarms-show.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/alarm-tools/alarms-show.c b/alarm-tools/alarms-show.c index 7613489..3af493d 100644 --- a/alarm-tools/alarms-show.c +++ b/alarm-tools/alarms-show.c @@ -67,19 +67,23 @@ int dump_alarms(int sock) return 0; } -int main(void) +int main(int argc, char **argv) { int sock = 0; - char buffer[128]; struct sockaddr_un server; + if (argc != 2) { + fprintf(stderr, "Syntax: %s socket_name\n", argv[0]); + return 1; + } + if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { perror("socket"); return 1; } server.sun_family = AF_UNIX; - strcpy(server.sun_path, "/home/david/alarmd_sock"); + strcpy(server.sun_path, argv[1]); printf("Connecting...\n"); if (connect(sock, (struct sockaddr *)&server, strlen(server.sun_path) + sizeof(server.sun_family)) < 0) { close(sock); |