[net.sources] vnews BUG!

cfv@packet.UUCP (06/09/83)

On 4.1Bsd, at least, there are a couple of severe problems with vnews. The
first is because vnews does not seem to know about the existence of csh and
the difference in setting up shell variables. When you attempt a shell
escape with '!' it will put you into csh, but it attempts to initialize
$A with 'A=<filename> export A'. There are two places in visual.c where this
needs to be changed. They are both in docmd().

The first place is in the section of the switch that processes the 's' and 'w'
commands. Replace the line that looks like:

sprintf(linebuf,"setenv A %s;%s", filename,secpr+1);

with:

if (!strcmp(SHELL,"/bin/csh")) {
    sprintf(linebuf,"setenv A %s;%s", filename,secpr+1);
} else {
    sprintf(linebuf, "A=%s export A;%s", filename, secpr + 1);
}

The second is in the section that processes the '!' command. Replace the
line that looks like:

sprintf(linebuf,"setenv A %s ;", filename);

with:

if (!strcmp(SHELL,"/bin/csh")) {
    sprintf(linebuf,"setenv A %s ;", filename);
} else {
    sprintf(linebuf, "A=%s export A;", filename);
}

The second bug is real bad. When you attempt to use the 's |lpr' command
vnews core dumps. The source code for that is commented with 'Not tested'
which is an understatement.

The problem is that this code sets up a shell string to execute and then
uses a 'goto' to jump into the code used to execute shells. Essentially
what it is doing is the same as if you typed in '!print $A' on the keyboard.
Unfortunately, there are a couple of variables in the shell handling command
that are not created when the save command jumps into it, and so you are
working with random junk. The (quick) fix to this is to add the lines: