[comp.windows.open-look] need help turning echo on in a TERMSW in XView...

engstrom@SRC.Honeywell.COM (Eric Engstrom) (06/10/91)

I've got an application that creates a TERMSW (TTYSW), with no process
behind it (TTY_ARGV, TTY_ARGV_DO_NOT_FORK).  I then dup2() the FDs for
stdin and stdout.

The result is that any fork()/exec()ed processes that I start from this
application would have their I/O redirected from/to this TERMSW.  This
setup works fine with the exception that characters that I type while the
sub-window is the current focus are not echoed; i.e., the characters typed
are sent to the process expecting input, but are not displayed in the
TERMSW.

I've thought about using something like "stty echo", but I've got no
process to issue the command and I havn't found any accessable link from
the TERMSW to an explicit tty (pty in actuality, I assume).

I'm not real hot on the idea of writing my own event-handler, so cheap
solutions are desired!


--- Source code (semi-long) to initialize example (devguide/hand-code hybrid)
---------- <snip, snip...> -=-=-=-=-=-=-=-=-=-=-=- <snip, snip...> -----------

main(...) {

 ...

  /*
   * Initialize user interface components.
   */
  sessionWindow = 
    sessionStatus_mainWindow_objects_initialize(NULL, NULL);
  sessionIOPane = sessionIOPane_create(sessionWindow->mainWindow);
  dup2((int)xv_get(sessionIOPane, TTY_TTY_FD), 0); /* dup2 closes 0 first */
  dup2((int)xv_get(sessionIOPane, TTY_TTY_FD), 1); /* dup2 closes 1 first */


  ...

}

/*
 * Create object `sessionIOPane' in the specified instance.
 *
 * (This was scarfed from the devguide version of the sessionStatus_ui.c)
 */
Xv_opaque
sessionIOPane_create(owner)
	Xv_opaque	owner;
{
	Xv_opaque	obj;
	
	obj = xv_create(owner, TERMSW,
			/* XV_KEY_DATA, INSTANCE, ip, */
			/* XV_HELP_DATA, "sessionStatus:sessionIOPane", */
			XV_X, 0,
			XV_Y, 0,
			XV_WIDTH, WIN_EXTEND_TO_EDGE,
			XV_HEIGHT, 125,
			OPENWIN_SHOW_BORDERS, TRUE,
			TTY_ARGV, TTY_ARGV_DO_NOT_FORK,
			NULL);
	return obj;
}

---------- <snip, snip...> -=-=-=-=-=-=-=-=-=-=-=- <snip, snip...> -----------


Thanks much,
Eric
+---------
Eric Engstrom, Honeywell SRC		   | The verb form of 'committee' 
Inter: engstrom@src.honeywell.com	   |  is 'commit', as in 
UUCP:  {umn-cs,ems,bthpyd}!srcsip!engstrom |  "the committe was committed
MAIL: 3660 Technology Drive, Mpls, MN      |  to the Anoka Mental Hospital."