Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation.
/
' or '\
' separator. The use of the '\
' separator
or wildcards requires the names to be enclosed in quotes to protect them
from the shell. However, wildcards in Unix filenames should not be
enclosed in quotes, because here we want the shell to expand
them.
The regular expression "pattern matching" routines follow the Unix-style
rules. For example, `*
' matches all MS-DOS files in lieu of
`*.*
'. The archive, hidden, read-only and system attribute bits
are ignored during pattern matching.
All options use the -
(minus) as their first character, not
/
as you'd expect in MS-DOS.
Most mtools commands allow multiple filename parameters, which doesn't follow MS-DOS conventions, but which is more user-friendly.
Most mtools commands allow options that instruct them how to handle file
name clashes. See section Name clashes, for more details on these. All
commands accept the -V
flags which prints the version, and most
accept the -v
flag, which switches on verbose mode. In verbose
mode, these commands print out the name of the MS-DOS files upon which
they act, unless stated otherwise. See section Command list, for a description of
the options which are specific to each command.
The mcd
command (section Mcd) is used to establish the device and
the current working directory (relative to the MS-DOS filesystem),
otherwise the default is assumed to be A:/
. However, unlike
MS-DOS, there is only one working directory for all drives, and not one
per drive.
This version of mtools supports VFAT style long filenames. If a Unix filename is too long to fit in a short DOS name, it is stored as a VFAT long name, and a companion short name is generated. This short name is what you see when you examine the disk with a pre-7.0 version of DOS. The following table shows some examples of short names:
Long name MS-DOS name Reason for the change --------- ---------- --------------------- thisisatest THISIS~1 filename too long alain.knaff ALAIN~1.KNA extension too long prn.txt PRN~1.TXT PRN is a device name .abc ABC~1 null filename hot+cold HOT_CO~1 illegal character
As you see, the following transformations happen to derive a short name:
;+=[]',\"*\\<>/?:|
.
~
n number is generated,
The initial Unix-style file name (whether long or short) is also called the primary name, and the derived short name is also called the secondary name.
Example:
mcopy /etc/motd a:ReallylongnameMtools creates a VFAT entry for Reallylongname, and uses REALLYLO as a short name. Reallylongname is the primary name, and REALLYLO is the secondary name.
mcopy /etc/motd a:motdMotd fits into the DOS filename limits. Mtools doesn't need to derivate another name. Motd is the primary name, and there is no secondary name.
In a nutshell: The primary name is the long name, if one exists, or the short name if there is no long name.
Although VFAT is much more flexible than FAT, there are still names
that are not acceptable, even in VFAT. There are still some illegal
characters left (\"*\\<>/?:|
), and device names are still
reserved.
Unix name Long name Reason for the change --------- ---------- --------------------- prn prn-1 PRN is a device name ab:c ab_c-1 illegal character
As you see, the following transformations happen if a long name is illegal:
-
n number is generated,
When writing a file to disk, its long name (primary name) or short name
may collide with an already existing file or directory. This may happen
for all commands which create new directory entries, such as
mcopy
, mmd
, mren
, mmove
,
mwrite
and mread
. When a name clash happens, mtools
asks you what it should do. It offers several choices:
overwrite
rename
autorename
skip
To chose one of these actions, type its first letter at the prompt. If you use a lower case letter, the action only applies for this file only, if you use an upper case letter, the action applies to all files, and you won't be prompted again.
You may also chose actions (for all files) on the command line, when invoking mtools:
-o
-O
-r
-R
-a
-A
-s
-S
-m
-M
By default, the user is prompted if the primary name clashes, and the secondary name is autorenamed.
If a name clash occurs in a Unix directory, mtools only asks whether to overwrite the file, or to skip it.
The VFAT filesystem is able to remember the case of the filenames. However, filenames which differ only in case are not allowed to coexist in the same directory. For example if you store a file called LongFileName on a VFAT filesystem, mdir shows this file as LongFileName, and not as Longfilename. However, if you then try to add LongFilename to the same directory, it is refused, because case is ignored for clash checks.
The VFAT filesystem allows to store the case of a filename in the attribute byte, if all letters of the filename are the same case, and if all letters of the extension are the same case too. Mtools uses this information when displaying the files, and also to generate the Unix filename when mcopying to a Unix directory. This may have unexpected results when applied to files written using an pre-7.0 version of DOS: Indeed, the old style filenames map to all upper case. This is different from the behavior of the old version of mtools which used to generate lower case Unix filenames.
XDF is a high capacity format used by OS/2. It can hold 1840 K per
disk. That's lower than the best 2m formats, but its main advantage is
that it is fast: 600 milliseconds per track. That's faster than the 21
sector format, and almost as fast as the standard 18 sector format. In
order to access these disks, make sure mtools has been compiled with XDF
support, and set the use_xdf
variable for the drive in the
configuration file. See section Architecture specific compilation flags and section General Purpose Drive Variables,
for details on how to do this. Fast XDF access is only available for
Linux kernels which are more recent than 1.1.34.
Caution / Attention distributors: If mtools is compiled on a Linux kernel more recent than 1.3.34, it won't run on an older kernel. However, if it has been compiled on an older kernel, it still runs on a newer kernel, except that XDF access is slower. It is recommended that distribution authors only include mtools binaries compiled on kernels older than 1.3.34 until 2.0 comes out. When 2.0 will be out, mtools binaries compiled on newer kernels may (and should) be distributed. Mtools binaries compiled on kernels older than 1.3.34 won't run on any 2.1 kernel or later.
The fat checking code chokes on 1.72 Mb disks mformatted with pre-2.0.7 mtools. Set the environmental variable MTOOLS_FAT_COMPATIBILITY (or the corresponding configuration file variable, section Global variables) to bypass the fat checking.
The support for non-Linux OS variants has not been tested for a long time. It may contain bugs, or even not work at all.
This sections explains the syntax of the configurations files for mtools. The configuration files are called `/etc/mtools.conf' and `~/.mtoolsrc'. These configuration files describe the following items:
`/etc/mtools.conf' is the system-wide configuration file, and `~/.mtoolsrc' is the user's private configuration file.
On some systems, the system-wide configuration file is called `/etc/defaults/mtools.conf' instead.
The configuration files is made up of sections. Each section starts with a keyword identifying the section followed by a colon. Then follow variable assignments and flags. Variable assignments take the following form:
name=valueFlags are lone keywords without an equal sign and value following them. A section either ends at the end of the file or where the next section begins.
Lines starting with a hash (#
) are comments. Newline characters
are equivalent to whitespace (except where ending a comment). The
configuration file is case insensitive, except for item enclosed in
quotes (such as filenames).
Global variables may be set to 1 or to 0.
The following global flags are recognized:
MTOOLS_SKIP_CHECK
MTOOLS_FAT_COMPATIBILITY
MTOOLS_LOWER_CASE
Example: Inserting the following line into your configuration file instructs mtools to skip the sanity checks:
MTOOLS_SKIP_CHECK=1
Global variables may also be set via the environment:
export MTOOLS_SKIP_CHECK=1
Per drive flags and values may be described in a drive section. A
drive section starts with
drive
"driveletter" :
Then follow variable-value pairs and flags.
This is a sample drive description:
drive a: file="/dev/fd0" use_xdf=1
Geometry information describes the physical characteristics about the disk. Its has three purposes:
If no geometry information is supplied in the configuration file, all disks are accepted. On Linux (and on Sparc) there exist device nodes with configurable geometry (`/dev/fd0', `/dev/fd1' etc), and thus filtering is not needed (and ignored) for disk drives. (Mtools still does do filtering on plain files (disk images) in Linux: this is mainly intended for test purposes, as I don't have access to a Unix which would actually need filtering).
Wrong geometry information may lead to very bizarre errors. That's why I strongly recommend that you don't use geometry configuration unless you actually need it.
The following geometry related variables are available:
cylinders
cylinders
cylinders
is the preferred form,
tracks
is considered obsolete)
heads
sectors
Example: the following drive section describes a 1.44M drive:
drive a: file="/dev/fd0H1440" fat_bits=12 cylinders=80 heads=2 sectors=18
The following shorthand geometry descriptions are available:
1.44m
fat_bits=12 tracks=80 heads=2 sectors=18
1.2m
fat_bits=12 tracks=80 heads=2 sectors=15
720k
fat_bits=12 tracks=80 heads=2 sectors=9
360k
fat_bits=12 tracks=40 heads=2 sectors=9
The shorthand format descriptions may be amended. For example,
360k sectors=8
describes a 320k disk and is equivalent to:
fat_bits=12 tracks=40 heads=2 sectors=8
Moreover, the following flags are available:
sync
nodelay
exclusive
The following general purpose drive variables are available:
file
use_xdf
partition
offset
variable. The partition
variable
is intended for removable media such as Syquests, ZIP drives, and
magneto-optical disks. Although traditional DOS sees Syquests and
magneto-optical disks as `giant floppy disks' which are
unpartitioned, OS/2 and Windows NT treat them like hard disks,
i.e. partioned devices. The partition
flag is also useful DOSEMU
hdimages. It is not recommended for hard disks for which direct access
to partitions is available through mounting.
offset
fat_bits
Only the file
variable is mandatory. The other parameters may
be left out. In that case a default value or an autodetected value is
used.
It is possible to supply multiple descriptions for a drive. In that case, the descriptions are tried in order until one is found that fits. Descriptions may fail for several reasons:
Multiple definitions are useful when using physical devices which are only able to support one single disk geometry. Example:
drive a: file="/dev/fd0H1440" 1.44m drive a: file="/dev/fd0H720" 720k
This instructs mtools to use /dev/fd0H1440 for 1.44m (high density) disks and /dev/fd0H720 for 720k (double density) disks. On Linux, this feature is not really needed, as the /dev/fd0 device is able to handle any geometry.
You may also use multiple drive descriptions to access both of your physical drives through one drive letter:
drive z: file="/dev/fd0" drive z: file="/dev/fd1"
With this description, mdir z:
accesses your first physical
drive if it contains a disk. If the first drive doesn't contain a disk,
mtools checks the second drive.
When using multiple configuration files, drive descriptions in the files
parsed last override descriptions for the same drive in earlier
files. In order to avoid this, use the drive+
or +drive
keywords instead of drive
. The first adds a description to the
end of the list (i.e. it will be tried last), and the first adds it to
the start of the list.
If you live in the USA, in Western Europe or in Australia, you may skip this section.
DOS uses a different character code mapping than Unix. 7-bit characters still have the same meaning, only characters with the eight bit set are affected. To make matters worse, there are several translation tables available depending on the country where you are. The appearance of the characters is defined using code pages. These code pages aren't the same for all countries. For instance, some code pages don't contain upper case accented characters. On the other hand, some code pages contain characters which don't exist in Unix, such as certain line-drawing characters or accented consonants used by some Eastern European countries. This affects two things, relating to filenames:
Mtools considers the filenames entered on the command line as having the
Unix mapping, and translates the characters to get short names. By
default, code page 850 is used with the Swiss uppercase/lowercase
mapping. I chose this code page, because its set of existing characters
most closely matches Unix's. Moreover, this code page covers most
characters in use in the USA, Australia and Western Europe. However, it
is still possible to chose a different mapping. There are two methods:
the country
variable and explicit tables.
The COUNTRY
variable is recommended for people which also have
access to MS-DOS system files and documentation. If you don't have access
to these, I'd suggest you'd rather use explicit tables instead.
Syntax:
COUNTRY="
country[,[
codepage],
country-file]"
This tells mtools to use a Unix-to-DOS translation table which matches codepage and an lowercase-to-uppercase table for country and to use the country-file file to get the lowercase-to-uppercase table. The country code is most often the telephone prefix of the country. Refer to the DOS help page on "country" for more details. The codepage and the country-file parameters are optional. Please don't type in the square brackets, they are only there to say which parameters are optional. The country-file file is supplied with MS-DOS, and is usually called `COUNTRY.SYS', and stored in the `C:\DOS' directory. In most cases you don't need it, as the most common translation tables are compiled into mtools. So, don't worry if you run a Unix-only box which lacks this file.
If codepage is not given, a per country default code page is used. If the country-file parameter isn't given, compiled-in defaults are used for the lowercase-to-uppercase table. This is useful for other Unices than Linux, which may have no `COUNTRY.SYS' file available online.
The Unix-to-DOS are not contained in the `COUNTRY.SYS' file, and
thus mtools always uses compiled-in defaults for those. Thus, only a
limited amount of code pages are supported. If your preferred code page
is missing, or if you know the name of the Windows 95 file which
contains this mapping, could you please drop me a line at
Alain.Knaff@inrialpes.fr
.
The COUNTRY
variable can also be set using the environment.
Translation tables may be described in line in the configuration
file. Two tables are needed: first the DOS-to-Unix table, and then the
Lowercase-to-Uppercase table. A DOS-to-Unix table starts with the
tounix
keyword, followed by a colon, and 128 hexadecimal numbers.
A lower-to-upper table starts with the
fucase
keyword, followed by a colon, and 128 hexadecimal numbers.
The tables only show the translations for characters whose codes is greater than 128, because translation for lower codes is trivial.
tounix: 0xc7 0xfc 0xe9 0xe2 0xe4 0xe0 0xe5 0xe7 0xea 0xeb 0xe8 0xef 0xee 0xec 0xc4 0xc5 0xc9 0xe6 0xc6 0xf4 0xf6 0xf2 0xfb 0xf9 0xff 0xd6 0xdc 0xf8 0xa3 0xd8 0xd7 0x5f 0xe1 0xed 0xf3 0xfa 0xf1 0xd1 0xaa 0xba 0xbf 0xae 0xac 0xbd 0xbc 0xa1 0xab 0xbb 0x5f 0x5f 0x5f 0x5f 0x5f 0xc1 0xc2 0xc0 0xa9 0x5f 0x5f 0x5f 0x5f 0xa2 0xa5 0xac 0x5f 0x5f 0x5f 0x5f 0x5f 0x5f 0xe3 0xc3 0x5f 0x5f 0x5f 0x5f 0x5f 0x5f 0x5f 0xa4 0xf0 0xd0 0xc9 0xcb 0xc8 0x69 0xcd 0xce 0xcf 0x5f 0x5f 0x5f 0x5f 0x7c 0x49 0x5f 0xd3 0xdf 0xd4 0xd2 0xf5 0xd5 0xb5 0xfe 0xde 0xda 0xd9 0xfd 0xdd 0xde 0xaf 0xb4 0xad 0xb1 0x5f 0xbe 0xb6 0xa7 0xf7 0xb8 0xb0 0xa8 0xb7 0xb9 0xb3 0xb2 0x5f 0x5f fucase: 0x80 0x9a 0x90 0xb6 0x8e 0xb7 0x8f 0x80 0xd2 0xd3 0xd4 0xd8 0xd7 0xde 0x8e 0x8f 0x90 0x92 0x92 0xe2 0x99 0xe3 0xea 0xeb 0x59 0x99 0x9a 0x9d 0x9c 0x9d 0x9e 0x9f 0xb5 0xd6 0xe0 0xe9 0xa5 0xa5 0xa6 0xa7 0xa8 0xa9 0xaa 0xab 0xac 0xad 0xae 0xaf 0xb0 0xb1 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 0xb9 0xba 0xbb 0xbc 0xbd 0xbe 0xbf 0xc0 0xc1 0xc2 0xc3 0xc4 0xc5 0xc7 0xc7 0xc8 0xc9 0xca 0xcb 0xcc 0xcd 0xce 0xcf 0xd1 0xd1 0xd2 0xd3 0xd4 0x49 0xd6 0xd7 0xd8 0xd9 0xda 0xdb 0xdc 0xdd 0xde 0xdf 0xe0 0xe1 0xe2 0xe3 0xe5 0xe5 0xe6 0xe8 0xe8 0xe9 0xea 0xeb 0xed 0xed 0xee 0xef 0xf0 0xf1 0xf2 0xf3 0xf4 0xf5 0xf6 0xf7 0xf8 0xf9 0xfa 0xfb 0xfc 0xfd 0xfe 0xff
The first table maps DOS character codes to Unix character codes. For example, the DOS character number 129. This is a u with to dots on top of it. To translate it into Unix, we look at the character number 1 in the first table (1 = 129 - 128). This is 0xfc. (Beware, numbering starts at 0). The second table maps lower case DOS characters to upper case DOS characters. The same lower case u with dots maps to character 0x9a, which is an uppercase U with dots in DOS.
Caution: When deleting files with mtools, the underscore matches all characters which can't be represented in Unix. Be careful with mdel!
The configuration files are parsed in the following order:
Options described in the later files override those described in the
earlier files. Drives defined in earlier files persist if they are not
overridden in the later files. For instance, drives A and B may be
defined in `/etc/mtools.conf' and drives C and D may be defined
in `~/.mtoolsrc' However, if `~/.mtoolsrc' also defines
drive A, this new description would override the description of drive A
in `/etc/mtools.conf' instead of adding to it. If you want to add
a new description to a drive already described in an earlier file, you
need to use either the +drive
or drive+
keyword.
The syntax described herein is new for version mtools-3.0
. The
old line-oriented syntax is still supported. Each line beginning with a
single letter is considered to be a drive description using the old
syntax. Old style and new style drive sections may be mixed within the
same configuration file, in order to make upgrading easier. Support for
the old syntax will be phased out eventually, and in order to discourage
its use, I purposefully omit its description here.
This section describes the available mtools commands, and the command line parameters that each of them accepts. Options which are common to all mtools commands are not described here, section Options and filenames for a description of those.
Mattrib
is used to change MS-DOS file attribute flags. It has the
following syntax:
mattrib
[-a|+a
] [-h|+h
] [-r|+r
]
[-s|+s
] msdosfile [ msdosfiles ... ]
Mattrib
adds attribute flags to an MS-DOS file (with the
`+
' operator) or remove attribute flags (with the `-
'
operator).
Mattrib
supports the following attribute bits:
a
r
DEL
nor modified.
s
h
DIR
.
The mbadblocks
command is used to scan an MS-DOS floppy and mark
its unused bad blocks as bad. It uses the following syntax:
Mbadblocks
scans an MS-DOS floppy for bad blocks. All unused bad
blocks are marked as such in the FAT. This is intended to be used right
after mformat
. It is not intended to salvage bad disks.
Mbadblocks
should (but doesn't yet :-( ) also try to salvage bad
blocks which are in use by reading them repeatedly, and then mark them
bad.
The mcd
command is used to change the mtools working directory
on the MS-DOS disk. It uses the following syntax:
mcd
[msdosdirectory]
Without arguments, mcd
reports the current device and working
directory. Otherwise, mcd
changes the current device and current
working directory relative to an MS-DOS filesystem.
The environmental variable MCWD
may be used to locate the file
where the device and current working directory information is stored.
The default is `$HOME/.mcwd'. Information in this file is ignored
if the file is more than 6 hours old.
Mcd
returns 0 on success or 1 on failure.
Unlike MS-DOS versions of CD
, mcd
can be used to change to
another device. It may be wise to remove old `.mcwd' files at logout.
The mcopy
command is used to copy MS-DOS files to and from
Unix. It uses the following syntax:
mcopy
[-tnvmoOsSrRA
] sourcefile targetfilemcopy
[-tnvmoOsSrRA
] sourcefile [ sourcefiles... ] targetdirectorymcopy
[-tnvm
] MSDOSsourcefile
Mcopy
copies the specified file to the named file, or copies
multiple files to the named directory. The source and target can be
either MS-DOS or Unix files.
The use of a drive letter designation on the MS-DOS files, 'a:' for
example, determines the direction of the transfer. A missing drive
designation implies a Unix file whose path starts in the current
directory. If a source drive letter is specified with no attached file
name (e.g. mcopy a: .
), all files are copied from that drive.
If only a single, MS-DOS source parameter is provided (e.g. "mcopy
a:foo.exe"), an implied destination of the current directory
(`.
') is assumed.
A filename of `-
' means standard input or standard output, depending
on its position on the command line.
Mcopy
accepts the following command line options:
t
Mcopy
translates incoming carriage
return/line feeds to line feeds.
n
Mcopy
doesn't warn the user when overwriting an
existing file.
m
-n
option is not in effect, mcopy
asks whether to
overwrite the file or to rename the new file (section Name clashes) for
details).
mtype
to produce the same effect:
mtype a:file1 a:file2 a:file3 >unixfile mtype a:file1 a:file2 a:file3 | mcopy - a:msdosfile
The mdel
command is used to delete an MS-DOS file. Its syntax
is:
mdel
[-v
] msdosfile [ msdosfiles ... ]
Mdel
deletes files on an MS-DOS filesystem.
Mdel
asks for verification prior to removing a read-only file.
The mdeltree
command is used to delete an MS-DOS file. Its syntax
is:
mdeltree
[-v
] msdosdirectory [msdosdirectories...]
Mdeltree
removes a directory and all the files and subdirectories
it contains from an MS-DOS filesystem. An error occurs if the directory
to be removed does not exist.
The mdir
command is used to display an MS-DOS directory. Its
syntax is:
mdir
[-w
] msdosdirectory
mdir
[-w
] [-a
] msdosfile [ msdosfiles...]
Mdir
displays the contents of an MS-DOS directory.
Mdir
supports the following command line options:
w
mdir
prints the filenames across
the page without displaying the file size or creation date.
a
An error occurs if a component of the path is not a directory.
The mformat
command is used to add an MS-DOS filesystem to a
low-level formatted diskette. Its syntax is:
mformat
[-t
tracks] [-h
heads] [-s
sectors] [-l
volume_label] [-S
sizecode] [-2
sectors_on_track_0] [-M
software_sector_size] [-a
] [-X
] [-C
] [-H
hidden_sectors] drive:
Mformat
adds a minimal MS-DOS filesystem (boot sector, FAT, and
root directory) to a diskette that has already been formatted by a Unix
low-level format.
The follow options are supported: (The S, 2, 1 and M options may not exist if this copy of mtools has been compiled without the USE_2M option)
t
h
s
l
S
2
1
M
a
X
C
H
n
To format a diskette at a density other than the default, you must supply (at least) those command line parameters that are different from the default.
Mformat
returns 0 on success or 1 on failure.
It doesn't record bad block information to the Fat, use
mkmanifest
for that.
The mkmanifest
command is used to create a shell script (packing
list) to restore Unix filenames. Its syntax is:
mkmanifest
[ files ]
Mkmanifest
creates a shell script that aids in the restoration of
Unix filenames that got clobbered by the MS-DOS filename restrictions.
MS-DOS filenames are restricted to 8 character names, 3 character
extensions, upper case only, no device names, and no illegal characters.
The mkmanifest program is compatible with the methods used in
pcomm, arc,
and mtools
to change perfectly good Unix
filenames to fit the MS-DOS restrictions. This command is only useful if
the target system which will read the diskette cannot handle vfat long
names.
mcopy
command).
very_long_name 2.many.dots illegal: good.c prn.dev Capital
Mcopy
converts the names to:
very_lon 2xmany.dot illegalx good.c xprn.dev capital
The command:
mkmanifest very_long_name 2.many.dots illegal: good.c prn.dev Capital >manifestwould produce the following:
mv very_lon very_long_name mv 2xmany.dot 2.many.dots mv illegalx illegal: mv xprn.dev prn.dev mv capital Capital
Notice that "good.c" did not require any conversion, so it did not appear in the output.
Suppose I've copied these files from the diskette to another Unix system, and I now want the files back to their original names. If the file "manifest" (the output captured above) was sent along with those files, it could be used to convert the filenames.
The short names generated by mkmanifest
follow the old convention
(from mtools-2.0.7) and not the one from Windows 95 and mtools-3.0.
The mlabel
command adds a volume label to a disk. Its syntax is:
mlabel
[-vcs
] drive:[new_label]
Mlabel
displays the current volume label, if present. If
new_label is not given, and if neither the c
nor the
s
options are set, it prompts the user for a new volume label.
To delete an existing volume label, press return at the prompt.
Reasonable care is taken to create a valid MS-DOS volume label. If an
invalid label is specified, mlabel
changes the label (and
displays the new label if the verbose mode is set). Mlabel
returns 0 on success or 1 on failure.
Mlabel supports the following options:
c
s
The mmd
command is used to make an MS-DOS subdirectory. Its
syntax is:
mmd
[-voOsSrRA
] msdosdirectory [
msdosdirectories... ]
Mmd
makes a new directory on an MS-DOS filesystem. An error occurs
if the directory already exists.
The mmount
command is used to mount an MS-DOS disk. It is only
available on Linux, as it is only useful if the OS kernel allows to
configure the disk geometry. Its syntax is:
mmount
msdosdrive [mountargs]
Mmount
reads the boot sector of an MS-DOS disk, configures the drive geometry,
and finally mounts it passing
mountargs
to mount.
If no mount arguments are specified, the name of the device is
used. If the disk is write protected, it is automatically mounted read
only.
The mmove
command is used to moves or renames an existing MS-DOS
file or subdirectory.
mmove
[-voOsSrRA
] sourcefile targetfilemmove
[-voOsSrRA
] sourcefile [ sourcefiles... ] targetdirectory
Mmove
moves or renames an existing MS-DOS file or
subdirectory. Unlike the MS-DOS version of MOVE
, mmove
is
able to move subdirectories.
The mrd
command is used to remove an MS-DOS subdirectory. Its
syntax is:
mrd
[-v
] msdosdirectory [ msdosdirectories... ]
Mrd
removes a directory from an MS-DOS filesystem. An error occurs
if the directory does not exist or is not empty.
The mren
command is used to rename or move an existing MS-DOS
file or subdirectory. Its syntax is:
mren
[-voOsSrRA
] sourcefile targetfile
Mren
renames an existing file on an MS-DOS filesystem.
In verbose mode, Mren
displays the new filename if the name
supplied is invalid.
If the first syntax is used (only one sourcefile), and if the target
name doesn't contain any slashes or colons, the file (or subdirectory)
is renamed in the same directory, instead of being moved to the current
mcd
directory as would be the case with mmove
. Unlike the
MS-DOS version of REN
, mren
can be used to rename
directories.
The mtest
command is used to tests the mtools configuration
files. To invoke it, just type mtest
without any arguments.
Mtest
reads the mtools configuration files, and prints the
cumulative configuration to stdout
. The output can be used as a
configuration file itself (although you might want to remove redundant
clauses). You may use this program to convert old-style configuration
files into new style configuration files.
The mtype
command is used to display contents of an MS-DOS
file. Its syntax is:
mtype
[-ts
] msdosfile [ msdosfiles... ]
Mtype
displays the specified MS-DOS file on the screen.
In addition to the standard options, Mtype
allows the following
command line options:
t
Mtype
translates incoming carriage
return/line feeds to line feeds.
s
Mtype
strips the high bit from the data.
The mcd
command may be used to establish the device and the
current working directory (relative to MS-DOS), otherwise the default is
A:/
.
Mtype
returns 0 on success, 1 on utter failure, or 2 on partial
failure.
Unlike the MS-DOS version of TYPE
, mtype
allows multiple
arguments.
To compile mtools, first invoke ./configure
before
make
. In addition to the standard autoconfigure
flags,
there are two architecture specific flags available.
./configure --enable-xdf
./configure --disable-xdf
./configure --enable-vold
./configure --disable-vold
This chapter is only interesting for those who want to port mtools to an architecture which is not yet supported. For most common systems, default drives are already defined. If you want to add default drives for a still unsupported system, run config.guess, to see which identification autoconf uses for that system. This identification is of the form cpu-vendor-os (for example sparc-sun-sunos). The cpu and the os parts are passed to the compiler as preprocessor flags. The OS part is passed to the compiler in three forms.
All three versions are passed, if they are different.
To define the devices, use the entries for the systems that are already present as templates. In general, they have the following form:
#if (defined (my_cpu) && defined(my_os)) #define predefined_devices struct device devices[] = { { "/dev/first_drive", 'drive_letter', drive_description2, ... { "/dev/last_drive", 'drive_letter', drive_description2 } #define INIT_NOOP #endif
"/dev/first_drive" is the name of the device or image file representing the drive. Drive_letter is a letter ranging from a to z giving access to the drive. Drive_description describes the type of the drive:
ED312
HD312
DD312
HD514
DD514
DDsmall
SS514
SSsmall
GENFD
GENHD
GEN
Entries may be described in more detail:
fat_bits,open_flags,tracks,heads,sectors,offset,DEF_ARG
fat_bits
open_flags
tracks,heads,sectors
offset
Definition of defaults in the devices file should only be done if these same devices are found on a large number of hosts of this type. For purely local file, I recommend that you use the /etc/mtools.conf and ~/.mtoolsrc configuration files.
However, the devices files also allows to supply geometry setting routines. These are necessary if you want to access high capacity disks.
Two routines should be supplied:
static inline int get_parameters(int fd, struct generic_floppy_struct *floppy)
This probes the current configured geometry, and return it in the structure generic_floppy_struct (which must also be declared). Fd is an open file descriptor for the device, and buf is an already filled in stat structure, which may be useful. This routine should return 1 if the probing fails, and 0 otherwise.
static inline int set_parameters(int fd, struct generic_floppy_struct *floppy) struct stat buf)This configures the geometry contained in floppy on the file descriptor fd. Buf is the result of a stat call (already filled in). This should return 1 if the new geometry cannot be configured, and 0 otherwise.
A certain number of preprocessor macros should also be supplied:
TRACKS(floppy)
HEADS(floppy)
SECTORS(floppy)
SECTORS_PER_DISK(floppy) refers to the sectors per disk field in the
BLOCK_MAJOR
CHAR_MAJOR
For the truly high capacity formats (XDF, 2m, etc), there is no clean and documented interface yet.