From 6415d8624e45d9174341883ff759dca011c9c8cb Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Fri, 11 Aug 1995 20:14:00 +0000 Subject: Rename initialize_slave.c to init_slave.c git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6509 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/pty/ChangeLog | 5 +++ src/util/pty/Makefile.in | 6 +-- src/util/pty/init_slave.c | 87 +++++++++++++++++++++++++++++++++++++++++ src/util/pty/initialize_slave.c | 87 ----------------------------------------- 4 files changed, 95 insertions(+), 90 deletions(-) create mode 100644 src/util/pty/init_slave.c delete mode 100644 src/util/pty/initialize_slave.c (limited to 'src') diff --git a/src/util/pty/ChangeLog b/src/util/pty/ChangeLog index 0a3ae4167..6bb0c3423 100644 --- a/src/util/pty/ChangeLog +++ b/src/util/pty/ChangeLog @@ -1,3 +1,8 @@ +Fri Aug 11 15:49:30 1995 Sam Hartman + + * Makefile.in (CFILES): Rename initialize_slave.c to init_slave.c + so it isn't truncated in libpty.a. + Fri Aug 11 01:12:03 1995 Sam Hartman * initialize_slave.c (pty_initialize_slave): You really do need to diff --git a/src/util/pty/Makefile.in b/src/util/pty/Makefile.in index 0dccd9926..f277f76f3 100644 --- a/src/util/pty/Makefile.in +++ b/src/util/pty/Makefile.in @@ -6,7 +6,7 @@ SED = sed $(CC) $(CFLAGS) -c $(srcdir)/$*.c -LIBOBJS= cleanup.o getpty.o initialize_slave.o open_ctty.o open_slave.o \ +LIBOBJS= cleanup.o getpty.o init_slave.o open_ctty.o open_slave.o \ update_utmp.o update_wtmp.o vhangup.o void_assoc.o pty_err.o logwtmp.o init.o LIBUPDATE= $(BUILDTOP)/util/libupdate LIBDONE=DONE @@ -16,10 +16,10 @@ INSTALLFILE = cp # for pty-int.h LOCALINCLUDE=-I. -I$(srcdir) -FILES= Makefile cleanup.c getpty.c initialize_slave.c open_ctty.c open_slave.c update_utmp.c update_wtmp.c vhangup.c void_assoc.c pty_err.h pty_err.c\ +FILES= Makefile cleanup.c getpty.c init_slave.c open_ctty.c open_slave.c update_utmp.c update_wtmp.c vhangup.c void_assoc.c pty_err.h pty_err.c\ logwtmp.c init.c -CFILES=cleanup.c getpty.c initialize_slave.c open_ctty.c open_slave.c\ +CFILES=cleanup.c getpty.c init_slave.c open_ctty.c open_slave.c\ update_utmp.c update_wtmp.c vhangup.c void_assoc.c pty_err.c logwtmp.c init.c diff --git a/src/util/pty/init_slave.c b/src/util/pty/init_slave.c new file mode 100644 index 000000000..d10c9c852 --- /dev/null +++ b/src/util/pty/init_slave.c @@ -0,0 +1,87 @@ +/* + * pty_open_slave: open slave side of terminal, clearing for use. + * + * Copyright 1995 by the Massachusetts Institute of Technology. + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of + * M.I.T. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. M.I.T. makes no representations about the suitability + * of this software for any purpose. It is provided "as is" without + * express or implied warranty. + * + */ + +#include +#include "libpty.h" +#include "pty-int.h" + +long pty_initialize_slave (fd) + int fd; +{ +#if defined(POSIX_TERMIOS) && !defined(ultrix) + struct termios new_termio; +#else + struct sgttyb b; +#endif /* POSIX_TERMIOS */ + int pid; +#ifdef POSIX_SIGNALS + struct sigaction sa; + /* Initialize "sa" structure. */ + (void) sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + +#endif + +#ifdef HAVE_STREAMS +#ifdef HAVE_LINE_PUSH + while (ioctl (fd, I_POP, 0) == 0); /*Clear out any old lined's*/ + + if (line_push(fd) < 0) + { + (void) close(fd); fd = -1; + return PTY_OPEN_SLAVE_LINE_PUSHFAIL; + } +#else /*No line_push */ +#ifdef sun + if (ioctl(fd, I_PUSH, "ptem") < 0) + return PTY_OPEN_SLAVE_PUSH_FAIL; + if (ioctl(fd, I_PUSH, "ldterm") < 0) + return PTY_OPEN_SLAVE_PUSH_FAIL; + if (ioctl(fd, I_PUSH, "ttcompat") < 0) + return PTY_OPEN_SLAVE_PUSH_FAIL; + +#endif /*SUN*/ +#endif /*LINE_PUSH*/ +#endif /*HAVE_STREAMS*/ + + /* + * Under Ultrix 3.0, the pgrp of the slave pty terminal + * needs to be set explicitly. Why rlogind works at all + * without this on 4.3BSD is a mystery. + */ +#ifdef GETPGRP_ONEARG + pid = getpgrp(getpid()); +#else + pid = getpgrp(); +#endif + +#ifdef TIOCSPGRP + ioctl(fd, TIOCSPGRP, &pid); +#endif + + +#if defined(POSIX_TERMIOS) && !defined(ultrix) + tcsetpgrp(fd, pid); + tcgetattr(fd,&new_termio); + new_termio.c_cc[VMIN] = 1; + new_termio.c_cc[VTIME] = 0; + tcsetattr(fd,TCSANOW,&new_termio); +#endif /* POSIX_TERMIOS */ + + return 0; +} diff --git a/src/util/pty/initialize_slave.c b/src/util/pty/initialize_slave.c deleted file mode 100644 index d10c9c852..000000000 --- a/src/util/pty/initialize_slave.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * pty_open_slave: open slave side of terminal, clearing for use. - * - * Copyright 1995 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that the above copyright notice appear in all - * copies and that both that copyright notice and this permission - * notice appear in supporting documentation, and that the name of - * M.I.T. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. M.I.T. makes no representations about the suitability - * of this software for any purpose. It is provided "as is" without - * express or implied warranty. - * - */ - -#include -#include "libpty.h" -#include "pty-int.h" - -long pty_initialize_slave (fd) - int fd; -{ -#if defined(POSIX_TERMIOS) && !defined(ultrix) - struct termios new_termio; -#else - struct sgttyb b; -#endif /* POSIX_TERMIOS */ - int pid; -#ifdef POSIX_SIGNALS - struct sigaction sa; - /* Initialize "sa" structure. */ - (void) sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - -#endif - -#ifdef HAVE_STREAMS -#ifdef HAVE_LINE_PUSH - while (ioctl (fd, I_POP, 0) == 0); /*Clear out any old lined's*/ - - if (line_push(fd) < 0) - { - (void) close(fd); fd = -1; - return PTY_OPEN_SLAVE_LINE_PUSHFAIL; - } -#else /*No line_push */ -#ifdef sun - if (ioctl(fd, I_PUSH, "ptem") < 0) - return PTY_OPEN_SLAVE_PUSH_FAIL; - if (ioctl(fd, I_PUSH, "ldterm") < 0) - return PTY_OPEN_SLAVE_PUSH_FAIL; - if (ioctl(fd, I_PUSH, "ttcompat") < 0) - return PTY_OPEN_SLAVE_PUSH_FAIL; - -#endif /*SUN*/ -#endif /*LINE_PUSH*/ -#endif /*HAVE_STREAMS*/ - - /* - * Under Ultrix 3.0, the pgrp of the slave pty terminal - * needs to be set explicitly. Why rlogind works at all - * without this on 4.3BSD is a mystery. - */ -#ifdef GETPGRP_ONEARG - pid = getpgrp(getpid()); -#else - pid = getpgrp(); -#endif - -#ifdef TIOCSPGRP - ioctl(fd, TIOCSPGRP, &pid); -#endif - - -#if defined(POSIX_TERMIOS) && !defined(ultrix) - tcsetpgrp(fd, pid); - tcgetattr(fd,&new_termio); - new_termio.c_cc[VMIN] = 1; - new_termio.c_cc[VTIME] = 0; - tcsetattr(fd,TCSANOW,&new_termio); -#endif /* POSIX_TERMIOS */ - - return 0; -} -- cgit