[comp.unix.questions] Sockets and psudo keybaords

acm119@flora.ccs.northeastern.edu (Brad Goodman) (08/29/90)

	Does anyone know how to work with sockets and psudeo
	keyboards? I am trying to allow a connection over an
	opened Internet Socket to fork over to a user program.
	I am able to deal with accept requests and such things
	from a socket, however the problem lies in attempting
	to link the socket with a psudeo keyboard, so I can
	use standard termio/ioctl calls with the socket, to
	properly condition the infromation being passed from
	the socket to the forked process.

	It deals with: pty termio ioctl ldterm ttcompt
	[in the MAN pages.]

	I am a bit lost with this. Can anyone help? It is
	the same type of thing that is done when the
	in.telnetd and rlogind (daemon programs,) make a 
	connection from a remote user to connect them to 
	they're shell.

						-Brad Goodman

	bkgoodman%lynx@helios.northeastern.edu
	acm119@flora.ccs.northeastern.edu

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (08/29/90)

In article <24313@adm.BRL.MIL> acm119@flora.ccs.northeastern.edu (Brad Goodman) writes:
> 	Does anyone know how to work with sockets and psudeo
> 	keyboards? I am trying to allow a connection over an
> 	opened Internet Socket to fork over to a user program.
> 	I am able to deal with accept requests and such things
> 	from a socket, however the problem lies in attempting
> 	to link the socket with a psudeo keyboard, so I can
> 	use standard termio/ioctl calls with the socket, to
> 	properly condition the infromation being passed from
> 	the socket to the forked process.

You could pick up my pty program, which does the job for you. (You
appear to be using a Sun. pty currently works on any BSD variant.)
``pty foo'' runs foo under a pseudo-terminal. There are a lot of
options; enclosed is the output of pty -H.

---Dan

pty runs a program under a pseudo-terminal session.
pty -ACHUVW: print authorship notice, copyright notice, this notice,
             short usage summary, version number, disclaimer of warranty
pty [-qQve3EdDjJsStT0F] [-fn] [-p[cCdDeEnNrRsS0]] [-x[cCeEnNoOrRsSuUwWxX]]
  program [arg...]: run program under a pseudo-terminal
Options processed l to r. Capitals turn things off. Here + means default.
-q: quiet (nothing on stderr)   -e: leave fds 2 & 3    0=eSTp0  p0=pcrEN
+Q: normal level of verbosity   -3: leave fd 3 only    d=dJT D=Djt    d=>T
-v: complain about everything   +E: 2 & 3 both->pty    s=sxu S=SxU    s=>E
-d: we are detached    +j: job control    +t: change orig tty to char mode
+D: we have ctrl tty   -J: ignore stops   -T: leave orig tty alone
-s: session (allow disconnect & reconnect)   -fn: pass pty fds up fd n
+S: no session: disconnect will send HUP     +F: no -f
-p[cCdDeEnNrRsS]: set pty modes; defaults taken from original tty if -D
  c: cbreak, character mode  +n: change return to newline  +e: echo
 +d: new line discipline      r: raw, no keyboard signals  +s: screen, crt
-x[cCeEnNoOrRsSuUwWxX]: security/experimental/extended, may be restricted
  c: change pty owner   e: pty's stderr write-only       x: set TIOCEXCL
 +s: setuid, safer     +n: check if anyone has pty open  u: use /etc/utmp
 +r: pick random pty    o: skip if anyone has pty open   w: use /etc/wtmp
If you have questions about or suggestions for pty, please feel free
to contact the author, Daniel J. Bernstein, at brnstnd@acf10.nyu.edu
on the Internet.