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