🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #8028

Re: Unix like 'tail -f'

#8028
From: Dave P. Schaumann
Date: Thu, 17 Jan 1991 06:03
34 lines
1927 bytes
In article <1991Jan17.034047.18447@eecs.wsu.edu> rnelson@yoda.UUCP (Roger Nelson - Grad Student) writes:
>------
>
>Am I correct in my observation that Amiga DOS does not allow you to access
>a file in any way until it is fully closed? 

Assuming the file is opened for writing.  A file may be opened for reading any
number of times.

>Does there exist a UNIX like tail utility?  
>Could similar functionality be achieved using something like Matt Dillon's
>fifodev (which I intend to look at)?
>
>IRNTK (I really need to know).

The functionality of 'tail' can be achieved quite easily.
  1) Define N == the # of lines to be displayed.
  2) Create an array of N strings, all initially the empty string.
  3) Read in the file line by line, filling in the array in a circular
     fashion (ie, the N+1 line would over-write the 1st entry of the array).
  4) When EOF is reached, print out the array, from oldest to newest.

This general outline will give a solution that only needs to read the file
once, and is reasonably economical in space.

There probably is an implementation of 'tail' out there somewhere, given that
it wouldn't be hard at all to hack together a reasonably robust implementation
of it.

>Thanks,
>____  | ^          |    Roger Nelson          rnelson@yoda.eecs.wsu.edu

Dave Schaumann		|  And then -- what then?  Then, future...
dave@cs.arizona.edu	|  		-Weather Report
Technical Details
Message-ID: <685@caslon.cs.arizona.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!usc!elroy.jpl.nasa.gov!ncar!noao!arizona!dave
References: <1991Jan17.034047.18447@eecs.wsu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!usc!elroy.jpl.nasa.gov!ncar!noao!arizona!dave
From: dave@cs.arizona.edu (Dave P. Schaumann)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Unix like 'tail -f'
Message-ID: <685@caslon.cs.arizona.edu>
Date: 17 Jan 91 06:03:05 GMT
References: <1991Jan17.034047.18447@eecs.wsu.edu>
Followup-To: comp.sys.amiga.programmer
Organization: U of Arizona CS Dept, Tucson
Lines: 34