[Coco] Are the files in the /dd/SYS directory always ASCII ?
deek at d2dc.net
Fri Sep 25 13:15:10 EDT 2020
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
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.
> Coco mailing list
> Coco at maltedmedia.com
More information about the Coco