8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / bnu / xqt.c
blob91e9e78758c8434ec1d000f3125921c5e63a6294
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 1988 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
30 * Copyright (c) 2016 by Delphix. All rights reserved.
34 #pragma ident "%Z%%M% %I% %E% SMI"
36 #include "uucp.h"
38 static void euucico();
41 * start up uucico for rmtname
42 * return:
43 * none
45 void
46 xuucico(rmtname)
47 char *rmtname;
50 * start uucico for rmtname system
52 if (fork() == 0) { /* can't vfork() */
54 * hide the uid of the initiator of this job so that it
55 * doesn't get notified about things that don't concern it.
57 (void) setuid(geteuid());
58 euucico(rmtname);
60 return;
63 static void
64 euucico(rmtname)
65 char *rmtname;
67 char opt[100];
69 (void) close(0);
70 (void) close(1);
71 (void) close(2);
72 (void) open("/dev/null", 0);
73 (void) open("/dev/null", 1);
74 (void) open("/dev/null", 1);
75 (void) signal(SIGINT, SIG_IGN);
76 (void) signal(SIGHUP, SIG_IGN);
77 (void) signal(SIGQUIT, SIG_IGN);
78 ucloselog();
79 if (rmtname[0] != '\0')
80 (void) sprintf(opt, "-s%s", rmtname);
81 else
82 opt[0] = '\0';
83 (void) execle(UUCICO, "UUCICO", "-r1", opt, (char *) 0, Env);
84 exit(100);
89 * start up uuxqt
90 * return:
91 * none
93 void
94 xuuxqt(rmtname)
95 char *rmtname;
97 char opt[100];
98 register int i, maxfiles;
100 if (rmtname && rmtname[0] != '\0')
101 (void) sprintf(opt, "-s%s", rmtname);
102 else
103 opt[0] = '\0';
105 * start uuxqt
107 if (vfork() == 0) {
108 (void) close(0);
109 (void) close(1);
110 (void) close(2);
111 (void) open("/dev/null", 2);
112 (void) open("/dev/null", 2);
113 (void) open("/dev/null", 2);
114 (void) signal(SIGINT, SIG_IGN);
115 (void) signal(SIGHUP, SIG_IGN);
116 (void) signal(SIGQUIT, SIG_IGN);
117 ucloselog();
118 #ifdef ATTSVR3
119 maxfiles = ulimit(4, 0);
120 #else /* !ATTSVR3 */
121 #ifdef BSD4_2
122 maxfiles = getdtablesize();
123 #else /* BSD4_2 */
124 maxfiles = NOFILE;
125 #endif /* BSD4_2 */
126 #endif /* ATTSVR3 */
127 for (i = 3; i < maxfiles; i++)
128 (void) close(i);
130 * hide the uid of the initiator of this job so that it
131 * doesn't get notified about things that don't concern it.
133 (void) setuid(geteuid());
134 (void) execle(UUXQT, "UUXQT", opt, (char *) 0, Env);
135 _exit(100);
137 return;