148652Sbostic /*-
2*62386Sbostic * Copyright (c) 1985, 1993
3*62386Sbostic * The Regents of the University of California. All rights reserved.
448652Sbostic *
548652Sbostic * %sccs.include.proprietary.c%
648652Sbostic */
748652Sbostic
813699Ssam #ifndef lint
9*62386Sbostic static char sccsid[] = "@(#)xqt.c 8.1 (Berkeley) 06/06/93";
1048652Sbostic #endif /* not lint */
1113699Ssam
1223694Sbloom #include <signal.h>
1313699Ssam #include "uucp.h"
1413699Ssam
1517847Sralph int LocalOnly = 0;
1617847Sralph
1723694Sbloom /*LINTLIBRARY*/
1823694Sbloom
1917847Sralph /*
2017847Sralph * start up uucico for rmtname
2113699Ssam *
2213699Ssam * return codes: none
2313699Ssam */
2413699Ssam
2517847Sralph #ifdef VMS
2617847Sralph #define fork vfork
2717847Sralph #endif VMS
2817847Sralph
xuucico(rmtname)2913699Ssam xuucico(rmtname)
3013699Ssam char *rmtname;
3113699Ssam {
3213699Ssam if (fork() == 0) {
3313699Ssam /* start uucico for rmtname system */
3413699Ssam char opt[100];
3513699Ssam close(0);
3613699Ssam close(1);
3713699Ssam close(2);
3817847Sralph open(DEVNULL, 0);
3917847Sralph open(DEVNULL, 1);
4017847Sralph open(DEVNULL, 1);
4113699Ssam signal(SIGINT, SIG_IGN);
4213699Ssam signal(SIGHUP, SIG_IGN);
4313699Ssam signal(SIGQUIT, SIG_IGN);
4413699Ssam signal(SIGKILL, SIG_IGN);
4513699Ssam if (rmtname[0] != '\0')
4623694Sbloom sprintf(opt, "-s%s", rmtname);
4713699Ssam else
4813699Ssam opt[0] = '\0';
4917847Sralph #ifndef VMS
5017847Sralph if (LocalOnly)
5117847Sralph execl(UUCICO, "uucico", "-r1", "-L", opt, (char *)0);
5217847Sralph else
5317847Sralph execl(UUCICO, "uucico", "-r1", opt, (char *)0);
5417847Sralph #else VMS
5517847Sralph /* Under VMS/EUNICE release the batch job */
5617847Sralph if (LocalOnly)
5717847Sralph execl(STARTUUCP, "startuucp", "uucico", "-r1", "-L", opt, (char *)0);
5817847Sralph else
5917847Sralph execl(STARTUUCP, "startuucp", "uucico", "-r1", opt, (char *)0);
6017847Sralph #endif VMS
6113699Ssam exit(100);
6213699Ssam }
6317847Sralph #ifdef VMS
6417847Sralph while(wait(0) != -1)
6517847Sralph ; /* Wait for it to finish!! */
6617847Sralph #endif VMS
6713699Ssam return;
6813699Ssam }
6913699Ssam
7017847Sralph /*
7117847Sralph * start up uuxqt
7213699Ssam *
7313699Ssam * return codes: none
7413699Ssam */
xuuxqt()7513699Ssam xuuxqt()
7613699Ssam {
7713699Ssam if (fork() == 0) {
7813699Ssam /* start uuxqt */
7913699Ssam close(0);
8013699Ssam close(1);
8113699Ssam close(2);
8217847Sralph open(DEVNULL, 2);
8317847Sralph open(DEVNULL, 2);
8417847Sralph open(DEVNULL, 2);
8513699Ssam signal(SIGINT, SIG_IGN);
8613699Ssam signal(SIGHUP, SIG_IGN);
8713699Ssam signal(SIGQUIT, SIG_IGN);
8813699Ssam signal(SIGKILL, SIG_IGN);
8934177Srick execl(UUXQT, "uuxqt", (char *)0);
9013699Ssam exit(100);
9113699Ssam }
9213699Ssam }
9317847Sralph
xuucp(str)9413699Ssam xuucp(str)
9513699Ssam char *str;
9613699Ssam {
9713699Ssam char text[300];
9813699Ssam if (fork() == 0) {
9913699Ssam /* start uucp */
10013699Ssam close(0);
10113699Ssam close(1);
10213699Ssam close(2);
10317847Sralph open(DEVNULL, 0);
10417847Sralph open(DEVNULL, 1);
10517847Sralph open(DEVNULL, 1);
10613699Ssam signal(SIGINT, SIG_IGN);
10713699Ssam signal(SIGHUP, SIG_IGN);
10813699Ssam signal(SIGQUIT, SIG_IGN);
10913699Ssam signal(SIGKILL, SIG_IGN);
11013699Ssam sprintf(text, "%s -r %s", UUCP, str);
11117847Sralph execl(SHELL, "sh", "-c", text, CNULL);
11213699Ssam exit(100);
11313699Ssam }
11413699Ssam sleep(15); /* Give uucp chance to finish */
11513699Ssam }
116