Avoid recreating directories within session

The pmkdir function was designed to create subdirectories for any path.  Now
it's been redesigned to specifically create directories on the format XX/XX,
while remembering what directories it has already created in order to reduce
the number of redundant system calls.

The list of previously created directories is kept in bit arrays, so it only
occupies 8224 bytes of BSS space.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Merge branch 'master' of github.com:mortehu/cantera-cas
Use FIEMAP to sort objects before building pack

When reading hundreds of thousands of files from disk, the penalty invoked by
reading them in random order from a rotational device can be huge.  This patch
adds detection of rotational devices, as well as sorting of files by their
physical location prior to copying.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Detect EOF from standard input earlier

When using stdio buffers, we need to call feof between each call to fread to
reliably detect EOF.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Added support for --command as documented

ca-cas --help would mention a --command option, but it was not actually
supported until this commit.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>