[Coco] 'head' and 'tail' for CoCo OS-9?

Joel Ewy jcewy at swbell.net
Sat Jan 2 18:18:07 EST 2010


Gene Heskett wrote:
> On Saturday 02 January 2010, Joel Ewy wrote:
>   
>> Gene Heskett wrote:
>>     
>>> On Saturday 02 January 2010, Joel Ewy wrote:
>>>       
>>>> Surely somebody has made these useful utils...  I can't find them on any
>>>> of my old floppies, or on RTSI, Maltedmedia, or any other source of CoCo
>>>> goodies.
>>>>
>>>> Ideas?
>>>>
>>>> JCE
>>>>         
>>> If the file locking still works correctly in the newer versions of
>>> nitros9, list makes a reasonable substitute.  It tmode pause is on, you
>>> have a head, and if its off, and you've started an assembly that is
>>> making its listing, then that listing can be read in very close to real
>>> time with list, which will read the file till it runs into the currently
>>> locked by the assembler sector, and will dutifully wait till that sector
>>> is written and unlocked, reading it when it can gain access.
>>>
>>> There is a slight gap between the assemblers unlocking that sector and
>>> locking the next as it writes, so there is an about 1 in a thousand
>>> chance that list will read beyond the write, but you'll have to play with
>>> it, a lot, to get exactly the timing glitch to effect a list.  Only with
>>> faster hard drives was I ever able to trigger it, never when working on
>>> floppy's.
>>>       
>> I'm not sure that will quite do what I want, Gene.  I'm trying to shave
>> a few hundred bytes off the end of binary files.  Maybe I can figure out
>> how to make 'ded' do it for me.  I actually found a 'tail' program on
>> one of my old CoCo disks, but it's 'head' I need.
>>     
>
> For binaries, the std head won't work very well since those utils are text 
> based and all count line endings to know when to start or stop.  But I'm sure 
> one could knock something up in short order in C, and with a little more 
> effort in B09, and for the purists, assembly could do it too.  C would be the 
> nicest in this case because of its built in argc and argv constructs, which 
> would make it very easy to name the input and output files and the number of 
> bytes to copy from either end of a file.
>
> Humm, boggles my mind though, I'm explaining something to Joel Ewey, I should 
> paint that on the wall. ;)
>
>   

Gene, if you painted your walls every time I learned something from your 
mail list postings you'd have to find something really clever to do with 
all the buckets.

However, your memories of 'head' and 'tail' were probably formed before 
the days of terabyte hard drives. Ubuntu 8.04 makes this claim about one 
option when I 'man head':

-c, --bytes=[-]N
print the first N bytes of each file; with the leading ‘-’,
print all but the last N bytes of each file

In fact, I have already used 'head' on these files before putting them 
on OS-9 disk images. But now I find I have to get rid of some more pesky 
bytes. Drat that VEF for only accepting 200 lines. The extraneous lines 
are ignored by 'view' but take up unnecessary disk space, so they must go.

JCE




More information about the Coco mailing list