Deleted Added
full compact
pty.c (116344) pty.c (121193)
1/*-
2 * Copyright (c) 1990, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 18 unchanged lines hidden (view full) ---

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1990, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 18 unchanged lines hidden (view full) ---

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/lib/libutil/pty.c 116344 2003-06-14 18:42:37Z markm $");
35__FBSDID("$FreeBSD: head/lib/libutil/pty.c 121193 2003-10-18 10:04:16Z markm $");
36
37#if defined(LIBC_SCCS) && !defined(lint)
38#if 0
39static char sccsid[] = "@(#)pty.c 8.3 (Berkeley) 5/16/94";
40#endif
41#endif /* LIBC_SCCS and not lint */
42
43#include <sys/types.h>

--- 5 unchanged lines hidden (view full) ---

49#include <grp.h>
50#include <libutil.h>
51#include <stdlib.h>
52#include <string.h>
53#include <termios.h>
54#include <unistd.h>
55
56int
36
37#if defined(LIBC_SCCS) && !defined(lint)
38#if 0
39static char sccsid[] = "@(#)pty.c 8.3 (Berkeley) 5/16/94";
40#endif
41#endif /* LIBC_SCCS and not lint */
42
43#include <sys/types.h>

--- 5 unchanged lines hidden (view full) ---

49#include <grp.h>
50#include <libutil.h>
51#include <stdlib.h>
52#include <string.h>
53#include <termios.h>
54#include <unistd.h>
55
56int
57openpty(amaster, aslave, name, termp, winp)
58 int *amaster, *aslave;
59 char *name;
60 struct termios *termp;
61 struct winsize *winp;
57openpty(int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp)
62{
63 char line[] = "/dev/ptyXX";
64 const char *cp1, *cp2;
65 int master, slave, ttygid;
66 struct group *gr;
67
68 if ((gr = getgrnam("tty")) != NULL)
69 ttygid = gr->gr_gid;

--- 30 unchanged lines hidden (view full) ---

100 }
101 }
102 }
103 errno = ENOENT; /* out of ptys */
104 return (-1);
105}
106
107int
58{
59 char line[] = "/dev/ptyXX";
60 const char *cp1, *cp2;
61 int master, slave, ttygid;
62 struct group *gr;
63
64 if ((gr = getgrnam("tty")) != NULL)
65 ttygid = gr->gr_gid;

--- 30 unchanged lines hidden (view full) ---

96 }
97 }
98 }
99 errno = ENOENT; /* out of ptys */
100 return (-1);
101}
102
103int
108forkpty(amaster, name, termp, winp)
109 int *amaster;
110 char *name;
111 struct termios *termp;
112 struct winsize *winp;
104forkpty(int *amaster, char *name, struct termios *termp, struct winsize *winp)
113{
114 int master, slave, pid;
115
116 if (openpty(&master, &slave, name, termp, winp) == -1)
117 return (-1);
118 switch (pid = fork()) {
119 case -1:
120 return (-1);

--- 15 unchanged lines hidden ---
105{
106 int master, slave, pid;
107
108 if (openpty(&master, &slave, name, termp, winp) == -1)
109 return (-1);
110 switch (pid = fork()) {
111 case -1:
112 return (-1);

--- 15 unchanged lines hidden ---