Writing it for Linux so far, as of course that's what I use- note that that isn't as perverse as it may sound, as I'm perfectly able to run UFO under the dosemu emulator (or I was, until I had to temporarily uninstall it during an upgrade. I've not put it back yet, but will probably do soon), and it's quite plausible the source could be recompiled for DOS or Windows too, whether through DJGPP or Mingw32 or Cygwin, or through Microsoftish compilers.
We can deal with both this eventuality, and the annoyance of otherwise having to treat the first record differently to the rest, by simply maintaining a minimum start address seen variable, to act as the boundary.
One thing we could do is view what the names are on each of the subfiles, eg "Geoscape1", "0", "1", "nowt"...
Another thing we could do, very handy if making a conversion or wanting to hack at it, is build a new catfile- for this, as none of the subfiles in the sample.cat file have unique names, we must probably use something other than the filenames to determine the names of the subfiles. One obvious approach would be to have the files to be packed in each have a numbered filename to determine where in the catfile it goes, and then give a separate list describing what the names associated are, with the first line being the first subfile's name, etc.. Another similar approach would be that the list file has pairs of fields on each line- first the filename to go in, then the name to use for it, separated by a space. Again the line number determines the subfile number in the catfile. Not sure which is preferable.
For actually extracting the subfiles, we could have 2 methods: Firstly just extracting a single one, specified by number, in which case it prints the name used and writes the file out to uh, not sure where. Perhaps a file based on the name used, but that could be problematic. Second method, it extracts everything. When it does this, it might be desirable to do it in a way that's compatible with the repacking system, so it could manage this 2 ways:
So I think that the filenames in either case should be based on the index number, and the extractor can produce the list file that's readable by the repacker. The only argument you have to pass it is what the subdirectory name is for it all.
OTOH the version with filenames specified by hand would mean you could see what you're putting in there a bit clearer I suppose, but eh. Perhaps you could maintain a separate file for those purposes, or do it with symlinks (on Linux at least).
Nothing to download yet. Bear with me.