changeset 420:322e75a1c8b9

rvinterf/etmsync converted to use libinterf
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 27 Oct 2018 23:39:57 +0000
parents 67d683a87b1d
children ab8fb95a28da
files rvinterf/etmsync/Makefile rvinterf/etmsync/connect.c rvinterf/etmsync/launchrvif.c
diffstat 3 files changed, 14 insertions(+), 133 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/etmsync/Makefile	Sat Oct 27 23:35:10 2018 +0000
+++ b/rvinterf/etmsync/Makefile	Sat Oct 27 23:39:57 2018 +0000
@@ -4,24 +4,24 @@
 INSTBIN=/opt/freecalypso/bin
 INSTHELP=/opt/freecalypso/helpfiles
 
+LIBINTERF=	../libinterf/libinterf.a
 LIBRFTAB=	../../librftab/librftab.a
 
-DSPDUMP_OBJS=	connect.o dspapidump.o interf.o launchrvif.o memops.o \
-		simplemain.o
+DSPDUMP_OBJS=	dspapidump.o interf.o memops.o simplemain.o ${LIBINTERF}
+
+FSIO_OBJS=	cl_des.o dispatch.o fdcmd.o fileio.o fsbasics.o fscmdtab.o \
+		fserr.o fsiomain.o fsmisc.o fsnew.o fspath.o fsread.o \
+		fsupload.o fsuploadrf.o fswrite.o help.o hostmkdir.o interf.o \
+		memcmd.o memops.o pirimei.o pirmagnetite.o rfcap.o stddirs.o \
+		symlink.o ${LIBINTERF} ${LIBRFTAB}
 
-FSIO_OBJS=	cl_des.o connect.o dispatch.o fdcmd.o fileio.o fsbasics.o \
-		fscmdtab.o fserr.o fsiomain.o fsmisc.o fsnew.o fspath.o \
-		fsread.o fsupload.o fsuploadrf.o fswrite.o help.o hostmkdir.o \
-		interf.o launchrvif.o memcmd.o memops.o pirimei.o \
-		pirmagnetite.o rfcap.o stddirs.o symlink.o ${LIBRFTAB}
+MEMDUMP_OBJS=	interf.o memdump.o memops.o ${LIBINTERF}
+
+READCAL_OBJS=	hostmkdir.o interf.o l1tmops.o readcal.o ${LIBINTERF}
 
-MEMDUMP_OBJS=	connect.o interf.o launchrvif.o memdump.o memops.o
-
-READCAL_OBJS=	connect.o hostmkdir.o interf.o l1tmops.o launchrvif.o readcal.o
-
-TMSYNC_OBJS=	cl_des.o connect.o dispatch.o interf.o l1tmcmd.o l1tmops.o \
-		launchrvif.o memcmd.o memops.o piradccal.o pirimei.o \
-		tmscmdtab.o tmsmain.o ${LIBRFTAB}
+TMSYNC_OBJS=	cl_des.o dispatch.o interf.o l1tmcmd.o l1tmops.o memcmd.o \
+		memops.o piradccal.o pirimei.o tmscmdtab.o tmsmain.o \
+		${LIBINTERF} ${LIBRFTAB}
 
 all:	${PROGS}
 
--- a/rvinterf/etmsync/connect.c	Sat Oct 27 23:35:10 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Connecting to an already running rvinterf process
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <stdio.h>
-#include <string.h>
-#include <strings.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "pktmux.h"
-#include "localsock.h"
-#include "exitcodes.h"
-
-char *socket_pathname = "/tmp/rvinterf_socket";
-int sock;
-
-connect_local_socket()
-{
-	/* local socket binding voodoo copied from osmocon */
-	struct sockaddr_un local;
-	unsigned int namelen;
-	int rc;
-
-	sock = socket(AF_UNIX, SOCK_STREAM, 0);
-	if (sock < 0) {
-		perror("socket(AF_UNIX, SOCK_STREAM, 0)");
-		exit(ERROR_UNIX);
-	}
-
-	local.sun_family = AF_UNIX;
-	strncpy(local.sun_path, socket_pathname, sizeof(local.sun_path));
-	local.sun_path[sizeof(local.sun_path) - 1] = '\0';
-
-	/* we use the same magic that X11 uses in Xtranssock.c for
-	 * calculating the proper length of the sockaddr */
-#if defined(BSD44SOCKETS) || defined(__UNIXWARE__)
-	local.sun_len = strlen(local.sun_path);
-#endif
-#if defined(BSD44SOCKETS) || defined(SUN_LEN)
-	namelen = SUN_LEN(&local);
-#else
-	namelen = strlen(local.sun_path) +
-		  offsetof(struct sockaddr_un, sun_path) + 1;
-#endif
-
-	rc = connect(sock, (struct sockaddr *) &local, namelen);
-	if (rc != 0) {
-		perror(socket_pathname);
-		exit(ERROR_RVINTERF);
-	}
-
-	return(0);
-}
--- a/rvinterf/etmsync/launchrvif.c	Sat Oct 27 23:35:10 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * This module implements the optional "behind the scenes" invokation
- * of rvinterf from fc-fsio etc.
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "exitcodes.h"
-
-static char rvinterf_pathname[] = "/opt/freecalypso/bin/rvinterf";
-
-extern int sock;
-
-char *rvinterf_ttyport, *rvinterf_Bopt, *rvinterf_lopt, *rvinterf_wopt;
-
-launch_rvinterf()
-{
-	int sp[2], rc;
-	char *rvif_argv[11], Sarg[16], **ap;
-
-	rc = socketpair(AF_UNIX, SOCK_STREAM, 0, sp);
-	if (rc < 0) {
-		perror("socketpair");
-		exit(ERROR_UNIX);
-	}
-	sock = sp[0];
-	sprintf(Sarg, "-S%d", sp[1]);
-	ap = rvif_argv;
-	*ap++ = "rvinterf";
-	*ap++ = Sarg;
-	*ap++ = "-n";
-	if (rvinterf_Bopt) {
-		*ap++ = "-B";
-		*ap++ = rvinterf_Bopt;
-	}
-	if (rvinterf_lopt) {
-		*ap++ = "-l";
-		*ap++ = rvinterf_lopt;
-	}
-	if (rvinterf_wopt) {
-		*ap++ = "-w";
-		*ap++ = rvinterf_wopt;
-	}
-	*ap++ = rvinterf_ttyport;
-	*ap = 0;
-	rc = vfork();
-	if (rc < 0) {
-		perror("vfork for launching rvinterf");
-		exit(ERROR_UNIX);
-	}
-	if (!rc) {
-		/* we are in the child - do the exec */
-		close(sp[0]);
-		execv(rvinterf_pathname, rvif_argv);
-		perror(rvinterf_pathname);
-		_exit(1);
-	}
-	close(sp[1]);
-	return 0;
-}