[comp.sys.amiga] vt100v2.7 needs Walton-Puckett BPTR StartLock fix

hull@hao.UCAR.EDU (Howard Hull) (10/11/87)

The comp.sources.amiga version of vt100 (V2.7 ACS 870825a) has problems
with leaving behind a file lock on close.  A fix for this was offered
by Ed Puckett for V2.6 based on some earlier contributions by Steve Walton.
I just tried those fixes on V2.7 (now being used) and they seem to work ok.
So, I'll just pluck up Puckett's article :-(*)

>From: qix@mit-prep.ARPA (Ed Puckett)
>Newsgroups: comp.sys.amiga
>Subject: Bug Fix - Version 2.6 VT100 Stray FileLocks
>Message-ID: <48@mit-prep.ARPA>
>Date: 7 Mar 87 03:03:39 GMT
>Organization: The MIT AI Lab, Cambridge, MA

>    First, thanks to Dave Wecker (and all others involved) for the wonderful
VT100 terminal emulator.  It's a pleasure to use, and keeps getting better!

     In article <1067@rutgers.RUTGERS.EDU>, Steve Walton describes
modifications to Version 2.6 VT100 to overcome bugs in the handling of
FileLocks.  With these modifications, the program no longer crashes the
system after being run from the Workbench.  However, it now fails to
release the last directory lock obtained, which causes free memory
lossage and associated disk icons to "stick around" on the Workbench.
     The solution presented here saves the original directory lock, and
restores it during cleanup.  This way, your current directory is the same
after as before running VT100, regardless of any directory changes made
while in VT100.
     I duplicate the diff format used by Steve Walton because it is so
easy to use.  Apply these changes to the original files as posted by
Dave Wecker [ACS for V2.7].  Delete lines marked *DEL*, and insert those
marked *INS*.  Some of Steve's changes are used here.

vt100.c
-------
       char    MyDir[60];
*DEL*  struct  FileLock *MyDirLock = NULL;
*DEL*  struct  FileLock *StartLock = NULL;
*INS*  BPTR    StartLock = 0;

main()...
           MyDir[0]  =     '\000';
*DEL*      StartLock = (struct FileLock *)((ULONG)((struct Process *)
*DEL*                      (FindTask(NULL)))->pr_CurrentDir);
*DEL*      MyDirLock = (struct FileLock *)DupLock(StartLock);
*INS*      StartLock =     ((struct Process *) FindTask(NULL))->pr_CurrentDir;
*INS*                      CurrentDir(DupLock(StartLock));

cleanup()....
               CloseDevice(&Audio_Request);
*DEL*          if (MyDirLock != NULL) UnLock(MyDirLock);
*INS*          UnLock(CurrentDir(StartLock));     /* back to original directory */

vt100.h
-------
       extern char	MyDir[60];
*DEL*  extern struct	FileLock *MyDirLock;
*DEL*  extern struct	FileLock *StartLock;
*INS*  extern BPTR	StartLock;
       extern struct	IntuitionBase *IntuitionBase;
       
expand.c
--------
                      if (fib->fib_DirEntryType > 0) {
*DEL*                      CurrentDir(lock);
*DEL*                      if (MyDirLock != NULL) UnLock(MyDirLock);
*DEL*                      MyDirLock = lock;
*INS*                      UnLock(CurrentDir(lock));
                           if (MyDir[strlen(MyDir)-1] == '/')

::::::::::::::::::::::::::::::::::::::
::: Ed Puckett :::::::::::::::::::::::
::: EPAC Software ::::::::::::::::::::
::: ...!ihnp4!mit-eddie!mit-oz!qix :::
::::::::::::::::::::::::::::::::::::::

<I also noted that the comp.sources.amiga diff file posted by Tony Sumrall -

		Subject: Late breaking fixes to VT100 R2.7
		Message-ID: <15638@amdahl.amdahl.com>
		Date: 6 Oct 87 01:01:03 GMT

should not have had fixes for the README file in the comp.sources.amiga shar,
as it was already current.  The diffs for init.c and script.c _were_ needed,
though.
						Best Regards, Howard Hull
-eom-

Competition often does not produce the best product.  Competition usually
produces the most pervasive product.  Cooperation produces the best product.
"At least he got Ice Man before he got us..." Top Gun: 2 losers 0 winners.