This is an enhanced version of the Mtools program collection which was
originally written by Emmet P. Gray <fthood!egray@uxc.cso.uiuc.edu>. It
is somewhat targetted at the Linux operating system, but should compile
on systems, which run the original Mtools, with minor Makefile changes.
Please send comments, bug reports, flames, etc. about the changes to
Werner Almesberger <almesber@nessie.cs.id.ethz.ch>.

For a description of Mtools, please read the file 'Readme'. This README
file only addresses changes to the original Mtools and Linux specifica.


Installation
------------

To install Mtools on your Linux system, extract all files and type  make
to build the executable or  make install  to build the executable, to
move it and the man pages to /usr/bin or /usr/man/man1, respectively, and
to create all the necessary hard links. You might want to change the file
ownership after the installation.


Changes to Mtools 2.0.5
-----------------------

  - all tools (except mkmanifest) are now in a single executable, which
    saves a considerable amount of disk space.
  - device configuration is read at run-time from a file /etc/mtools.
  - a sanity check is performed to detect incorrect FAT type settings.
  - stdout is flushed before reading stdin.
  - uses fgets instead of gets.


Changes to the earlier "Linux mtools" (mtools.n.tar.Z)
-------------------------------------

  - removed certain ANSI C idiosyncrasies.
  - fixed contradicting storage class specifications.
  - added the (optional) offset field to /etc/mtools
  - replaced gets by fgets.

gcc generates lots of warnings, especially when compiling with -Wall, but
they can be safely ignored.


Merged executable
-----------------

To combine all tools in a single executable, Makefile has been replaced
and the old Makefile has been renamed to Makefile.orig.

When compiling Mtools, a single executable named mtools is created, to
which all other programs have to be linked. The following Bourne shell
command creates the necessary hard links in the current directory:

for name in mattrib mcd mcopy mdel mdir mformat mlabel mmd mrd mread mren \
  mtype mwrite; do ln mtools $name; done

(make links has the same effect.)


Run-time configuration
----------------------

The mapping of DOS disk drives to UNIX devices is defined in a configura-
tion file which is named /etc/mtools.

An entry in /etc/mtools can have any of the following formats:

drive device
drive device fat
drive device fat cylinders heads sectors
drive device fat cylinders heads sectors offset

drive is the DOS drive letter, device is the name of the device on UNIX,
fat is the number of bits a FAT entry has (either 12 or 16), cylinders,
heads and sectors describe the disk geometry. On hard disks, the geometry
parameters should all be zero. offset specifies how many bytes should be
skipped when accessing the device. This is necessary when using non-
standard disk configurations.

The abbreviated entries are only valid on systems for which Mtools can
"guess" the disk parameters by looking at the UNIX device name. (Partial
support for this feature is available if -DLINUX is set.) If this is not
possible, an error message is issued.

Comments begin with a number sign and end with a newline. Blank lines
are ignored.

A sample configuration file:

# /etc/mtools - mtools device definitions

A /dev/fd0 12 80 2 15	# A: 5.25" HD
A /dev/fd0 12 40 2 9	# A: 5.25"
B /dev/fd1 12 80 2 18	# B: 3.5" HD
B /dev/fd1 12 80 2 9	# B: 3.5"
C /dev/hda1 16 0 0 0	# C: 30 MB HD partition

A portable /etc/mtools for floppies can be created by using zeroes for
the disk geometry:

# /etc/mtools - portable mtools device definitions

A /dev/fd0 12 0 0 0	# any A:
B /dev/fd1 12 0 0 0	# any B:

This has the slight disadvantage, that mformat refuses to work.


FAT type check
--------------

It is important to set the FAT type right because this parameter can't
be reliably computed from other parameters. Mtools tries to detect pos-
sibly incorrect settings and issues an error message. If this check
should be bypassed, the FAT type has to be specified as a negative
number, e.g.

D /dev/hda2 -16 0 0 0

Determining the correct FAT type is life critical for hard disks.
Writing to a hard disks with an incorrectly set FAT type will destroy
vital information. If you're not sure, whether you have a 12 or a 16
bit FAT, you should try reading a text file which is bigger than 8 kB
with the mtype command. You can use the commands mcd and mdir to locate
such a file. The FAT type is wrong if mtype outputs data from other
files after a while. The first few kilobytes will always be read
correctly, whether the FAT type is good or not.


Flushing of stdout, removal of gets
-----------------------------------

This is necessary to get prompts on Linux with "old" gcc 1.40. Newer
versions of gcc (libc, actually) don't have this problem.

All call to gets have been replaced by calls to fgets. Using gets is
bad programming practice and newer versions of gcc complain about
this.
