[Coco] Are the files in the /dd/SYS directory always ASCII ?

coco at jechar.ca coco at jechar.ca
Fri Sep 25 15:56:27 EDT 2020


Is this "file descriptor" part of the file or part of the os9 directory 
info?

On 2020-09-25 13:15, Jeff Teunissen wrote:
> You've probably never seen "C-code" because Tandy never sold the CIS
> COBOL package from Micro Focus. That's what it's for. The C compiler
> never produced an intermediate code that could be run like that, but
> COBOL did.
> 
> On Fri, Sep 25, 2020 at 8:47 AM Bill Pierce via Coco
> <coco at maltedmedia.com> wrote:
>> 
>> FWIW, you can "sorta" ID OS-9 files by looking at the file descriptor 
>> and the file header.
>> 
>> In the file descriptor (the first 32 bytes in the sector pointed to by 
>> the last 3 bytes of the 32 byte directory entry, which is also 
>> followed by the FAT for the file), you'll find the file attributes 
>> (which can distinguish if it's executable or read/write only and also 
>> flag directory entries), file creation date, file last modified date, 
>> calculate file size, and determine the owner of the file.
>> 
>> The header can identify the file type as "Program/Object", "P-Code" 
>> (pascal), "I-Code" (basic09), "C-Code" (never seen this used in Coco 
>> OS-9), and "Data" (rare), as well as the version/revision. The file ID 
>> bytes at the beginning (first 2 bytes of any file) of the header can 
>> help as well. If the first 2 bytes are "$87 $CD", then it is some sort 
>> of executable module. If they are "62 $CD", then the file is an ROF 
>> (relocatable object file) for use in compiling C code (it can also be 
>> a C library file which is nothing but a merged ROF). There may be 
>> other OS-9 defined ID bytes, but those are the only 2 I've seen used 
>> in Coco OS-9. Basically, if the 2nd byte is NOT $CD, then it is most 
>> likely a text file or raw binary data file.
>> 
>> There are a few utilities out there (with sources) that can access 
>> this info (ident, id, attr, vfy, verify, etc.).
>> Bob Devries wrote a nice utility to read the file descriptor 
>> "fileinfo", in which the C source explains how to read the file 
>> descriptor.
>> 
>> I used these sources (and more) to help write my file identification 
>> routines in my MShell project.
>> 
>> Bill
>> 
>> 
>> 
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> https://pairlist5.pair.net/mailman/listinfo/coco


More information about the Coco mailing list