blackman@phoenix.Princeton.EDU (Scott Michael Blackman) (03/11/90)
In writing a program for an Apple II that will list the directory of HFS disks, I've run into the following quirk: The directory is organized into a B*Tree (which I can't figure out right now, and if anyone can help me out on the index nodes, it would be wonderful). The leaf nodes of the tree are a linked list, so if you can find one, you can find them all. I can do this, so I ignore the index nodes for now. The leaf nodes have file records, directory records, and thread records. They are prefaced by a key which contains a key length byte, a few pointers, and the filename (with its own length byte). This key is immediately followed by the file, directory, or thread record itself (types 2, 1, and 3 respectively). My problem is this: for about half of the files on any random HFS disk, the key is one byte longer than either the keylength byte or the filename length byte say it is. "Inside Mac" doesn't specify a filename length, but it does imply that the keylength byte will not be violated. I've managed a workaround: If the program doesn't understand the following record, then add a byte and try again. This has always worked. But I don't know why. Any ideas where this byte comes from? Here's the record format: byte key length <---- key word internal use word parent id bytes filename byte Sometimes there is one unknown byte here! (Looks like it's ASCII) byte record type (1, 2, or 3) <---- the actual record . . (record-specific stuff) . Thanks, email please. Scott Blackman blackman@phoenix.princeton.edu ..rutgers!princeton!phoenix!blackman