xref: /csrg-svn/usr.bin/uucp/libuu/xqt.c (revision 17847)
113699Ssam #ifndef lint
2*17847Sralph static char sccsid[] = "@(#)xqt.c	5.2 (Berkeley) 01/22/85";
313699Ssam #endif
413699Ssam 
513699Ssam #include "uucp.h"
613699Ssam #include <signal.h>
713699Ssam 
8*17847Sralph int LocalOnly = 0;
9*17847Sralph 
10*17847Sralph /*
11*17847Sralph  *	start up uucico for rmtname
1213699Ssam  *
1313699Ssam  *	return codes:  none
1413699Ssam  */
1513699Ssam 
16*17847Sralph #ifdef	VMS
17*17847Sralph #define	fork	vfork
18*17847Sralph #endif VMS
19*17847Sralph 
2013699Ssam xuucico(rmtname)
2113699Ssam char *rmtname;
2213699Ssam {
2313699Ssam 	if (fork() == 0) {
2413699Ssam 		/*  start uucico for rmtname system  */
2513699Ssam 		char opt[100];
2613699Ssam 		close(0);
2713699Ssam 		close(1);
2813699Ssam 		close(2);
29*17847Sralph 		open(DEVNULL, 0);
30*17847Sralph 		open(DEVNULL, 1);
31*17847Sralph 		open(DEVNULL, 1);
3213699Ssam 		signal(SIGINT, SIG_IGN);
3313699Ssam 		signal(SIGHUP, SIG_IGN);
3413699Ssam 		signal(SIGQUIT, SIG_IGN);
3513699Ssam 		signal(SIGKILL, SIG_IGN);
3613699Ssam 		if (rmtname[0] != '\0')
3713699Ssam 			sprintf(opt, "-s%.7s", rmtname);
3813699Ssam 		else
3913699Ssam 			opt[0] = '\0';
40*17847Sralph #ifndef	VMS
41*17847Sralph 		if (LocalOnly)
42*17847Sralph 			execl(UUCICO, "uucico", "-r1", "-L", opt, (char *)0);
43*17847Sralph 		else
44*17847Sralph 			execl(UUCICO, "uucico", "-r1", opt, (char *)0);
45*17847Sralph #else	VMS
46*17847Sralph 		/* Under VMS/EUNICE release the batch job */
47*17847Sralph 		if (LocalOnly)
48*17847Sralph 			execl(STARTUUCP, "startuucp", "uucico", "-r1", "-L", opt, (char *)0);
49*17847Sralph 		else
50*17847Sralph 			execl(STARTUUCP, "startuucp", "uucico", "-r1", opt, (char *)0);
51*17847Sralph #endif	VMS
5213699Ssam 		exit(100);
5313699Ssam 	}
54*17847Sralph #ifdef	VMS
55*17847Sralph 	while(wait(0) != -1)
56*17847Sralph 		;	/* Wait for it to finish!! */
57*17847Sralph #endif	VMS
5813699Ssam 	return;
5913699Ssam }
6013699Ssam 
6113699Ssam 
62*17847Sralph /*
63*17847Sralph  *	start up uuxqt
6413699Ssam  *
6513699Ssam  *	return codes:  none
6613699Ssam  */
6713699Ssam 
6813699Ssam xuuxqt()
6913699Ssam {
7013699Ssam 	if (fork() == 0) {
7113699Ssam 		/*  start uuxqt  */
7213699Ssam 		close(0);
7313699Ssam 		close(1);
7413699Ssam 		close(2);
75*17847Sralph 		open(DEVNULL, 2);
76*17847Sralph 		open(DEVNULL, 2);
77*17847Sralph 		open(DEVNULL, 2);
7813699Ssam 		signal(SIGINT, SIG_IGN);
7913699Ssam 		signal(SIGHUP, SIG_IGN);
8013699Ssam 		signal(SIGQUIT, SIG_IGN);
8113699Ssam 		signal(SIGKILL, SIG_IGN);
8213699Ssam 		execl(UUXQT, "UUXQT",  (char *)0);
8313699Ssam 		exit(100);
8413699Ssam 	}
8513699Ssam 	return;
8613699Ssam }
87*17847Sralph 
8813699Ssam xuucp(str)
8913699Ssam char *str;
9013699Ssam {
9113699Ssam 	char text[300];
9213699Ssam 	if (fork() == 0) {
9313699Ssam 		/*  start uucp  */
9413699Ssam 		close(0);
9513699Ssam 		close(1);
9613699Ssam 		close(2);
97*17847Sralph 		open(DEVNULL, 0);
98*17847Sralph 		open(DEVNULL, 1);
99*17847Sralph 		open(DEVNULL, 1);
10013699Ssam 		signal(SIGINT, SIG_IGN);
10113699Ssam 		signal(SIGHUP, SIG_IGN);
10213699Ssam 		signal(SIGQUIT, SIG_IGN);
10313699Ssam 		signal(SIGKILL, SIG_IGN);
10413699Ssam 		sprintf(text, "%s -r %s", UUCP, str);
105*17847Sralph 		execl(SHELL, "sh", "-c", text, CNULL);
10613699Ssam 		exit(100);
10713699Ssam 	}
10813699Ssam 	sleep(15);	/* Give uucp chance to finish */
10913699Ssam 	return;
11013699Ssam }
111