Add make-pty-a-tty for System V and use it in fork-pty-session
This commit is contained in:
parent
45acda7c3f
commit
329e4539b0
|
@ -26,6 +26,7 @@
|
|||
(move->fdes tty-in 0)
|
||||
(dup->outport tty-in 1)
|
||||
(dup->outport tty-in 2)
|
||||
(make-pty-a-tty! (current-input-port))
|
||||
; (set-port-buffering (dup->outport tty 2)
|
||||
; bufpol/none))
|
||||
(with-stdio-ports* thunk))))
|
||||
|
@ -113,3 +114,8 @@
|
|||
(set! n (- n 1)))
|
||||
(string-set! pattern n-pos (string-ref numbers n))
|
||||
(string-copy pattern))))))
|
||||
|
||||
(define (make-pty-a-tty! fd/port)
|
||||
(sleazy-call/fdes fd/port %make-pty-a-tty!))
|
||||
|
||||
(import-os-error-syscall %make-pty-a-tty! (fd) "pty2tty")
|
||||
|
|
43
scsh/tty1.c
43
scsh/tty1.c
|
@ -269,23 +269,6 @@ s48_value open_ctty(s48_value sch_ttyname, s48_value sch_flags)
|
|||
s48_value make_ctty(s48_value sch_fd)
|
||||
{
|
||||
int fd = s48_extract_fixnum (sch_fd);
|
||||
|
||||
#if defined (HAVE_ISASTREAM) && defined (I_PUSH)
|
||||
if (isastream (fd))
|
||||
{
|
||||
# if defined (I_FIND)
|
||||
# define stream_module_pushed(fd, module) (ioctl (fd, I_FIND, module) == 1)
|
||||
# else
|
||||
# define stream_module_pushed(fd, module) 0
|
||||
# endif
|
||||
if (! stream_module_pushed (fd, "ptem"))
|
||||
ioctl (fd, I_PUSH, "ptem");
|
||||
if (! stream_module_pushed (fd, "ldterm"))
|
||||
ioctl (fd, I_PUSH, "ldterm");
|
||||
if (! stream_module_pushed (fd, "ttcompat"))
|
||||
ioctl (fd, I_PUSH, "ttcompat");
|
||||
}
|
||||
#endif /* defined (HAVE_ISASTREAM) && defined (I_PUSH) */
|
||||
|
||||
#if defined(TIOCSCTTY) && !defined(CIBAUD) && !defined(__hpux)
|
||||
/* 4.3+BSD way to acquire control tty. !CIBAUD rules out SunOS.
|
||||
|
@ -298,6 +281,31 @@ s48_value make_ctty(s48_value sch_fd)
|
|||
return S48_UNSPECIFIC;
|
||||
}
|
||||
|
||||
s48_value pty2tty(s48_value sch_fd)
|
||||
{
|
||||
int fd = s48_extract_fixnum(sch_fd);
|
||||
|
||||
#if defined (HAVE_ISASTREAM) && defined (I_PUSH)
|
||||
if (isastream (fd))
|
||||
{
|
||||
# if defined (I_FIND)
|
||||
# define stream_module_pushed(fd, module) (ioctl (fd, I_FIND, module) == 1)
|
||||
# else
|
||||
# define stream_module_pushed(fd, module) 0
|
||||
# endif
|
||||
if ((! stream_module_pushed (fd, "ptem")) &&
|
||||
(ioctl (fd, I_PUSH, "ptem") < 0))
|
||||
s48_raise_os_error_1 (errno, sch_fd);
|
||||
if ((! stream_module_pushed (fd, "ldterm")) &&
|
||||
(ioctl (fd, I_PUSH, "ldterm") < 0))
|
||||
s48_raise_os_error_1 (errno, sch_fd);
|
||||
if ((! stream_module_pushed (fd, "ttcompat")) &&
|
||||
(ioctl (fd, I_PUSH, "ttcompat") < 0))
|
||||
s48_raise_os_error_1 (errno, sch_fd);
|
||||
}
|
||||
#endif /* defined (HAVE_ISASTREAM) && defined (I_PUSH) */
|
||||
return S48_UNSPECIFIC;
|
||||
}
|
||||
|
||||
s48_value sch_isatty (s48_value sch_fd)
|
||||
{
|
||||
|
@ -510,6 +518,7 @@ void s48_init_tty(void)
|
|||
S48_EXPORT_FUNCTION(sch_tcgetpgrp);
|
||||
S48_EXPORT_FUNCTION(open_ctty);
|
||||
S48_EXPORT_FUNCTION(make_ctty);
|
||||
S48_EXPORT_FUNCTION(pty2tty);
|
||||
S48_EXPORT_FUNCTION(sch_isatty);
|
||||
S48_EXPORT_FUNCTION(sch_ttyname);
|
||||
S48_EXPORT_FUNCTION(scm_ctermid);
|
||||
|
|
Loading…
Reference in New Issue