getpty.c
initialize_slave.c
libpty.h
+init.c
logwtmp.c
open_ctty.c
open_slave.c
+Wed Aug 2 11:59:19 1995 Sam Hartman <hartmans@tertius.mit.edu>
+
+ * init.c (pty_init): New file to handle initialization--currently only error tables.
+
+ * getpty.c (pty_getpty): Reverse sense of logic tests so they work.
Tue Aug 1 08:20:06 1995 Sam Hartman <hartmans@tertius.mit.edu>
$(CC) $(CFLAGS) -c $(srcdir)/$*.c
-LIBOBJS= cleanup.o getpty.o initialize_slave.o open_ctty.o open_slave.o update_utmp.o update_wtmp.o vhangup.o void_assoc.o pty_err.o logwtmp.o
+LIBOBJS= cleanup.o getpty.o initialize_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
LIBDONE=DONE
LIB_SUBDIRS=.
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\
-logwtmp.c
+logwtmp.c init.c
CFILES=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.c logwtmp.c
+update_utmp.c update_wtmp.c vhangup.c void_assoc.c pty_err.c logwtmp.c init.c
SRCS=pty_err.h $(CFILES)
#endif
#endif
if (p) {
- if ( strlen(p) < slavelength)
+ if ( strlen(p) > slavelength)
{
close (*fd);
*fd = -1;
}
ptynum = (int)(stb.st_rdev&0xFF);
sprintf(slavebuf, "/dev/ttyp%x", ptynum);
- if ( strlen(slavebuf) < slavelength) {
+ if ( strlen(slavebuf) > slavelength) {
close(*fd);
*fd = -1;
return PTY_GETPTY_SLAVE_TOOLONG;
--- /dev/null
+/*
+ * pty_init: Initialize internal state of pty.
+ * Currently initializes error tables.
+ * Copyright 1990 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 "mit-copyright.h"
+#include <com_err.h>
+#include "libpty.h"
+#include "pty-int.h"
+
+long pty_init()
+{
+ initialize_pty_error_table();
+ return 0;
+}
#ifdef __STDC__ /* use prototypes */
+long pty_init(void);
long pty_getpty ( int *fd, char *slave, int slavelength);
long pty_open_slave (const char *slave, int *fd);
long pty_cleanup(char *slave, int pid, int update_utmp);
#else /*__STDC__*/
+long pty_init();
long pty_getpty();
long pty_open_slave();
/* Includes needed by libpty*/
#ifndef __PTY_INT_H__
#include <pty_err.h>
+#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#endif
#include <stdio.h>
-#include <sys/types.h>
+
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
/* Internal functions */
#ifdef __STDC__
+void initialize_pty_error_table(void);
long ptyint_void_association(void);
long ptyint_open_ctty (char *slave, int *fd);
void ptyint_vhangup(void);
long ptyint_void_association();
void ptyint_vhangup();
+void initialize_pty_error_table();
#endif /* __STDC__*/
#define __PTY_INT_H__