Browse Source

Allow specifying of the socket name to use in ckpmsg

master
Con Kolivas 10 years ago
parent
commit
4f6776a4c3
  1. 13
      src/ckpmsg.c

13
src/ckpmsg.c

@ -1,5 +1,5 @@
/* /*
* Copyright 2014 Con Kolivas * Copyright 2014-2015 Con Kolivas
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free * under the terms of the GNU General Public License as published by the Free
@ -54,15 +54,20 @@ void mkstamp(char *stamp, size_t siz)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char *name = NULL, *socket_dir = NULL, *buf = NULL; char *name = NULL, *socket_dir = NULL, *buf = NULL, *sockname = "listener";
int tmo1 = RECV_UNIX_TIMEOUT1; int tmo1 = RECV_UNIX_TIMEOUT1;
int tmo2 = RECV_UNIX_TIMEOUT2; int tmo2 = RECV_UNIX_TIMEOUT2;
bool proxy = false; bool proxy = false;
char stamp[128]; char stamp[128];
int c; int c;
while ((c = getopt(argc, argv, "n:s:pt:T:")) != -1) { while ((c = getopt(argc, argv, "N:n:s:pt:T:")) != -1) {
switch(c) { switch(c) {
/* Allows us to specify which process or socket to
* talk to. */
case 'N':
sockname = strdup(optarg);
break;
case 'n': case 'n':
name = strdup(optarg); name = strdup(optarg);
break; break;
@ -92,7 +97,7 @@ int main(int argc, char **argv)
realloc_strcat(&socket_dir, name); realloc_strcat(&socket_dir, name);
dealloc(name); dealloc(name);
trail_slash(&socket_dir); trail_slash(&socket_dir);
realloc_strcat(&socket_dir, "listener"); realloc_strcat(&socket_dir, sockname);
while (42) { while (42) {
int sockd, len; int sockd, len;

Loading…
Cancel
Save