BSD 4_4 release
[unix-history] / usr / src / usr.bin / uucp / libuu / xqt.c
CommitLineData
f49909f5 1/*-
ad787160
C
2 * Copyright (c) 1985, 1993
3 * The Regents of the University of California. All rights reserved.
f49909f5 4 *
ad787160
C
5 * This module is believed to contain source code proprietary to AT&T.
6 * Use and redistribution is subject to the Berkeley Software License
7 * Agreement and your Software Agreement with AT&T (Western Electric).
f49909f5
KB
8 */
9
022c0d91 10#ifndef lint
ad787160 11static char sccsid[] = "@(#)xqt.c 8.1 (Berkeley) 6/6/93";
f49909f5 12#endif /* not lint */
022c0d91 13
022c0d91 14#include <signal.h>
bec03cca 15#include "uucp.h"
022c0d91 16
46b15d8a
RC
17int LocalOnly = 0;
18
bec03cca
JB
19/*LINTLIBRARY*/
20
46b15d8a
RC
21/*
22 * start up uucico for rmtname
022c0d91
SL
23 *
24 * return codes: none
25 */
26
46b15d8a
RC
27#ifdef VMS
28#define fork vfork
29#endif VMS
30
022c0d91
SL
31xuucico(rmtname)
32char *rmtname;
33{
34 if (fork() == 0) {
35 /* start uucico for rmtname system */
36 char opt[100];
37 close(0);
38 close(1);
39 close(2);
46b15d8a
RC
40 open(DEVNULL, 0);
41 open(DEVNULL, 1);
42 open(DEVNULL, 1);
022c0d91
SL
43 signal(SIGINT, SIG_IGN);
44 signal(SIGHUP, SIG_IGN);
45 signal(SIGQUIT, SIG_IGN);
46 signal(SIGKILL, SIG_IGN);
47 if (rmtname[0] != '\0')
bec03cca 48 sprintf(opt, "-s%s", rmtname);
022c0d91
SL
49 else
50 opt[0] = '\0';
46b15d8a
RC
51#ifndef VMS
52 if (LocalOnly)
53 execl(UUCICO, "uucico", "-r1", "-L", opt, (char *)0);
54 else
55 execl(UUCICO, "uucico", "-r1", opt, (char *)0);
56#else VMS
57 /* Under VMS/EUNICE release the batch job */
58 if (LocalOnly)
59 execl(STARTUUCP, "startuucp", "uucico", "-r1", "-L", opt, (char *)0);
60 else
61 execl(STARTUUCP, "startuucp", "uucico", "-r1", opt, (char *)0);
62#endif VMS
022c0d91
SL
63 exit(100);
64 }
46b15d8a
RC
65#ifdef VMS
66 while(wait(0) != -1)
67 ; /* Wait for it to finish!! */
68#endif VMS
022c0d91
SL
69 return;
70}
71
46b15d8a
RC
72/*
73 * start up uuxqt
022c0d91
SL
74 *
75 * return codes: none
76 */
022c0d91
SL
77xuuxqt()
78{
79 if (fork() == 0) {
80 /* start uuxqt */
81 close(0);
82 close(1);
83 close(2);
46b15d8a
RC
84 open(DEVNULL, 2);
85 open(DEVNULL, 2);
86 open(DEVNULL, 2);
022c0d91
SL
87 signal(SIGINT, SIG_IGN);
88 signal(SIGHUP, SIG_IGN);
89 signal(SIGQUIT, SIG_IGN);
90 signal(SIGKILL, SIG_IGN);
e4d19c64 91 execl(UUXQT, "uuxqt", (char *)0);
022c0d91
SL
92 exit(100);
93 }
022c0d91 94}
46b15d8a 95
022c0d91
SL
96xuucp(str)
97char *str;
98{
99 char text[300];
100 if (fork() == 0) {
101 /* start uucp */
102 close(0);
103 close(1);
104 close(2);
46b15d8a
RC
105 open(DEVNULL, 0);
106 open(DEVNULL, 1);
107 open(DEVNULL, 1);
022c0d91
SL
108 signal(SIGINT, SIG_IGN);
109 signal(SIGHUP, SIG_IGN);
110 signal(SIGQUIT, SIG_IGN);
111 signal(SIGKILL, SIG_IGN);
112 sprintf(text, "%s -r %s", UUCP, str);
46b15d8a 113 execl(SHELL, "sh", "-c", text, CNULL);
022c0d91
SL
114 exit(100);
115 }
116 sleep(15); /* Give uucp chance to finish */
022c0d91 117}