[Coco] 'head' and 'tail' for CoCo OS-9?
Gene Heskett
gene.heskett at verizon.net
Sat Jan 2 17:57:28 EST 2010
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. ;)
--
Cheers, Gene
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
I haven't lost my mind -- it's backed up on tape somewhere.
More information about the Coco
mailing list