From:	CSBVAX::MRGATE!RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP 23-OCT-1988 04:27
To:	ARISIA::EVERHART
Subj:	Fast TAIL modifications


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Sat, 22 OCT 88 19:32:21 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Sat, 22 Oct 88 19:31:19 PDT
Received: by ucbvax.Berkeley.EDU (5.59/1.31)
	id AA02133; Sat, 22 Oct 88 17:41:26 PDT
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 19 Oct 88 20:05:21 GMT
From: mcvax!enea!sommar@uunet.uu.net  (Erland Sommarskog)
Organization: ENEA DATA AB, Sweden
Subject: Fast TAIL modifications
Message-Id: <4012@enea.se>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

Some days ago I posted on Thomas Nilsson's behalf a fast TAIL
program. Thomas has made some fixes, which I post here. Reply
to him (MTK_TNN@kiera.ericsson.se), not to me.

Erland 

----------------------------------------------------------------------
Hi,

below is a vms_share that updates the old TAIL.PAS I submitted a
few days ago to a new version. Just extract the files in the same 
directory as you stored the previous file and run:

$ @update

The reason for the included changes are the following:

1)    Incorrect behaviour on VFC-files (I.e. log-files). You will notice
      it on eightbit terminals. The file is tailed on one line.
      A. Johansson @ DEC Sweden pointed out this problem.

2)    More information together with %TAIL-E-OPENIN, ...
      This change was suggested by E Sommarskog @ enea, Sweden 


I'm sorry for the problems this might cause you...


Thomas Nilsson
Ericsson Radio Systems Sweden

Mail: mtk_tnn@kiera.ericsson.se


$!.............................................................................
$! VAX/VMS archive file created by VMS_SHARE V06.00 26-May-1988.
$!
$! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from
$! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au).
$!
$! To unpack, simply save, concatinate all parts into one file and
$! execute (@) that file.
$!
$! This archive was created by user MTK_TNN
$! on  6-APR-1866 20:07:23.74.
$!
$! It contains the following 2 files:
$!        TAIL.DIF
$!        UPDATE.COM
$!
$!==============================================================================
$ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL )
$ VERSION = F$GETSYI( "VERSION" )
$ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK
$ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", -
    "VMS_SHARE V06.00 26-May-1988 requires VMS V4.4 or higher."
$ EXIT 44 
$VERSION_OK:
$ GOTO START
$
$UNPACK_FILE:
$ WRITE SYS$OUTPUT "Creating ''FILE_IS'"
$ DEFINE/USER_MODE SYS$OUTPUT NL:
$ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION -
    VMS_SHARE_DUMMY.DUMMY
b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) )
; s_file_spec := GET_INFO( COMMAND_LINE, "output_file" ); SET( OUTPUT_FILE
, b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" ); i_errors 
:= 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN 
& "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; POSITION
( BEGINNING_OF( b_part ) ); i_append_line := 0; LOOP EXITIF MARK( NONE 
) = END_OF( b_part ); s_x := ERASE_CHARACTER( 1 ); IF s_x = "+" THEN r_skip 
:= SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip <> 0 THEN s_x := ""
; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF; ENDIF
; IF s_x = "-" THEN r_skip := SEARCH( pat_end, FORWARD, EXACT ); IF r_skip <
> 0 THEN s_x := ""; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip := MARK( NONE )
; r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip <> 0 THEN POSITION
( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET ); MOVE_VERTICAL( 1 )
; MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part ) ); ENDIF; ERASE
( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF
; IF s_x = "V" THEN s_x := ""; IF i_append_line <> 0 THEN APPEND_LINE
; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF; i_append_line := 1; MOVE_VERTICAL
( 1 ); ENDIF; IF s_x = "X" THEN s_x := ""; IF i_append_line <
> 0 THEN APPEND_LINE; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF
; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> "" THEN i_errors 
:= i_errors + 1; s_text := CURRENT_LINE; POSITION( b_errors ); COPY_TEXT
( "The following line could not be unpacked properly:" ); SPLIT_LINE
; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ); MOVE_VERTICAL( 1 
); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH( "`"
, FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ); ERASE_CHARACTER( 1 )
; IF CURRENT_CHARACTER = "`" THEN MOVE_HORIZONTAL( 1 ); ELSE COPY_TEXT( ASCII
( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDIF; ENDLOOP; IF i_errors = 0 THEN SET
( NO_WRITE, b_errors, ON ); ELSE POSITION( BEGINNING_OF( b_errors ) )
; COPY_TEXT( FAO( "The following !UL errors were detected while unpacking !AS"
, i_errors, s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors
, "SYS$COMMAND" ); ENDIF; EXIT; 
$ DELETE VMS_SHARE_DUMMY.DUMMY;*
$ CHECKSUM 'FILE_IS
$ WRITE SYS$OUTPUT " CHECKSUM ", -
  F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!,passed." )
$ RETURN
$
$START:
$ FILE_IS = "TAIL.DIF"
$ CHECKSUM_IS = 1179859541
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X-   16,   16
X   who solved the "File currently locked problem"
X   and pointed out the VFC problem *)
X-   78
X      fix_head        :      integer;   
X      sts,stv         :      unsigned;
X-  403,  404
X         buffer.length:=line^.length;         
X                         
X         (* Remove the fixed header, if any *)
X
X         buffer.body:=substr(line^.body,1 + fix_head,
X                             buffer.length - fix_head);
X-  529,  529
X
X         (* Save the status for later use *)
X
X         sts:=FAB.FAB$L_STS;
X         stv:=FAB.FAB$L_STV;
X-  549
X            (* Check if the file is of VFC-type *)
X
X            if FAB.FAB$B_RFM = FAB$C_VFC then          
X
X               (* Save the number of bytes to remove *)
X
X               fix_head:=FAB.FAB$B_FSZ
X
X            else
X
X               (* The file is FAB$C_VAR i.e. no bytes to 
X                  remove *)
X
X               fix_head:=0; 
X
X-  604,  604
X                       file_name.body,
X                       %immed sts,
X                       %immed stv);
X/
$ GOSUB UNPACK_FILE
$ FILE_IS = "UPDATE.COM"
$ CHECKSUM_IS = 1929924021
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$ !
X$ ! File used for updating tail.pas
X$ !
X$ edit/sum tail.pas/update=tail.dif
X$ inquire update "Do you want to make TAIL "
X$ if update then @makefile
X$ exit
$ GOSUB UNPACK_FILE
$ EXIT

