comparison rvinterf/etmsync/launchrvif.c @ 276:909f00c15f27

more fc-fsio foundation
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 23 Feb 2014 21:31:30 +0000
parents cedf09b6b5ac
children
comparison
equal deleted inserted replaced
275:cedf09b6b5ac 276:909f00c15f27
6 #include <sys/types.h> 6 #include <sys/types.h>
7 #include <sys/socket.h> 7 #include <sys/socket.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <unistd.h> 10 #include <unistd.h>
11 #include "exitcodes.h"
11 12
12 static char rvinterf_pathname[] = "/usr/local/bin/rvinterf"; 13 static char rvinterf_pathname[] = "/usr/local/bin/rvinterf";
13 14
14 extern int sock; 15 extern int sock;
15 16
21 char *rvif_argv[11], Sarg[16], **ap; 22 char *rvif_argv[11], Sarg[16], **ap;
22 23
23 rc = socketpair(AF_UNIX, SOCK_STREAM, 0, sp); 24 rc = socketpair(AF_UNIX, SOCK_STREAM, 0, sp);
24 if (rc < 0) { 25 if (rc < 0) {
25 perror("socketpair"); 26 perror("socketpair");
26 exit(1); 27 exit(ERROR_UNIX);
27 } 28 }
28 sock = sp[0]; 29 sock = sp[0];
29 sprintf(Sarg, "-S%d", sp[1]); 30 sprintf(Sarg, "-S%d", sp[1]);
30 ap = rvif_argv; 31 ap = rvif_argv;
31 *ap++ = "rvinterf"; 32 *ap++ = "rvinterf";
46 *ap++ = rvinterf_ttyport; 47 *ap++ = rvinterf_ttyport;
47 *ap = 0; 48 *ap = 0;
48 rc = vfork(); 49 rc = vfork();
49 if (rc < 0) { 50 if (rc < 0) {
50 perror("vfork for launching rvinterf"); 51 perror("vfork for launching rvinterf");
51 exit(1); 52 exit(ERROR_UNIX);
52 } 53 }
53 if (!rc) { 54 if (!rc) {
54 /* we are in the child - do the exec */ 55 /* we are in the child - do the exec */
55 close(sp[0]); 56 close(sp[0]);
56 execv(rvinterf_pathname, rvif_argv); 57 execv(rvinterf_pathname, rvif_argv);