From harvard!talcott!panda!jpn Tue May  6 20:58:18 1986
Received: by seismo.CSS.GOV; Tue, 6 May 86 20:57:49 EDT
Received: from talcott by harvard.HARVARD.EDU with UUCP; Tue, 6 May 86 20:58:28 EDT
From: harvard!talcott!panda!jpn
Return-Path: <panda!jpn>
Received: by panda.LOCAL on Tue, 6 May 86 18:39:34 edt
Date: Tue, 6 May 86 18:39:34 edt
Message-Id: <8605062239.AA00903@panda.LOCAL>
To: talcott!seismo!rick
Status: R

From: talcott!seismo!gatech!unmvax!wampler (Bruce Wampler)
Subject: 1st batch of TVX Bug fixes
Newsgroups: mod.sources
Approved: jpn@panda.UUCP

Mod.sources:  Volume 4, Issue 62
Submitted by: gatech!unmvax!wampler (Bruce Wampler)

Following are bugs that have been discovered in the version of TVX
posted to mod.sources in early March.  After making all these
fixes, you have version 4/5/86 of TVX.  Please report any other bugs
directly to me, and I will summarize as needed.

Dr. Bruce E. Wampler
University of New Mexico
Department of Computer Science
Albuquerque, NM 87131

..{ucbvax | seismo!gatech | ihnp4!lanl}!unmvax!wampler


****************************************************************************
1. Bad entry for ATARI520 in tvx_term.ic

   In tvx_term.ic, in the entry for ATARI520, change the initialization for
	cdelchr to all 0's.

****************************************************************************
2. Bug when terminal has clear screen and home screen control

   In tvx_io.c, fix the cclears part of the if in routine tvclr.
   This only seems to show up when the very first character of the file
   is a TAB and the terminal has a cclears control sequence:

----------  new TVCLR code: ----------
/* =============================>>> TVCLR  <<<============================= */
  tvclr()
  {  /* tvclr - clear the entire screen and home */
 
    if (cclears[0])
      {
	sendcs(cclears);
	tvx = tvy = 1;		/* must update these! */
      }
    else
      {
	tvxy(1,1);
	tvescr();
      }
#ifdef SCR_BUF
    ttflush();
#endif
  }
----------  end new TVCLR code --------

****************************************************************************
3. Serious initialization bug forces TVX to tty mode sometimes

   In tvx_io.c, in routine fopenx, add one line to initialize
   set_ttymode to FALSE.  On some systems (like SYSV) where SLOW
   has been defined to be dynamic, set_ttymode defaults to whatever
   was on the stack.  (BSD seemed to have a 0 there, so I didn't find
   this one till now.)  Thus, tvx could come up in ttymode sometimes by
   default.  Fix it like this:

------- fix in fopenx -------
    set_ttymode =		/* assume visual mode +++ bug fix +++ */
    ttymode = FALSE;		/* not in tty mode, so io ok */
    ttynext = 1000;		/* force read */
-----------------------------

****************************************************************************
4. Bug using -o= switch, mostly on micros

   The old code uses orig_file to generate the work_file.  If
   the -o= switch is used to specify a new output file that is on a
   different drive or directory, rename won't work, and you are left
   with the edits in the work file.  dest_file should be used to
   generate the work_file name.  (On unix, 'mv' is forked if rename
   fails, avoiding this problem.)

In file tvx_io.c, in the routine fopenx, change the following:
----- old code ----
	ineof = FALSE;
	strcpy(source_file,orig_file);	/* copy to other names */
	strcpy(work_file,orig_file);
	if (!*dest_file)		/* no -o specified */
	    strcpy(dest_file,orig_file);
---- new code ----
	ineof = FALSE;
	strcpy(source_file,orig_file);	/* copy to other names */
	if (!*dest_file)		/* no -o specified */
	    strcpy(dest_file,orig_file);
	strcpy(work_file,dest_file);	/* use dest file for diff drives */
---------------

****************************************************************************
5. Better rename code for Atari-ST

   The GEMDOS rename call on the Atari ST version doesn't return
   status.  The following code checks status "manually".

In file tvx_io.c, change routine ren_file to be:
--------- replacement ren_file code -------
/* =============================>>> ren_file <<<=========================== */
  ren_file(old,new)
  char *old, *new;
  {
#ifndef GEMDOS
    if (rename(old,new) != 0)
      {
	prompt(old) ; prompt(" not renamed to "); remark(new);
	prompt("Edits found in "); remark(old);
      }
#endif
#ifdef GEMDOS
    FILE *temp;

    gemdos(0x56,0,old,new);	/* can't find C version */
    if (!(temp = fopen(new,FILEREAD)))	/* see if it was successful */
      {
	prompt(old) ; prompt(" not renamed to "); remark(new);
	prompt("Edits found in "); remark(old);
      }
    else
	fclose(temp);
#endif
  }
-----------------

****************************************************************************
6. Optional new invocation time switch

   In response to several requests for an "execute a command"
   option when starting TVX, the following code can be added into
   the switch handling code in fopenx in file tvx_io.c.

   TVX can then be started like 'tvx file -x=49d' to go to
   the 50th line in the file, for example.  Any command that could
   be used in a repeat loop may be placed after the -x.  It may
   be a problem to enter some special characters like Escape.

------ add as new else condition in the switch handling code of fopenx -----

	    else if (ch == 'x' && (stemp[iswbeg+1] == '=' ||
	      stemp[iswbeg+1] == ':'))	/* specifying string to execute */
	      {
		if (!iswval)		/* wrong order! */
		  {
		    remark("Bad -X= switch");
		    quit();
		  }
		scopy(stemp,iswbeg+2,&rptbuf[0][0],0);  /* store command */
		rptcnt[0] = 1;				/* execute once */
		nxtrpt[0] = 0;				/* from beginning */
	      }
-------------
****************************************************************************

