libcpmfs 1.0.0 -- CP/M and TurboDOS disk images
===============================================

$Id: README,v 1.5 2026/12/03 22:44:05 rec Exp $

Read and write the files inside disk images from CP/M-era machines --
CP/M 2.2, CP/M 3, P2DOS and TurboDOS -- from a C program, from the
command line, or as an ordinary directory.

    $ cpmfs -f kpii ls -l games.img
    $ cpmfs -f kpii get games.img ADVENT.COM
    $ cpmfs -f kpii put -u 3 games.img notes.txt
    $ cpmfs -f kpii fsck games.img

    $ cpmfs-mount -o format=kpii games.img /mnt/cpm
    $ cp *.txt /mnt/cpm/0/; ls /mnt/cpm/3; fusermount3 -u /mnt/cpm

cpmfs(1) lists, copies, deletes, renames and sets attributes; checks an
image and repairs it only when asked (fsck -r); makes new images; and
converts ImageDisk (.IMD) files to raw ones.  The geometry comes from a
built-in format (cpmfs formats), from a cpmtools-style diskdefs file
(-D), or, for disks of the tdosbox TurboDOS emulator, from the image's
own footer.  The built-in formats include all of TurboDOS 1.43's floppy
formats; "turbodos" is its standard 8-inch two-sided double-density
floppy:

    $ cpmfs -f turbodos mkfs -l WORK work.img
    $ cpmfs -f turbodos put -u 31 work.img *.COM

Files keep their exact size: CP/M counts 128-byte records, and the
bytes used in the last record are kept in byte S1 of the directory
entry, as CP/M 3, TurboDOS and cpmtools keep them (CP/M 2.2 leaves S1 at
0; such files come out in whole records).  -R (cpmfs), -o records
(cpmfs-mount) and CPM_O_RECORDS (the library) ignore the count.

cpmfs-mount(1) mounts an image through FUSE: one directory per user
area (or one area alone), 8.3 names, R/O as the write permission, exact
sizes.  What CP/M cannot hold -- long names,
subdirectories, files beyond the system's limit -- is refused with the
proper errno, never mangled.  It is built when libfuse3 is installed
(pkg-config fuse3); without it the rest builds and tests as usual.

libcpmfs, the library under both, opens image files or memory buffers,
lists, reads and writes files at any offset, keeps CP/M 3 date stamps
and labels, keeps the TurboDOS label and allocation map as TurboDOS
does, and checks a disk with a report of every problem.  It uses only
libc, never prints or exits, and keeps no global state.

Build and install (Linux, FreeBSD; gcc or clang; no configure step):

    make
    make test
    sudo make install          # or: make PREFIX=$HOME/local install

Documentation: libcpmfs_manual.pdf, cpmfs(1), cpmfs-mount(1), cpmfs(3).

The files in examples/data are synthetic, made by examples/mkdata.py.

Copyright (c) 2026, Robert Cousins.  Three-clause BSD licence: see LICENSE.
