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

Gene Heskett gene.heskett at verizon.net
Sat Jan 2 19:35:47 EST 2010


On Saturday 02 January 2010, Joel Ewy wrote:

>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.


I was thinking more in terms of the 4 or so copies of tail I run here,
'tailing' some log files I want to watch, so you are right, this isn't what
you want to do.


>> 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.

>

Ahh, gee (says he, blushing).


>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


And now I learn from you. And, with a wry grin, I'll have to admit I have
never read the manpage for either, they are so intuitive.


>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.


And what did you say about terrabyte drives just now? ;-) With them only 20
bucks over the commodity drive price, it seemed foolish not to have growing
room, so everytime a drive signs out (at least 2 a year around here), it gets
replaced with the next generation drive. FWIW, the drives in this box total
3.4 terrabytes. I still have a 400Gb deathstar that has refused to run out
of hydrogen for its nuclear heart, over 4 years worth of 24/7 hours on it
now.

If the coco ever grows a SATA interface, I suppose I should, if it survives
that long, format it for os9 & replace that puny 1Gb drive I have on my coco3
now. :-) That is, I believe, the last scsi drive on the property unless the
one in my old amiga would still spin up. But its been much of a decade since
it last had a power cord plugged in on both ends at the same time.

--
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)

Interchangeable parts won't.



More information about the Coco mailing list