xref: /csrg-svn/usr.bin/uucp/libuu/xqt.c (revision 23694)
113699Ssam #ifndef lint
2*23694Sbloom static char sccsid[] = "@(#)xqt.c	5.3 (Berkeley) 06/23/85";
313699Ssam #endif
413699Ssam 
5*23694Sbloom #include <signal.h>
613699Ssam #include "uucp.h"
713699Ssam 
817847Sralph int LocalOnly = 0;
917847Sralph 
10*23694Sbloom /*LINTLIBRARY*/
11*23694Sbloom 
1217847Sralph /*
1317847Sralph  *	start up uucico for rmtname
1413699Ssam  *
1513699Ssam  *	return codes:  none
1613699Ssam  */
1713699Ssam 
1817847Sralph #ifdef	VMS
1917847Sralph #define	fork	vfork
2017847Sralph #endif VMS
2117847Sralph 
2213699Ssam xuucico(rmtname)
2313699Ssam char *rmtname;
2413699Ssam {
2513699Ssam 	if (fork() == 0) {
2613699Ssam 		/*  start uucico for rmtname system  */
2713699Ssam 		char opt[100];
2813699Ssam 		close(0);
2913699Ssam 		close(1);
3013699Ssam 		close(2);
3117847Sralph 		open(DEVNULL, 0);
3217847Sralph 		open(DEVNULL, 1);
3317847Sralph 		open(DEVNULL, 1);
3413699Ssam 		signal(SIGINT, SIG_IGN);
3513699Ssam 		signal(SIGHUP, SIG_IGN);
3613699Ssam 		signal(SIGQUIT, SIG_IGN);
3713699Ssam 		signal(SIGKILL, SIG_IGN);
3813699Ssam 		if (rmtname[0] != '\0')
39*23694Sbloom 			sprintf(opt, "-s%s", rmtname);
4013699Ssam 		else
4113699Ssam 			opt[0] = '\0';
4217847Sralph #ifndef	VMS
4317847Sralph 		if (LocalOnly)
4417847Sralph 			execl(UUCICO, "uucico", "-r1", "-L", opt, (char *)0);
4517847Sralph 		else
4617847Sralph 			execl(UUCICO, "uucico", "-r1", opt, (char *)0);
4717847Sralph #else	VMS
4817847Sralph 		/* Under VMS/EUNICE release the batch job */
4917847Sralph 		if (LocalOnly)
5017847Sralph 			execl(STARTUUCP, "startuucp", "uucico", "-r1", "-L", opt, (char *)0);
5117847Sralph 		else
5217847Sralph 			execl(STARTUUCP, "startuucp", "uucico", "-r1", opt, (char *)0);
5317847Sralph #endif	VMS
5413699Ssam 		exit(100);
5513699Ssam 	}
5617847Sralph #ifdef	VMS
5717847Sralph 	while(wait(0) != -1)
5817847Sralph 		;	/* Wait for it to finish!! */
5917847Sralph #endif	VMS
6013699Ssam 	return;
6113699Ssam }
6213699Ssam 
6313699Ssam 
6417847Sralph /*
6517847Sralph  *	start up uuxqt
6613699Ssam  *
6713699Ssam  *	return codes:  none
6813699Ssam  */
6913699Ssam 
7013699Ssam xuuxqt()
7113699Ssam {
7213699Ssam 	if (fork() == 0) {
7313699Ssam 		/*  start uuxqt  */
7413699Ssam 		close(0);
7513699Ssam 		close(1);
7613699Ssam 		close(2);
7717847Sralph 		open(DEVNULL, 2);
7817847Sralph 		open(DEVNULL, 2);
7917847Sralph 		open(DEVNULL, 2);
8013699Ssam 		signal(SIGINT, SIG_IGN);
8113699Ssam 		signal(SIGHUP, SIG_IGN);
8213699Ssam 		signal(SIGQUIT, SIG_IGN);
8313699Ssam 		signal(SIGKILL, SIG_IGN);
8413699Ssam 		execl(UUXQT, "UUXQT",  (char *)0);
8513699Ssam 		exit(100);
8613699Ssam 	}
8713699Ssam 	return;
8813699Ssam }
8917847Sralph 
9013699Ssam xuucp(str)
9113699Ssam char *str;
9213699Ssam {
9313699Ssam 	char text[300];
9413699Ssam 	if (fork() == 0) {
9513699Ssam 		/*  start uucp  */
9613699Ssam 		close(0);
9713699Ssam 		close(1);
9813699Ssam 		close(2);
9917847Sralph 		open(DEVNULL, 0);
10017847Sralph 		open(DEVNULL, 1);
10117847Sralph 		open(DEVNULL, 1);
10213699Ssam 		signal(SIGINT, SIG_IGN);
10313699Ssam 		signal(SIGHUP, SIG_IGN);
10413699Ssam 		signal(SIGQUIT, SIG_IGN);
10513699Ssam 		signal(SIGKILL, SIG_IGN);
10613699Ssam 		sprintf(text, "%s -r %s", UUCP, str);
10717847Sralph 		execl(SHELL, "sh", "-c", text, CNULL);
10813699Ssam 		exit(100);
10913699Ssam 	}
11013699Ssam 	sleep(15);	/* Give uucp chance to finish */
11113699Ssam 	return;
11213699Ssam }
113