[comp.sys.sun] shelltool child of another shelltool

tale@pawl.rpi.edu (12/22/88)

Here is a bug, unless someone can convince me it is a feature.

The scenario:
	SunOS 3.5 based on BSD 4.2.
	suntools-e
	default shell: /usr/local/bin/ecsh  (emacs-like c-shell)

Now my problems mught arise over either my use of a non-standard suntools
(modifications had nothing to do with window control, though, at least as
reported by the author) or ecsh, which does do a couple of weird (read as:
neat!) things with command lines.  Perhaps it is the interaction of both.
I'm am pretty sure they are involved, though, because when I am defaulted
to csh in good old suntools, it works fine.

The problem?  When I run shelltool in the background from another
shelltool, it loads with only stty kill '' set.  stty\n shows that
everything is <undef[ined]>.  This creates a problem when I run any of my
C programmes, all of which use fgets 99% of the time to read input.  I
type on the stdin, but nothing gets displayed.  It gets passed, but not
displayed.  If I set all the sttys by hand, they don't work on my command
line.  Any suggestions?  [[ Type an "stty" command with appropriate
settings?  Type the "reset" command?  Or do you mean something more
automated?  --wnl ]]

Incidentally, the olny reason I am running a shelltool from within another
shelltool rather than from the menu is that I need it -Wn and that is not
an escape sequence which I can echo from within the shell.

Dave

      tale@rpitsmts.bitnet, tale%mts@rpitsgw.rpi.edu, tale@pawl.rpi.edu

guy@uunet.uu.net (Guy Harris) (01/04/89)

>Here is a bug, unless someone can convince me it is a feature.

It's a hard-to-fix bug, I think.  I'll bet "ecsh" sets the tty modes to
the form you specify when it's running (so it can see each character as
you type it, and do the neat things you mention), and sets them back to
normal when running a program in the foreground (so that program doesn't
get confused).

Unfortunately, it probably doesn't do that when it runs a program in the
background, since it still owns the terminal.  "shelltool" wants to set
the tty modes for the new pseudo-tty to match your "standard" ones; it
does so by reading the modes on the terminal from which it was run.
Unfortunately, if you do it in the background, it picks up the "funny"
"ecsh" modes....

The Korn shell in EMACS mode does much the same thing, and causes much the
same problem. 

Workaround: try running it in the foreground and, once it's started up,
type ^Z and background it.  That way the modes will be "normal" when it
starts up.

>Incidentally, the olny reason I am running a shelltool from within another
>shelltool rather than from the menu is that I need it -Wn and that is not
>an escape sequence which I can echo from within the shell.

In that case, just add a new menu item to your root menu that runs
"shelltool" with the "-Wn" flag (if you don't have a root menu file of
your own, but use the system default one, copy that one and make it yours,
and then edit it).  Worked for me, at least under 4.0.