comparison rvinterf/libasync/launchrvif.c @ 63:09b4fd9b3827

rvinterf/libasync: use the newly adopted exit code convention
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 26 Oct 2016 22:00:39 +0000
parents fb4804f72ac0
children
comparison
equal deleted inserted replaced
62:2dd9dbe3f4a7 63:09b4fd9b3827
1 /* 1 /*
2 * This module implements the optional "behind the scenes" invokation 2 * This module implements the optional "behind the scenes" invokation
3 * of rvinterf from fc-tmsh. 3 * of rvinterf from fc-shell or fc-tmsh.
4 */ 4 */
5 5
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[] = "/opt/freecalypso/bin/rvinterf"; 13 static char rvinterf_pathname[] = "/opt/freecalypso/bin/rvinterf";
13 14
14 extern int sock; 15 extern int sock;
15 16
22 char *rvif_argv[11], Sarg[16], **ap; 23 char *rvif_argv[11], Sarg[16], **ap;
23 24
24 rc = socketpair(AF_UNIX, SOCK_STREAM, 0, sp); 25 rc = socketpair(AF_UNIX, SOCK_STREAM, 0, sp);
25 if (rc < 0) { 26 if (rc < 0) {
26 perror("socketpair"); 27 perror("socketpair");
27 exit(1); 28 exit(ERROR_UNIX);
28 } 29 }
29 sock = sp[0]; 30 sock = sp[0];
30 sprintf(Sarg, "-S%d", sp[1]); 31 sprintf(Sarg, "-S%d", sp[1]);
31 ap = rvif_argv; 32 ap = rvif_argv;
32 *ap++ = "rvinterf"; 33 *ap++ = "rvinterf";
47 *ap++ = ttyport; 48 *ap++ = ttyport;
48 *ap = 0; 49 *ap = 0;
49 rc = vfork(); 50 rc = vfork();
50 if (rc < 0) { 51 if (rc < 0) {
51 perror("vfork for launching rvinterf"); 52 perror("vfork for launching rvinterf");
52 exit(1); 53 exit(ERROR_UNIX);
53 } 54 }
54 if (!rc) { 55 if (!rc) {
55 /* we are in the child - do the exec */ 56 /* we are in the child - do the exec */
56 close(sp[0]); 57 close(sp[0]);
57 execv(rvinterf_pathname, rvif_argv); 58 execv(rvinterf_pathname, rvif_argv);