xref: /original-bsd/usr.bin/uucp/libuu/xqt.c (revision f238860a)
1 #ifndef lint
2 static char sccsid[] = "@(#)xqt.c	5.3 (Berkeley) 06/23/85";
3 #endif
4 
5 #include <signal.h>
6 #include "uucp.h"
7 
8 int LocalOnly = 0;
9 
10 /*LINTLIBRARY*/
11 
12 /*
13  *	start up uucico for rmtname
14  *
15  *	return codes:  none
16  */
17 
18 #ifdef	VMS
19 #define	fork	vfork
20 #endif VMS
21 
22 xuucico(rmtname)
23 char *rmtname;
24 {
25 	if (fork() == 0) {
26 		/*  start uucico for rmtname system  */
27 		char opt[100];
28 		close(0);
29 		close(1);
30 		close(2);
31 		open(DEVNULL, 0);
32 		open(DEVNULL, 1);
33 		open(DEVNULL, 1);
34 		signal(SIGINT, SIG_IGN);
35 		signal(SIGHUP, SIG_IGN);
36 		signal(SIGQUIT, SIG_IGN);
37 		signal(SIGKILL, SIG_IGN);
38 		if (rmtname[0] != '\0')
39 			sprintf(opt, "-s%s", rmtname);
40 		else
41 			opt[0] = '\0';
42 #ifndef	VMS
43 		if (LocalOnly)
44 			execl(UUCICO, "uucico", "-r1", "-L", opt, (char *)0);
45 		else
46 			execl(UUCICO, "uucico", "-r1", opt, (char *)0);
47 #else	VMS
48 		/* Under VMS/EUNICE release the batch job */
49 		if (LocalOnly)
50 			execl(STARTUUCP, "startuucp", "uucico", "-r1", "-L", opt, (char *)0);
51 		else
52 			execl(STARTUUCP, "startuucp", "uucico", "-r1", opt, (char *)0);
53 #endif	VMS
54 		exit(100);
55 	}
56 #ifdef	VMS
57 	while(wait(0) != -1)
58 		;	/* Wait for it to finish!! */
59 #endif	VMS
60 	return;
61 }
62 
63 
64 /*
65  *	start up uuxqt
66  *
67  *	return codes:  none
68  */
69 
70 xuuxqt()
71 {
72 	if (fork() == 0) {
73 		/*  start uuxqt  */
74 		close(0);
75 		close(1);
76 		close(2);
77 		open(DEVNULL, 2);
78 		open(DEVNULL, 2);
79 		open(DEVNULL, 2);
80 		signal(SIGINT, SIG_IGN);
81 		signal(SIGHUP, SIG_IGN);
82 		signal(SIGQUIT, SIG_IGN);
83 		signal(SIGKILL, SIG_IGN);
84 		execl(UUXQT, "UUXQT",  (char *)0);
85 		exit(100);
86 	}
87 	return;
88 }
89 
90 xuucp(str)
91 char *str;
92 {
93 	char text[300];
94 	if (fork() == 0) {
95 		/*  start uucp  */
96 		close(0);
97 		close(1);
98 		close(2);
99 		open(DEVNULL, 0);
100 		open(DEVNULL, 1);
101 		open(DEVNULL, 1);
102 		signal(SIGINT, SIG_IGN);
103 		signal(SIGHUP, SIG_IGN);
104 		signal(SIGQUIT, SIG_IGN);
105 		signal(SIGKILL, SIG_IGN);
106 		sprintf(text, "%s -r %s", UUCP, str);
107 		execl(SHELL, "sh", "-c", text, CNULL);
108 		exit(100);
109 	}
110 	sleep(15);	/* Give uucp chance to finish */
111 	return;
112 }
113