[net.micro.att] UNIX PC 7300: Invoking user agent with a command

dalton@gladys.UUCP (David Dalton) (02/15/86)

I already received a couple of inquiries, so I decided to go ahead and post
this instead of using mail.


USING BVI.C TO GET INVOKE THE USER AGENT AS A COMMAND

Here's the bvi.c program. Its intended use is to create a new
default editor for the user agent -- bvi. The program opens a full 80x24
window (install of the smaller window that the user agent normally uses) and
runs vi in it.

The bvi.c program can also be used for other purposes. It will open an
80x24 window for ANY program, then restore the screen when you exit. If, for
example, you change /usr/bin/vi (it appears twice in the program) to
/usr/bin/ua, you can call the user agent from a non-user-agent login. The
program will open a full-screen "window," then run the user agent. When you log
out of the user agent, you'll be back in shell with your screen restored.
You'll have quick access to the user agent, even though you prefer using the
7300 as a plain UNIX machine. Remember: Shift-F2 will invoke the call screen
anyway, without the help of the bvi.c program. Repertory dialing also works
fine from a non-user-agent login.

You will get a black background, not a dotted background. This is normal.
If you're using the 2.0 system software, you may want to clear the screen
before you invoke the user agent. The initial Office window may not clear the
background.

A WARNING: If you are using the Korn shell, it keeps a history file --
.history in $HOME. This is the same file name that the user agent uses for
your telephone call history. If the Korn shell clobbers your .history file, it
will be fatal to the phone daemon if you invoke the history function, since
apparently no checking is done for corruption of .history. 

The cure is easy: In your .profile, change the Korn shell's HISTFILE default
to something else, like .khistory, and be sure to export it. That will keep the
two files from corrupting each other.

ANOTHER WARNING: Michael Eldridge wrote a nice enhancement for bvi.c which may
not work if you want to use it to invoke the user agent from shell. His
modifications check to see if you're already in a window. If you're not, it
doesn't bother to open a window. The version of bvi.c that appears below is
the one I use.

Here's a copy of the bvi.c program, which moved on the net a while back, in
case some of you can't find it:

---------------------------------------------------------------------------

/*
 * BVI -- On an AT&T Unix-PC, run vi in a new 24x80 borderless window.
 *
 * This program will open a borderless (80 column) window on top of all
 * your other windows and run vi in it.  When vi exits, the window
 * will be removed, revealing the window in which you typed bvi unchanged.
 *
 * Usage:   bvi args-to-vi
 *
 * Author:  Corey Satten, fluke!corey Sept 1985
 *
 * This software is hereby officially introduced into the public domain.
 */
main(ac,av,ep)
    int ac;
    char *av[], *ep[];
    {
    int fd, i;
    char *termcap;

    fd = open("/dev/window",2);
    close(0); dup(fd);
    close(1); dup(fd);
    close(2); dup(fd);
    av[0] = "/usr/bin/vi";
    for (i=0; ep[i]; ++i) {
	if (!strncmp(ep[i],"TERMCAP=",8)) {
	    ep[i] = "TERMCAP=/etc/termcap";
	    }
	if (!strncmp(ep[i],"TERM=",5)) {
	    ep[i] = "TERM=s4";
	    }
	}
    av[0] = "/usr/bin/vi";
    execve("/usr/bin/vi", av, ep);
    }

jlw@ariel.UUCP (J.WOOD) (02/16/86)

There are several ways of invoking commands without
going to the trouble of writing a C program.

In /usr/lib/ua/Office add the 'w' flag to the

Run=EXEC -wd $SHELL

line in the UNIX System section. 
This will give you a 24x80 window for UNIX.
If you want both, just replicate the lines
in the file and modify the Name= line so
you can tell which is which.




					Joseph L. Wood, III
					AT&T Information Systems
					Laboratories, Middletown
					(201) 957-5475
					<ariel!>titania!jlw

elb@mtx5d.UUCP (Ellen Bart) (02/21/86)

There is a way to come up in the user agent and then invoke a full
scree (i.e. borderless) UNIX shell.  This lets you have the best of
both worlds - you do most of your work in a shell (including editing
full screen with vi, emacs etc.) but if something gets hung, or if
you need something from the Office, it's there at a touch of your
<suspend> <resume>.

All you have to do is add another option in your office menu (found
in /usr/lib/ua/Office). Copy the entry for Unix, call it another name
and change the invocation option from -w to -d.

Voila!!

Any problems send me mail.


Ellen Bart
ihnp4!mtx5d!elb

katrina@ihuxf.UUCP (Woodward) (03/02/86)

> There is a way to come up in the user agent and then invoke a full
> scree (i.e. borderless) UNIX shell.  This lets you have the best of
> both worlds - you do most of your work in a shell (including editing
> full screen with vi, emacs etc.) but if something gets hung, or if
> you need something from the Office, it's there at a touch of your
> <suspend> <resume>.
> 
> All you have to do is add another option in your office menu (found
> in /usr/lib/ua/Office). Copy the entry for Unix, call it another name
> and change the invocation option from -w to -d.
> 
> Voila!!
> 
The problem with invoking a Dimensionless window (the -d option) is that
now when you hit <suspend> or the boxed "W" in the corner, is that windows
started this way show up as "Unknown Contents"!  That's not a big deal if
you've only got the "Office" and one other window, but how do you pick
out the "right" "Unknown Contents" when you have several to chose from? 

Personally, I like the "one" program that someone submitted a while
back.  It starts in a Dimensioned window, so the window manager `knows'
the contents, but then expands the window to dimensionless.  I've timed it
repeatedly (stop watch) for invoking the shell this way and the loss is
typically a second (or less).

	Katrina Woodward
	ihnp4!ihuxf!katrina