changeset 187:f5f8776f7c66

rvinterf: added -s option for changing the local socket pathname
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 24 Nov 2013 23:25:59 +0000
parents faa31a47f102
children 9f4f331ac24d
files rvinterf/lowlevel/localsock.c rvinterf/lowlevel/rvifmain.c
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/lowlevel/localsock.c	Sun Nov 24 23:18:30 2013 +0000
+++ b/rvinterf/lowlevel/localsock.c	Sun Nov 24 23:25:59 2013 +0000
@@ -13,12 +13,11 @@
 #include "../localsock.h"
 #include "client.h"
 
-static char sockpath[] = "/tmp/rvinterf_socket";
-
 int listener;
 
 extern struct client *client_head;
 extern int max_fd;
+extern char *socket_pathname;
 
 create_listener_socket()
 {
@@ -34,7 +33,7 @@
 	}
 
 	local.sun_family = AF_UNIX;
-	strncpy(local.sun_path, sockpath, sizeof(local.sun_path));
+	strncpy(local.sun_path, socket_pathname, sizeof(local.sun_path));
 	local.sun_path[sizeof(local.sun_path) - 1] = '\0';
 	unlink(local.sun_path);
 
--- a/rvinterf/lowlevel/rvifmain.c	Sun Nov 24 23:18:30 2013 +0000
+++ b/rvinterf/lowlevel/rvifmain.c	Sun Nov 24 23:25:59 2013 +0000
@@ -27,6 +27,8 @@
 int background;
 int max_fd;
 
+char *socket_pathname = "/tmp/rvinterf_socket";
+
 main(argc, argv)
 	char **argv;
 {
@@ -36,7 +38,7 @@
 	fd_set fds;
 	struct client *cli, **clip;
 
-	while ((c = getopt(argc, argv, "bB:d:l:")) != EOF)
+	while ((c = getopt(argc, argv, "bB:d:l:s:")) != EOF)
 		switch (c) {
 		case 'b':
 			background++;
@@ -50,6 +52,9 @@
 		case 'l':
 			logfname = optarg;
 			continue;
+		case 's':
+			socket_pathname = optarg;
+			continue;
 		case '?':
 		default:
 usage:			fprintf(stderr,