xref: /aosp_15_r20/external/mtools/mtools.texi (revision d5c9a868b113e0ec0db2f27bc2ce8a253e77c4b0)
1*d5c9a868SElliott Hughes\input texinfo @c -*-texinfo-*-
2*d5c9a868SElliott Hughes@comment %**start of header
3*d5c9a868SElliott Hughes@setfilename mtools.info
4*d5c9a868SElliott Hughes@include version.texi
5*d5c9a868SElliott Hughes@settitle Mtools @value{VERSION}
6*d5c9a868SElliott Hughes@syncodeindex pg cp
7*d5c9a868SElliott Hughes@comment %**end of header
8*d5c9a868SElliott Hughes
9*d5c9a868SElliott Hughes@comment MANskip 5
10*d5c9a868SElliott Hughes
11*d5c9a868SElliott Hughes@copying
12*d5c9a868SElliott HughesThis manual is for Mtools (version @value{VERSION}, @value{UPDATED}),
13*d5c9a868SElliott Hugheswhich is a collection of tools to allow Unix systems to manipulate
14*d5c9a868SElliott HughesMS-DOS files.
15*d5c9a868SElliott Hughes
16*d5c9a868SElliott HughesCopyright @copyright{} 2007, 2009 Free Software Foundation, Inc.
17*d5c9a868SElliott HughesCopyright @copyright{} 1996-2005,2007-2011,2013 Alain Knaff.
18*d5c9a868SElliott Hughes
19*d5c9a868SElliott Hughes@quotation
20*d5c9a868SElliott HughesPermission is granted to copy, distribute and/or modify this document
21*d5c9a868SElliott Hughesunder the terms of the GNU Free Documentation License, Version 1.3 or
22*d5c9a868SElliott Hughesany later version published by the Free Software Foundation; with no
23*d5c9a868SElliott HughesInvariant Sections, with no Front-Cover Texts, and with no Back-Cover
24*d5c9a868SElliott HughesTexts.  A copy of the license is included in the section entitled
25*d5c9a868SElliott Hughes``GNU Free Documentation License''.
26*d5c9a868SElliott Hughes@end quotation
27*d5c9a868SElliott Hughes@end copying
28*d5c9a868SElliott Hughes
29*d5c9a868SElliott Hughes@ignore
30*d5c9a868SElliott Hughes@unnumbered Name
31*d5c9a868SElliott Hughesmtools - utilities to access DOS disks in Unix.
32*d5c9a868SElliott Hughes@end ignore
33*d5c9a868SElliott Hughes
34*d5c9a868SElliott Hughes@include sysconfdir.texi
35*d5c9a868SElliott Hughes
36*d5c9a868SElliott Hughes@iftex
37*d5c9a868SElliott Hughes@finalout
38*d5c9a868SElliott Hughes@end iftex
39*d5c9a868SElliott Hughes
40*d5c9a868SElliott Hughes@dircategory DOS
41*d5c9a868SElliott Hughes@direntry
42*d5c9a868SElliott Hughes* Mtools: (mtools).        Mtools: utilities to access DOS disks in Unix.
43*d5c9a868SElliott Hughes@end direntry
44*d5c9a868SElliott Hughes
45*d5c9a868SElliott Hughes
46*d5c9a868SElliott Hughes@titlepage
47*d5c9a868SElliott Hughes@title Mtools
48*d5c9a868SElliott Hughes
49*d5c9a868SElliott Hughes@c The following two commands start the copyright page.
50*d5c9a868SElliott Hughes@page
51*d5c9a868SElliott Hughes@vskip 0pt plus 1filll
52*d5c9a868SElliott Hughes@insertcopying
53*d5c9a868SElliott Hughes@end titlepage
54*d5c9a868SElliott Hughes
55*d5c9a868SElliott Hughes@c Output the table contents at the beginning
56*d5c9a868SElliott Hughes@contents
57*d5c9a868SElliott Hughes
58*d5c9a868SElliott Hughes@ifnottex
59*d5c9a868SElliott Hughes@node Top, Location, (dir), (dir)
60*d5c9a868SElliott Hughes@top Mtools doc
61*d5c9a868SElliott Hughes
62*d5c9a868SElliott HughesThis is mtools' documentation.
63*d5c9a868SElliott Hughes@end ifnottex
64*d5c9a868SElliott Hughes
65*d5c9a868SElliott Hughes@comment MANstart 1
66*d5c9a868SElliott Hughes
67*d5c9a868SElliott Hughes@unnumbered Introduction
68*d5c9a868SElliott HughesMtools is a collection of tools to allow Unix systems to manipulate
69*d5c9a868SElliott HughesMS-DOS files: read, write, and move around files on an MS-DOS
70*d5c9a868SElliott Hughesfile system (typically a floppy disk).  Where reasonable, each program
71*d5c9a868SElliott Hughesattempts to emulate the MS-DOS equivalent command. However,
72*d5c9a868SElliott Hughesunnecessary restrictions and oddities of DOS are not emulated. For
73*d5c9a868SElliott Hughesinstance, it is possible to move subdirectories from one subdirectory
74*d5c9a868SElliott Hughesto another.
75*d5c9a868SElliott Hughes
76*d5c9a868SElliott HughesMtools is sufficient to give access to MS-DOS file systems.  For
77*d5c9a868SElliott Hughesinstance, commands such as @code{mdir a:} work on the @code{a:} floppy
78*d5c9a868SElliott Hugheswithout any preliminary mounting or initialization (assuming the default
79*d5c9a868SElliott Hughes@file{@value{SYSCONFDIR}mtools.conf} works on your machine).  With mtools, one can
80*d5c9a868SElliott Hugheschange floppies too without unmounting and mounting.
81*d5c9a868SElliott Hughes
82*d5c9a868SElliott Hughes@insertcopying
83*d5c9a868SElliott Hughes
84*d5c9a868SElliott Hughes@menu
85*d5c9a868SElliott Hughes* Location::          Where to find mtools and early bug fixes
86*d5c9a868SElliott Hughes* Common features::   Common features of all mtools commands
87*d5c9a868SElliott Hughes* Configuration::     How to configure mtools for your environment
88*d5c9a868SElliott Hughes* Commands::          The available mtools commands
89*d5c9a868SElliott Hughes* Compiling mtools::  Architecture specific compilation flags
90*d5c9a868SElliott Hughes* Porting mtools::    Porting mtools to architectures which are not
91*d5c9a868SElliott Hughes                      yet supported
92*d5c9a868SElliott Hughes
93*d5c9a868SElliott Hughes* Command Index::     Command Index
94*d5c9a868SElliott Hughes* Variable Index::    Variable Index
95*d5c9a868SElliott Hughes* Concept Index::     Concept Index
96*d5c9a868SElliott Hughes@end menu
97*d5c9a868SElliott Hughes
98*d5c9a868SElliott Hughes@node Location, Common features, Top, Top
99*d5c9a868SElliott Hughes@chapter Where to get mtools
100*d5c9a868SElliott Hughes@cindex bugs
101*d5c9a868SElliott Hughes@cindex ALPHA patches
102*d5c9a868SElliott Hughes@cindex patches
103*d5c9a868SElliott Hughes@cindex diffs
104*d5c9a868SElliott Hughes@cindex mailing list
105*d5c9a868SElliott Hughes
106*d5c9a868SElliott HughesMtools can be found at the following places (and their mirrors):
107*d5c9a868SElliott Hughes@example
108*d5c9a868SElliott Hugheshttp://ftp.gnu.org/gnu/mtools/mtools-@value{VERSION}.tar.gz
109*d5c9a868SElliott Hughes@end example
110*d5c9a868SElliott Hughes
111*d5c9a868SElliott HughesThese patches are named
112*d5c9a868SElliott Hughes@code{mtools-}@var{version}@code{-}@var{ddmm}@code{.taz}, where version
113*d5c9a868SElliott Hughesstands for the base version, @var{dd} for the day and @var{mm} for the
114*d5c9a868SElliott Hughesmonth. Due to a lack of space, I usually leave only the most recent
115*d5c9a868SElliott Hughespatch.
116*d5c9a868SElliott Hughes
117*d5c9a868SElliott HughesThere is an mtools mailing list at info-mtools @@ gnu.org .  Please
118*d5c9a868SElliott Hughessend all bug reports to this list.  You may subscribe to the list at
119*d5c9a868SElliott Hugheshttps://lists.gnu.org/mailman/listinfo/info-mtools. (N.B. Please
120*d5c9a868SElliott Hughesremove the spaces around the "@@". I left them there in order to fool
121*d5c9a868SElliott Hughesspambots.)  Announcements of new mtools versions will also be sent to
122*d5c9a868SElliott Hughesthe list, in addition to the Linux announce newsgroups.  The mailing
123*d5c9a868SElliott Hugheslist is archived at http://lists.gnu.org/pipermail/info-mtools/
124*d5c9a868SElliott Hughes
125*d5c9a868SElliott Hughes
126*d5c9a868SElliott Hughes@node Common features, Configuration, Location, Top
127*d5c9a868SElliott Hughes@chapter Common features of all mtools commands
128*d5c9a868SElliott Hughes
129*d5c9a868SElliott Hughes@menu
130*d5c9a868SElliott Hughes* arguments::              What the command line parameters of mtools
131*d5c9a868SElliott Hughes                           mean
132*d5c9a868SElliott Hughes* drive letters::          Which drives are defined by default
133*d5c9a868SElliott Hughes* directory::              Current working directory
134*d5c9a868SElliott Hughes* long names::             VFAT-style long filenames
135*d5c9a868SElliott Hughes* name clashes::           Name clash handling, and associated command
136*d5c9a868SElliott Hughes                           line options
137*d5c9a868SElliott Hughes* case sensitivity::       Case sensitivity
138*d5c9a868SElliott Hughes* high capacity formats::  How to fit more data on your floppies
139*d5c9a868SElliott Hughes* exit codes::             Exit codes
140*d5c9a868SElliott Hughes* bugs::                   Happens to everybody
141*d5c9a868SElliott Hughes@end menu
142*d5c9a868SElliott Hughes
143*d5c9a868SElliott Hughes@node arguments, drive letters, Common features, Common features
144*d5c9a868SElliott Hughes@section Options and filenames
145*d5c9a868SElliott Hughes@cindex Filenames
146*d5c9a868SElliott Hughes@cindex Options
147*d5c9a868SElliott HughesMS-DOS filenames are composed of a drive letter followed by a colon, a
148*d5c9a868SElliott Hughessubdirectory, and a filename. Only the filename part is mandatory, the
149*d5c9a868SElliott Hughesdrive letter and the subdirectory are optional. Filenames without a
150*d5c9a868SElliott Hughesdrive letter refer to Unix files. Subdirectory names can use either the
151*d5c9a868SElliott Hughes'@code{/}' or '@code{\}' separator.  The use of the '@code{\}' separator
152*d5c9a868SElliott Hughesor wildcards requires the names to be enclosed in quotes to protect them
153*d5c9a868SElliott Hughesfrom the shell. However, wildcards in Unix filenames should not be
154*d5c9a868SElliott Hughesenclosed in quotes, because here we @strong{want} the shell to expand
155*d5c9a868SElliott Hughesthem.
156*d5c9a868SElliott Hughes
157*d5c9a868SElliott HughesThe regular expression "pattern matching" routines follow the Unix-style
158*d5c9a868SElliott Hughesrules.  For example, `@code{*}' matches all MS-DOS files in lieu of
159*d5c9a868SElliott Hughes`@code{*.*}'.  The archive, hidden, read-only and system attribute bits
160*d5c9a868SElliott Hughesare ignored during pattern matching.
161*d5c9a868SElliott Hughes
162*d5c9a868SElliott HughesAll options use the @code{-} (minus) as their first character, not
163*d5c9a868SElliott Hughes@code{/} as you'd expect in MS-DOS.
164*d5c9a868SElliott Hughes
165*d5c9a868SElliott HughesMost mtools commands allow multiple filename parameters, which
166*d5c9a868SElliott Hughesdoesn't follow MS-DOS conventions, but which is more user-friendly.
167*d5c9a868SElliott Hughes
168*d5c9a868SElliott HughesMost mtools commands allow options that instruct them how to handle
169*d5c9a868SElliott Hughesfile name clashes. @xref{name clashes}, for more details on these.
170*d5c9a868SElliott Hughes
171*d5c9a868SElliott HughesAll commands accept the @code{-i} flag which allows to specify an
172*d5c9a868SElliott Hughesimage file (@xref{drive letters}).
173*d5c9a868SElliott Hughes
174*d5c9a868SElliott HughesAll commands accept the @code{-V} flag which prints the version, and
175*d5c9a868SElliott Hughesmost accept the @code{-v} flag, which switches on verbose mode. In
176*d5c9a868SElliott Hughesverbose mode, these commands print out the name of the MS-DOS files
177*d5c9a868SElliott Hughesupon which they act, unless stated otherwise. @xref{Commands}, for a
178*d5c9a868SElliott Hughesdescription of the options which are specific to each command.
179*d5c9a868SElliott Hughes
180*d5c9a868SElliott Hughes@node drive letters, directory, arguments, Common features
181*d5c9a868SElliott Hughes@section Drive letters
182*d5c9a868SElliott Hughes
183*d5c9a868SElliott HughesThe meaning of the drive letters depends on the target architectures.
184*d5c9a868SElliott HughesHowever, on most target architectures, drive A is the first floppy
185*d5c9a868SElliott Hughesdrive, drive B is the second floppy drive (if available), drive J is a
186*d5c9a868SElliott HughesJaz drive (if available), and drive Z is a Zip drive (if available).  On
187*d5c9a868SElliott Hughesthose systems where the device name is derived from the SCSI id, the Jaz
188*d5c9a868SElliott Hughesdrive is assumed to be at SCSI target 4, and the Zip at SCSI target 5
189*d5c9a868SElliott Hughes(factory default settings).  On Linux, both drives are assumed to be the
190*d5c9a868SElliott Hughessecond drive on the SCSI bus (/dev/sdb). The default settings can be
191*d5c9a868SElliott Hugheschanges using a configuration file (@pxref{Configuration}).
192*d5c9a868SElliott Hughes
193*d5c9a868SElliott HughesThe drive letter : (colon) has a special meaning. It is used to access
194*d5c9a868SElliott Hughesimage files which are directly specified on the command line using the
195*d5c9a868SElliott Hughes@code{-i} options.
196*d5c9a868SElliott Hughes
197*d5c9a868SElliott HughesExample:
198*d5c9a868SElliott Hughes@example
199*d5c9a868SElliott Hughes mcopy -i my-image-file.bin ::file1 ::file2 .
200*d5c9a868SElliott Hughes@end example
201*d5c9a868SElliott Hughes
202*d5c9a868SElliott HughesThis copies @code{file1} and @code{file2} from the image file
203*d5c9a868SElliott Hughes(@code{my-image-file.bin}) to the @code{/tmp} directory.
204*d5c9a868SElliott Hughes
205*d5c9a868SElliott HughesYou can also supply an offset within the image file by including
206*d5c9a868SElliott Hughes@code{@@@@}@var{offset} into the file name.
207*d5c9a868SElliott Hughes
208*d5c9a868SElliott HughesExample:
209*d5c9a868SElliott Hughes@example
210*d5c9a868SElliott Hughes mcopy -i my-image-file.bin@@@@1M ::file1 ::file2 .
211*d5c9a868SElliott Hughes@end example
212*d5c9a868SElliott Hughes
213*d5c9a868SElliott HughesThis looks for the image at the offset of 1M in the file, rather than
214*d5c9a868SElliott Hughesat its beginning.
215*d5c9a868SElliott Hughes
216*d5c9a868SElliott Hughes@node directory, long names, drive letters, Common features
217*d5c9a868SElliott Hughes@section Current working directory
218*d5c9a868SElliott Hughes@pindex mcd (introduction)
219*d5c9a868SElliott Hughes@cindex Directory
220*d5c9a868SElliott Hughes@cindex Working directory
221*d5c9a868SElliott Hughes@cindex Current working directory
222*d5c9a868SElliott Hughes@cindex Default directory
223*d5c9a868SElliott Hughes
224*d5c9a868SElliott HughesThe @code{mcd} command (@ref{mcd}) is used to establish the device and
225*d5c9a868SElliott Hughesthe current working directory (relative to the MS-DOS file system),
226*d5c9a868SElliott Hughesotherwise the default is assumed to be @code{A:/}. However, unlike
227*d5c9a868SElliott HughesMS-DOS, there is only one working directory for all drives, and not one
228*d5c9a868SElliott Hughesper drive.
229*d5c9a868SElliott Hughes
230*d5c9a868SElliott Hughes@node long names, name clashes, directory, Common features
231*d5c9a868SElliott Hughes@section VFAT-style long file names
232*d5c9a868SElliott Hughes@cindex Long file name
233*d5c9a868SElliott Hughes@cindex Windows 95-style file names
234*d5c9a868SElliott Hughes@cindex VFAT-style file names
235*d5c9a868SElliott Hughes@cindex Primary file name (long names)
236*d5c9a868SElliott Hughes@cindex Secondary file name (long names)
237*d5c9a868SElliott Hughes
238*d5c9a868SElliott HughesThis version of mtools supports VFAT style long filenames. If a Unix
239*d5c9a868SElliott Hughesfilename is too long to fit in a short DOS name, it is stored as a
240*d5c9a868SElliott HughesVFAT long name, and a companion short name is generated. This short
241*d5c9a868SElliott Hughesname is what you see when you examine the disk with a pre-7.0 version
242*d5c9a868SElliott Hughesof DOS.
243*d5c9a868SElliott Hughes The following table shows some examples of short names:
244*d5c9a868SElliott Hughes
245*d5c9a868SElliott Hughes@example
246*d5c9a868SElliott HughesLong name       MS-DOS name     Reason for the change
247*d5c9a868SElliott Hughes---------       ----------      ---------------------
248*d5c9a868SElliott Hughesthisisatest     THISIS~1        filename too long
249*d5c9a868SElliott Hughesalain.knaff     ALAIN~1.KNA     extension too long
250*d5c9a868SElliott Hughesprn.txt         PRN~1.TXT       PRN is a device name
251*d5c9a868SElliott Hughes.abc            ABC~1           null filename
252*d5c9a868SElliott Hugheshot+cold        HOT_CO~1        illegal character
253*d5c9a868SElliott Hughes@end example
254*d5c9a868SElliott Hughes
255*d5c9a868SElliott Hughes As you see, the following transformations happen to derive a short
256*d5c9a868SElliott Hughesname:
257*d5c9a868SElliott Hughes@itemize @bullet
258*d5c9a868SElliott Hughes@item
259*d5c9a868SElliott HughesIllegal characters are replaced by underscores. The illegal characters
260*d5c9a868SElliott Hughesare @code{;+=[]',\"*\\<>/?:|}.
261*d5c9a868SElliott Hughes@item
262*d5c9a868SElliott HughesExtra dots, which cannot be interpreted as a main name/extension
263*d5c9a868SElliott Hughesseparator are removed
264*d5c9a868SElliott Hughes@item
265*d5c9a868SElliott HughesA @code{~}@var{n} number is generated,
266*d5c9a868SElliott Hughes@item
267*d5c9a868SElliott HughesThe name is shortened so as to fit in the 8+3 limitation
268*d5c9a868SElliott Hughes@end itemize
269*d5c9a868SElliott Hughes
270*d5c9a868SElliott Hughes The initial Unix-style file name (whether long or short) is also called
271*d5c9a868SElliott Hughesthe @dfn{primary} name, and the derived short name is also called the
272*d5c9a868SElliott Hughes@dfn{secondary} name.
273*d5c9a868SElliott Hughes
274*d5c9a868SElliott Hughes Example:
275*d5c9a868SElliott Hughes@example
276*d5c9a868SElliott Hughes mcopy /etc/motd a:Reallylongname
277*d5c9a868SElliott Hughes@end example
278*d5c9a868SElliott Hughes Mtools creates a VFAT entry for Reallylongname, and uses REALLYLO as
279*d5c9a868SElliott Hughesa short name. Reallylongname is the primary name, and REALLYLO is the
280*d5c9a868SElliott Hughessecondary name.
281*d5c9a868SElliott Hughes@example
282*d5c9a868SElliott Hughes mcopy /etc/motd a:motd
283*d5c9a868SElliott Hughes@end example
284*d5c9a868SElliott Hughes Motd fits into the DOS filename limits. Mtools doesn't need to
285*d5c9a868SElliott Hughesderivate another name. Motd is the primary name, and there is no
286*d5c9a868SElliott Hughessecondary name.
287*d5c9a868SElliott Hughes
288*d5c9a868SElliott Hughes In a nutshell: The primary name is the long name, if one exists, or
289*d5c9a868SElliott Hughesthe short name if there is no long name.
290*d5c9a868SElliott Hughes
291*d5c9a868SElliott Hughes Although VFAT is much more flexible than FAT, there are still names
292*d5c9a868SElliott Hughesthat are not acceptable, even in VFAT. There are still some illegal
293*d5c9a868SElliott Hughescharacters left (@code{\"*\\<>/?:|}), and device names are still
294*d5c9a868SElliott Hughesreserved.
295*d5c9a868SElliott Hughes
296*d5c9a868SElliott Hughes@example
297*d5c9a868SElliott HughesUnix name       Long name       Reason for the change
298*d5c9a868SElliott Hughes---------       ----------      ---------------------
299*d5c9a868SElliott Hughesprn             prn-1           PRN is a device name
300*d5c9a868SElliott Hughesab:c            ab_c-1          illegal character
301*d5c9a868SElliott Hughes@end example
302*d5c9a868SElliott Hughes
303*d5c9a868SElliott Hughes As you see, the following transformations happen if a long name is
304*d5c9a868SElliott Hughesillegal:
305*d5c9a868SElliott Hughes@itemize @bullet
306*d5c9a868SElliott Hughes@item
307*d5c9a868SElliott HughesIllegal characters are replaces by underscores,
308*d5c9a868SElliott Hughes@item
309*d5c9a868SElliott HughesA @code{-}@var{n} number is generated,
310*d5c9a868SElliott Hughes@end itemize
311*d5c9a868SElliott Hughes
312*d5c9a868SElliott Hughes@node name clashes, case sensitivity, long names, Common features
313*d5c9a868SElliott Hughes@section Name clashes
314*d5c9a868SElliott Hughes@cindex Name clashes
315*d5c9a868SElliott Hughes@cindex Duplicate file names
316*d5c9a868SElliott Hughes@cindex Overwriting files
317*d5c9a868SElliott Hughes@cindex Primary file name (name clashes)
318*d5c9a868SElliott Hughes@cindex Secondary file name (name clashes)
319*d5c9a868SElliott Hughes
320*d5c9a868SElliott HughesWhen writing a file to disk, its long name or short name may collide
321*d5c9a868SElliott Hugheswith an already existing file or directory. This may happen for all
322*d5c9a868SElliott Hughescommands which create new directory entries, such as @code{mcopy},
323*d5c9a868SElliott Hughes@code{mmd}, @code{mren}, @code{mmove}. When a name clash happens, mtools
324*d5c9a868SElliott Hughesasks you what it should do. It offers several choices:
325*d5c9a868SElliott Hughes
326*d5c9a868SElliott Hughes@table @code
327*d5c9a868SElliott Hughes@item overwrite
328*d5c9a868SElliott HughesOverwrites the existing file. It is not possible to overwrite a
329*d5c9a868SElliott Hughesdirectory with a file.
330*d5c9a868SElliott Hughes@item rename
331*d5c9a868SElliott HughesRenames the newly created file. Mtools prompts for the new filename
332*d5c9a868SElliott Hughes@item autorename
333*d5c9a868SElliott HughesRenames the newly created file. Mtools chooses a name by itself, without
334*d5c9a868SElliott Hughesprompting
335*d5c9a868SElliott Hughes@item skip
336*d5c9a868SElliott HughesGives up on this file, and moves on to the next (if any)
337*d5c9a868SElliott Hughes@end table
338*d5c9a868SElliott Hughes
339*d5c9a868SElliott HughesTo chose one of these actions, type its first letter at the prompt. If
340*d5c9a868SElliott Hughesyou use a lower case letter, the action only applies for this file only,
341*d5c9a868SElliott Hughesif you use an upper case letter, the action applies to all files, and
342*d5c9a868SElliott Hughesyou won't be prompted again.
343*d5c9a868SElliott Hughes
344*d5c9a868SElliott HughesYou may also chose actions (for all files) on the command line, when
345*d5c9a868SElliott Hughesinvoking mtools:
346*d5c9a868SElliott Hughes
347*d5c9a868SElliott Hughes@table @code
348*d5c9a868SElliott Hughes@item -D o
349*d5c9a868SElliott HughesOverwrites primary names by default.
350*d5c9a868SElliott Hughes@item -D O
351*d5c9a868SElliott HughesOverwrites secondary names by default.
352*d5c9a868SElliott Hughes@item -D r
353*d5c9a868SElliott HughesRenames primary name by default.
354*d5c9a868SElliott Hughes@item -D R
355*d5c9a868SElliott HughesRenames secondary name by default.
356*d5c9a868SElliott Hughes@item -D a
357*d5c9a868SElliott HughesAutorenames primary name by default.
358*d5c9a868SElliott Hughes@item -D A
359*d5c9a868SElliott HughesAutorenames secondary name by default.
360*d5c9a868SElliott Hughes@item -D s
361*d5c9a868SElliott HughesSkip primary name by default.
362*d5c9a868SElliott Hughes@item -D S
363*d5c9a868SElliott HughesSkip secondary name by default.
364*d5c9a868SElliott Hughes@item -D m
365*d5c9a868SElliott HughesAsk user what to do with primary name.
366*d5c9a868SElliott Hughes@item -D M
367*d5c9a868SElliott HughesAsk user what to do with secondary name.
368*d5c9a868SElliott Hughes@end table
369*d5c9a868SElliott Hughes
370*d5c9a868SElliott HughesNote that for command line switches lower/upper differentiates between
371*d5c9a868SElliott Hughesprimary/secondary name whereas for interactive choices, lower/upper
372*d5c9a868SElliott Hughesdifferentiates between just-this-time/always.
373*d5c9a868SElliott Hughes
374*d5c9a868SElliott HughesThe primary name is the name as displayed in Windows 95 or Windows NT:
375*d5c9a868SElliott Hughesi.e. the long name if it exists, and the short name otherwise.  The
376*d5c9a868SElliott Hughessecondary name is the "hidden" name, i.e. the short name if a long name
377*d5c9a868SElliott Hughesexists.
378*d5c9a868SElliott Hughes
379*d5c9a868SElliott HughesBy default, the user is prompted if the primary name clashes, and the
380*d5c9a868SElliott Hughessecondary name is autorenamed.
381*d5c9a868SElliott Hughes
382*d5c9a868SElliott HughesIf a name clash occurs in a Unix directory, mtools only asks whether
383*d5c9a868SElliott Hughesto overwrite the file, or to skip it.
384*d5c9a868SElliott Hughes
385*d5c9a868SElliott Hughes@node case sensitivity, high capacity formats, name clashes, Common features
386*d5c9a868SElliott Hughes@section Case sensitivity of the VFAT file system
387*d5c9a868SElliott Hughes@cindex Case sensitivity
388*d5c9a868SElliott Hughes
389*d5c9a868SElliott HughesThe VFAT file system is able to remember the case of the
390*d5c9a868SElliott Hughesfilenames. However, filenames which differ only in case are not allowed
391*d5c9a868SElliott Hughesto coexist in the same directory. For example if you store a file called
392*d5c9a868SElliott HughesLongFileName on a VFAT file system, mdir shows this file as LongFileName,
393*d5c9a868SElliott Hughesand not as Longfilename. However, if you then try to add LongFilename to
394*d5c9a868SElliott Hughesthe same directory, it is refused, because case is ignored for clash
395*d5c9a868SElliott Hugheschecks.
396*d5c9a868SElliott Hughes
397*d5c9a868SElliott HughesThe VFAT file system allows you to store the case of a filename in the
398*d5c9a868SElliott Hughesattribute byte, if all letters of the filename are the same case, and if
399*d5c9a868SElliott Hughesall letters of the extension are the same case too. Mtools uses this
400*d5c9a868SElliott Hughesinformation when displaying the files, and also to generate the Unix
401*d5c9a868SElliott Hughesfilename when mcopying to a Unix directory. This may have unexpected
402*d5c9a868SElliott Hughesresults when applied to files written using an pre-7.0 version of DOS:
403*d5c9a868SElliott HughesIndeed, the old style filenames map to all upper case. This is different
404*d5c9a868SElliott Hughesfrom the behavior of the old version of mtools which used to generate
405*d5c9a868SElliott Hugheslower case Unix filenames.
406*d5c9a868SElliott Hughes
407*d5c9a868SElliott Hughes@node high capacity formats, exit codes, case sensitivity, Common features
408*d5c9a868SElliott Hughes@section high capacity formats
409*d5c9a868SElliott Hughes@cindex Special formats
410*d5c9a868SElliott Hughes@cindex High capacity formats
411*d5c9a868SElliott Hughes@cindex Odd formats
412*d5c9a868SElliott Hughes@cindex Weird formats
413*d5c9a868SElliott Hughes@cindex Formats, high capacity
414*d5c9a868SElliott Hughes@cindex Linux enhancements (High Capacity Formats)
415*d5c9a868SElliott Hughes
416*d5c9a868SElliott HughesMtools supports a number of formats which allow storage of more data on
417*d5c9a868SElliott Hughesdisk than usual. Due to different operating system abilities, these
418*d5c9a868SElliott Hughesformats are not supported on all operating systems. Mtools recognizes
419*d5c9a868SElliott Hughesthese formats transparently where supported.
420*d5c9a868SElliott Hughes
421*d5c9a868SElliott HughesIn order to format these disks, you need to use an operating system
422*d5c9a868SElliott Hughesspecific tool. For Linux, suitable floppy tools can be found in the
423*d5c9a868SElliott Hughes@code{fdutils} package at the following locations~:
424*d5c9a868SElliott Hughes@example
425*d5c9a868SElliott Hughes@code{http://www.fdutils.linux.lu/}.
426*d5c9a868SElliott Hughes@end example
427*d5c9a868SElliott Hughes
428*d5c9a868SElliott HughesSee the manual pages included in that package for further detail: Use
429*d5c9a868SElliott Hughes@code{superformat} to format all formats except XDF, and use
430*d5c9a868SElliott Hughes@code{xdfcopy} to format XDF.
431*d5c9a868SElliott Hughes
432*d5c9a868SElliott Hughes@menu
433*d5c9a868SElliott Hughes* more sectors::      Putting more sectors per track on the disk
434*d5c9a868SElliott Hughes* bigger sectors::    Use bigger sectors to save header space
435*d5c9a868SElliott Hughes* 2m::                Use a standard first track
436*d5c9a868SElliott Hughes* XDF::               OS/2's eXtended density format
437*d5c9a868SElliott Hughes@end menu
438*d5c9a868SElliott Hughes
439*d5c9a868SElliott Hughes@node more sectors, bigger sectors, high capacity formats, high capacity formats
440*d5c9a868SElliott Hughes@subsection More sectors
441*d5c9a868SElliott Hughes@cindex fdformat
442*d5c9a868SElliott Hughes@cindex vgacopy
443*d5c9a868SElliott Hughes@cindex DMF disks
444*d5c9a868SElliott Hughes@cindex Windows 95 (DMF disks)
445*d5c9a868SElliott Hughes
446*d5c9a868SElliott HughesThe oldest method of fitting more data on a disk is to use more sectors
447*d5c9a868SElliott Hughesand more cylinders. Although the standard format uses 80 cylinders and
448*d5c9a868SElliott Hughes18 sectors (on a 3 1/2 high density disk), it is possible to use up to
449*d5c9a868SElliott Hughes83 cylinders (on most drives) and up to 21 sectors. This method allows
450*d5c9a868SElliott Hughesto store up to 1743K on a 3 1/2 HD disk. However, 21 sector disks are
451*d5c9a868SElliott Hughestwice as slow as the standard 18 sector disks because the sectors are
452*d5c9a868SElliott Hughespacked so close together that we need to interleave them. This problem
453*d5c9a868SElliott Hughesdoesn't exist for 20 sector formats.
454*d5c9a868SElliott Hughes
455*d5c9a868SElliott HughesThese formats are supported by numerous DOS shareware utilities such as
456*d5c9a868SElliott Hughes@code{fdformat} and @code{vgacopy}. In his infinite hubris, Bill Gate$
457*d5c9a868SElliott Hughesbelieved that he invented this, and called it @samp{DMF disks}, or
458*d5c9a868SElliott Hughes@samp{Windows formatted disks}. But in reality, it has already existed
459*d5c9a868SElliott Hughesyears before! Mtools supports these formats on Linux, on SunOS and on
460*d5c9a868SElliott Hughesthe DELL Unix PC.
461*d5c9a868SElliott Hughes
462*d5c9a868SElliott Hughes@node bigger sectors, 2m, more sectors, high capacity formats
463*d5c9a868SElliott Hughes@subsection Bigger sectors
464*d5c9a868SElliott Hughes@cindex bigger sectors
465*d5c9a868SElliott HughesBy using bigger sectors it is possible to go beyond the capacity which
466*d5c9a868SElliott Hughescan be obtained by the standard 512-byte sectors. This is because of the
467*d5c9a868SElliott Hughessector header. The sector header has the same size, regardless of how
468*d5c9a868SElliott Hughesmany data bytes are in the sector. Thus, we save some space by using
469*d5c9a868SElliott Hughes@emph{fewer}, but bigger sectors. For example, 1 sector of 4K only takes
470*d5c9a868SElliott Hughesup header space once, whereas 8 sectors of 512 bytes have also 8
471*d5c9a868SElliott Hughesheaders, for the same amount of useful data.
472*d5c9a868SElliott Hughes
473*d5c9a868SElliott HughesThis method permits storage of up to 1992K on a 3 1/2 HD disk.
474*d5c9a868SElliott Hughes
475*d5c9a868SElliott HughesMtools supports these formats only on Linux.
476*d5c9a868SElliott Hughes
477*d5c9a868SElliott Hughes@node 2m, XDF, bigger sectors, high capacity formats
478*d5c9a868SElliott Hughes@subsection 2m
479*d5c9a868SElliott Hughes@cindex 2m
480*d5c9a868SElliott Hughes
481*d5c9a868SElliott HughesThe 2m format was originally invented by Ciriaco Garcia de Celis. It
482*d5c9a868SElliott Hughesalso uses bigger sectors than usual in order to fit more data on the
483*d5c9a868SElliott Hughesdisk.  However, it uses the standard format (18 sectors of 512 bytes
484*d5c9a868SElliott Hugheseach) on the first cylinder, in order to make these disks easier to
485*d5c9a868SElliott Hugheshandle by DOS. Indeed this method allows you to have a standard sized
486*d5c9a868SElliott Hughesboot sector, which contains a description of how the rest of the disk
487*d5c9a868SElliott Hughesshould be read.
488*d5c9a868SElliott Hughes
489*d5c9a868SElliott HughesHowever, the drawback of this is that the first cylinder can hold less
490*d5c9a868SElliott Hughesdata than the others. Unfortunately, DOS can only handle disks where
491*d5c9a868SElliott Hugheseach track contains the same amount of data. Thus 2m hides the fact that
492*d5c9a868SElliott Hughesthe first track contains less data by using a @dfn{shadow
493*d5c9a868SElliott HughesFAT}. (Usually, DOS stores the FAT in two identical copies, for
494*d5c9a868SElliott Hughesadditional safety.  XDF stores only one copy, but tells DOS that it
495*d5c9a868SElliott Hughesstores two. Thus the space that would be taken up by the second FAT copy
496*d5c9a868SElliott Hughesis saved.) This also means that you should @strong{never use a 2m disk
497*d5c9a868SElliott Hughesto store anything else than a DOS file system}.
498*d5c9a868SElliott Hughes
499*d5c9a868SElliott HughesMtools supports these formats only on Linux.
500*d5c9a868SElliott Hughes
501*d5c9a868SElliott Hughes@node XDF, , 2m, high capacity formats
502*d5c9a868SElliott Hughes@subsection XDF
503*d5c9a868SElliott Hughes@cindex XDF disks
504*d5c9a868SElliott Hughes@cindex OS/2 (XDF disks)
505*d5c9a868SElliott Hughes
506*d5c9a868SElliott HughesXDF is a high capacity format used by OS/2. It can hold 1840 K per
507*d5c9a868SElliott Hughesdisk. That's lower than the best 2m formats, but its main advantage is
508*d5c9a868SElliott Hughesthat it is fast: 600 milliseconds per track. That's faster than the 21
509*d5c9a868SElliott Hughessector format, and almost as fast as the standard 18 sector format. In
510*d5c9a868SElliott Hughesorder to access these disks, make sure mtools has been compiled with XDF
511*d5c9a868SElliott Hughessupport, and set the @code{use_xdf} variable for the drive in the
512*d5c9a868SElliott Hughesconfiguration file. @xref{Compiling mtools}, and @ref{miscellaneous variables},
513*d5c9a868SElliott Hughesfor details on how to do this. Fast XDF access is only available for
514*d5c9a868SElliott HughesLinux kernels which are more recent than 1.1.34.
515*d5c9a868SElliott Hughes
516*d5c9a868SElliott HughesMtools supports this format only on Linux.
517*d5c9a868SElliott Hughes
518*d5c9a868SElliott Hughes@strong{Caution / Attention distributors}: If mtools is compiled on a
519*d5c9a868SElliott HughesLinux kernel more recent than 1.3.34, it won't run on an older
520*d5c9a868SElliott Hugheskernel. However, if it has been compiled on an older kernel, it still
521*d5c9a868SElliott Hughesruns on a newer kernel, except that XDF access is slower. It is
522*d5c9a868SElliott Hughesrecommended that distribution authors only include mtools binaries
523*d5c9a868SElliott Hughescompiled on kernels older than 1.3.34 until 2.0 comes out. When 2.0 will
524*d5c9a868SElliott Hughesbe out, mtools binaries compiled on newer kernels may (and should) be
525*d5c9a868SElliott Hughesdistributed. Mtools binaries compiled on kernels older than 1.3.34 won't
526*d5c9a868SElliott Hughesrun on any 2.1 kernel or later.
527*d5c9a868SElliott Hughes
528*d5c9a868SElliott Hughes@node exit codes, bugs, high capacity formats, Common features
529*d5c9a868SElliott Hughes@section Exit codes
530*d5c9a868SElliott HughesAll the Mtools commands return 0 on success, 1 on utter failure, or 2
531*d5c9a868SElliott Hugheson partial failure.  All the Mtools commands perform a few sanity
532*d5c9a868SElliott Hugheschecks before going ahead, to make sure that the disk is indeed an
533*d5c9a868SElliott HughesMS-DOS disk (as opposed to, say an ext2 or MINIX disk). These checks
534*d5c9a868SElliott Hughesmay reject partially corrupted disks, which might otherwise still be
535*d5c9a868SElliott Hughesreadable. To avoid these checks, set the MTOOLS_SKIP_CHECK
536*d5c9a868SElliott Hughesenvironmental variable or the corresponding configuration file variable
537*d5c9a868SElliott Hughes(@pxref{global variables})
538*d5c9a868SElliott Hughes@node bugs, , exit codes, Common features
539*d5c9a868SElliott Hughes@section Bugs
540*d5c9a868SElliott HughesAn unfortunate side effect of not guessing the proper device (when
541*d5c9a868SElliott Hughesmultiple disk capacities are supported) is an occasional error message
542*d5c9a868SElliott Hughesfrom the device driver.  These can be safely ignored.
543*d5c9a868SElliott Hughes
544*d5c9a868SElliott HughesThe fat checking code chokes on 1.72 Mb disks mformatted with pre-2.0.7
545*d5c9a868SElliott Hughesmtools. Set the environmental variable MTOOLS_FAT_COMPATIBILITY (or the
546*d5c9a868SElliott Hughescorresponding configuration file variable, @ref{global variables}) to
547*d5c9a868SElliott Hughesbypass the fat checking.
548*d5c9a868SElliott Hughes
549*d5c9a868SElliott Hughes@comment MANskip 1
550*d5c9a868SElliott Hughes
551*d5c9a868SElliott Hughes@ignore
552*d5c9a868SElliott Hughes@unnumbered Name
553*d5c9a868SElliott Hughesmtools.conf - mtools configuration files
554*d5c9a868SElliott Hughes
555*d5c9a868SElliott Hughes@comment MANend-skip 5
556*d5c9a868SElliott Hughes@section Description
557*d5c9a868SElliott Hughes
558*d5c9a868SElliott HughesThis manual page describes the configuration files for mtools. They
559*d5c9a868SElliott Hughes@comment MANskip 5
560*d5c9a868SElliott Hughes@end ignore
561*d5c9a868SElliott Hughes
562*d5c9a868SElliott Hughes
563*d5c9a868SElliott Hughes@node Configuration, Commands, Common features, Top
564*d5c9a868SElliott Hughes
565*d5c9a868SElliott Hughes
566*d5c9a868SElliott Hughes@chapter How to configure mtools for your environment
567*d5c9a868SElliott Hughes@section Description
568*d5c9a868SElliott Hughes@cindex Configuration files
569*d5c9a868SElliott Hughes@vindex MTOOLSRC
570*d5c9a868SElliott Hughes
571*d5c9a868SElliott Hughes This sections explains the syntax of the configurations files for
572*d5c9a868SElliott Hughesmtools. The configuration files
573*d5c9a868SElliott Hughes@comment MANend-skip 5
574*d5c9a868SElliott Hughesare called @file{@value{SYSCONFDIR}mtools.conf} and @file{~/.mtoolsrc}. If
575*d5c9a868SElliott Hughesthe environmental variable @code{MTOOLSRC} is set, its contents is used
576*d5c9a868SElliott Hughesas the filename for a third configuration file. These configuration
577*d5c9a868SElliott Hughesfiles describe the following items:
578*d5c9a868SElliott Hughes
579*d5c9a868SElliott Hughes@itemize @bullet
580*d5c9a868SElliott Hughes@item Global configuration flags and variables
581*d5c9a868SElliott Hughes@item Per drive flags and variables
582*d5c9a868SElliott Hughes@end itemize
583*d5c9a868SElliott Hughes
584*d5c9a868SElliott Hughes
585*d5c9a868SElliott Hughes@menu
586*d5c9a868SElliott Hughes* configuration file location::  Where mtools looks for its configuration files
587*d5c9a868SElliott Hughes* general syntax::        The layout of the configuration files
588*d5c9a868SElliott Hughes* default values::        Why you don't need a configuration file in most cases
589*d5c9a868SElliott Hughes* global variables::      Variables that are independent of the drive
590*d5c9a868SElliott Hughes* per drive variables::   Variables that are specific to a given drive
591*d5c9a868SElliott Hughes* parsing order::         Location of configuration files and parsing order
592*d5c9a868SElliott Hughes* old style configuration::      Backwards compatibility
593*d5c9a868SElliott Hughes@end menu
594*d5c9a868SElliott Hughes
595*d5c9a868SElliott Hughes@node configuration file location, general syntax, Configuration, Configuration
596*d5c9a868SElliott Hughes@section Location of the configuration files
597*d5c9a868SElliott Hughes
598*d5c9a868SElliott Hughes@cindex Configuration file name
599*d5c9a868SElliott Hughes@cindex Name of configuration files
600*d5c9a868SElliott Hughes@cindex Location of configuration files
601*d5c9a868SElliott Hughes
602*d5c9a868SElliott Hughes@file{@value{SYSCONFDIR}mtools.conf} is the system-wide configuration file,
603*d5c9a868SElliott Hughesand @file{~/.mtoolsrc} is the user's private configuration file.
604*d5c9a868SElliott Hughes
605*d5c9a868SElliott HughesOn some systems, the system-wide configuration file is called
606*d5c9a868SElliott Hughes@file{/etc/default/mtools.conf} instead.
607*d5c9a868SElliott Hughes
608*d5c9a868SElliott Hughes
609*d5c9a868SElliott Hughes@node general syntax, default values, configuration file location, Configuration
610*d5c9a868SElliott Hughes@subsection General configuration file syntax
611*d5c9a868SElliott Hughes@cindex Syntax of the configuration file
612*d5c9a868SElliott Hughes@cindex Configuration file syntax
613*d5c9a868SElliott Hughes
614*d5c9a868SElliott HughesThe configuration files is made up of sections. Each section starts
615*d5c9a868SElliott Hugheswith a keyword identifying the section followed by a colon.
616*d5c9a868SElliott HughesThen follow variable assignments and flags. Variable assignments take
617*d5c9a868SElliott Hughesthe following form:
618*d5c9a868SElliott Hughes@display
619*d5c9a868SElliott Hughesname=value
620*d5c9a868SElliott Hughes@end display
621*d5c9a868SElliott HughesFlags are lone keywords without an equal sign and value following
622*d5c9a868SElliott Hughesthem.  A section either ends at the end of the file or where the next
623*d5c9a868SElliott Hughessection begins.
624*d5c9a868SElliott Hughes
625*d5c9a868SElliott HughesLines starting with a hash (@code{#}) are comments. Newline characters
626*d5c9a868SElliott Hughesare equivalent to whitespace (except where ending a comment). The
627*d5c9a868SElliott Hughesconfiguration file is case insensitive, except for item enclosed in
628*d5c9a868SElliott Hughesquotes (such as filenames).
629*d5c9a868SElliott Hughes
630*d5c9a868SElliott Hughes@node default values, global variables, general syntax, Configuration
631*d5c9a868SElliott Hughes@section Default values
632*d5c9a868SElliott Hughes@cindex Default values
633*d5c9a868SElliott Hughes@cindex Default configuration
634*d5c9a868SElliott Hughes@cindex Configuration file
635*d5c9a868SElliott HughesFor most platforms, mtools contains reasonable compiled-in defaults for
636*d5c9a868SElliott Hughesphysical floppy drives.  Thus, you usually don't need to bother with the
637*d5c9a868SElliott Hughesconfiguration file, if all you want to do with mtools is to access your
638*d5c9a868SElliott Hughesfloppy drives. On the other hand, the configuration file is needed if
639*d5c9a868SElliott Hughesyou also want to use mtools to access your hard disk partitions and
640*d5c9a868SElliott HughesDOSEMU image files.
641*d5c9a868SElliott Hughes
642*d5c9a868SElliott Hughes@node global variables, per drive variables, default values, Configuration
643*d5c9a868SElliott Hughes@section Global variables
644*d5c9a868SElliott Hughes@cindex Global configuration variables
645*d5c9a868SElliott Hughes@cindex Drive independent configuration variables
646*d5c9a868SElliott Hughes@cindex Environmental variables
647*d5c9a868SElliott Hughes@vindex MTOOLS_SKIP_CHECK
648*d5c9a868SElliott Hughes@vindex MTOOLS_FAT_COMPATIBILITY
649*d5c9a868SElliott Hughes@vindex MTOOLS_LOWER_CASE
650*d5c9a868SElliott Hughes@vindex MTOOLS_NO_VFAT
651*d5c9a868SElliott Hughes@vindex MTOOLS_DOTTED_DIR
652*d5c9a868SElliott Hughes@vindex MTOOLS_NAME_NUMERIC_TAIL
653*d5c9a868SElliott Hughes@vindex MTOOLS_TWENTY_FOUR_HOUR_CLOCK
654*d5c9a868SElliott Hughes@vindex MTOOLS_LOCK_TIMEOUT
655*d5c9a868SElliott Hughes@cindex FreeDOS
656*d5c9a868SElliott Hughes
657*d5c9a868SElliott HughesGlobal flags may be set to 1 or to 0.
658*d5c9a868SElliott Hughes
659*d5c9a868SElliott HughesThe following global flags are recognized:
660*d5c9a868SElliott Hughes
661*d5c9a868SElliott Hughes@table @code
662*d5c9a868SElliott Hughes@item MTOOLS_SKIP_CHECK
663*d5c9a868SElliott HughesIf this is set to 1, mtools skips most of its sanity checks. This is
664*d5c9a868SElliott Hughesneeded to read some Atari disks which have been made with the earlier
665*d5c9a868SElliott HughesROMs, and which would not be recognized otherwise.
666*d5c9a868SElliott Hughes@item MTOOLS_FAT_COMPATIBILITY
667*d5c9a868SElliott HughesIf this is set to 1, mtools skips the fat size checks. Some disks have
668*d5c9a868SElliott Hughesa bigger FAT than they really need to. These are rejected if this
669*d5c9a868SElliott Hughesoption is not set.
670*d5c9a868SElliott Hughes@item MTOOLS_LOWER_CASE
671*d5c9a868SElliott HughesIf this is set to 1, mtools displays all-upper-case short filenames as
672*d5c9a868SElliott Hugheslowercase. This has been done to allow a behavior which is consistent
673*d5c9a868SElliott Hugheswith older versions of mtools which didn't know about the case bits.
674*d5c9a868SElliott Hughes@item MTOOLS_NO_VFAT
675*d5c9a868SElliott HughesIf this is set to 1, mtools won't generate VFAT entries for filenames
676*d5c9a868SElliott Hugheswhich are mixed-case, but otherwise legal dos filenames.  This is useful
677*d5c9a868SElliott Hugheswhen working with DOS versions which can't grok VFAT long names, such as
678*d5c9a868SElliott HughesFreeDOS.
679*d5c9a868SElliott Hughes@item MTOOLS_DOTTED_DIR
680*d5c9a868SElliott HughesIn a wide directory, prints the short name with a dot instead of spaces
681*d5c9a868SElliott Hughesseparating the basename and the extension.
682*d5c9a868SElliott Hughes@item MTOOLS_NAME_NUMERIC_TAIL
683*d5c9a868SElliott HughesIf this is set to one (default), generate numeric tails for all long
684*d5c9a868SElliott Hughesnames (~1).  If set to zero, only generate numeric tails if otherwise a
685*d5c9a868SElliott Hughesclash would have happened.
686*d5c9a868SElliott Hughes@item MTOOLS_TWENTY_FOUR_HOUR_CLOCK
687*d5c9a868SElliott HughesIf 1, uses the European notation for times (twenty four hour clock),
688*d5c9a868SElliott Hugheselse uses the UK/US notation (am/pm)
689*d5c9a868SElliott Hughes@item MTOOLS_LOCK_TIMEOUT
690*d5c9a868SElliott HughesHow long, in seconds, to wait for a locked device to become free.
691*d5c9a868SElliott HughesDefaults to 30.
692*d5c9a868SElliott Hughes@end table
693*d5c9a868SElliott Hughes
694*d5c9a868SElliott HughesExample:
695*d5c9a868SElliott HughesInserting the following line into your configuration file instructs
696*d5c9a868SElliott Hughesmtools to skip the sanity checks:
697*d5c9a868SElliott Hughes@example
698*d5c9a868SElliott Hughes  MTOOLS_SKIP_CHECK=1
699*d5c9a868SElliott Hughes@end example
700*d5c9a868SElliott Hughes
701*d5c9a868SElliott HughesGlobal variables may also be set via the environment:
702*d5c9a868SElliott Hughes@example
703*d5c9a868SElliott Hughes  export MTOOLS_SKIP_CHECK=1
704*d5c9a868SElliott Hughes@end example
705*d5c9a868SElliott Hughes
706*d5c9a868SElliott HughesGlobal string variables may be set to any value:
707*d5c9a868SElliott Hughes@table @code
708*d5c9a868SElliott Hughes@item MTOOLS_DATE_STRING
709*d5c9a868SElliott HughesThe format used for printing dates of files.  By default, is dd-mm-yyyy.
710*d5c9a868SElliott Hughes@end table
711*d5c9a868SElliott Hughes
712*d5c9a868SElliott Hughes@node per drive variables, parsing order, global variables, Configuration
713*d5c9a868SElliott Hughes@section Per drive flags and variables
714*d5c9a868SElliott Hughes@cindex Drive description
715*d5c9a868SElliott Hughes@cindex Drive configuration
716*d5c9a868SElliott Hughes
717*d5c9a868SElliott Hughes@menu
718*d5c9a868SElliott Hughes* general information::   What a drive description looks like
719*d5c9a868SElliott Hughes* location information::  Where is the drive data physically stored
720*d5c9a868SElliott Hughes* geometry description::  Describes the physical characteristics of
721*d5c9a868SElliott Hughes                          the media
722*d5c9a868SElliott Hughes* open flags::            Flags passed to the open system call when the
723*d5c9a868SElliott Hughes                          device is opened
724*d5c9a868SElliott Hughes* miscellaneous variables::        Variables which don't fit in either category
725*d5c9a868SElliott Hughes* miscellaneous flags::		  Switch variables, which can be enabled or disabled
726*d5c9a868SElliott Hughes* multiple descriptions:: How to supply several descriptions for a
727*d5c9a868SElliott Hughes                          drive, to be tried one after the other.
728*d5c9a868SElliott Hughes@end menu
729*d5c9a868SElliott Hughes
730*d5c9a868SElliott Hughes@node general information, location information, per drive variables, per drive variables
731*d5c9a868SElliott Hughes@subsection General information
732*d5c9a868SElliott Hughes@cindex Drive description, example
733*d5c9a868SElliott Hughes@cindex Drive configuration, example
734*d5c9a868SElliott Hughes@vindex drive
735*d5c9a868SElliott Hughes
736*d5c9a868SElliott HughesPer drive flags and values may be described in a drive section. A
737*d5c9a868SElliott Hughesdrive section starts with
738*d5c9a868SElliott Hughes@code{drive} "@var{driveletter}" :
739*d5c9a868SElliott Hughes
740*d5c9a868SElliott HughesThen follow variable-value pairs and flags.
741*d5c9a868SElliott Hughes
742*d5c9a868SElliott HughesThis is a sample drive description:
743*d5c9a868SElliott Hughes@example
744*d5c9a868SElliott Hughes  drive a:
745*d5c9a868SElliott Hughes    file="/dev/fd0" use_xdf=1
746*d5c9a868SElliott Hughes@end example
747*d5c9a868SElliott Hughes
748*d5c9a868SElliott Hughes@node location information, geometry description, general information, per drive variables
749*d5c9a868SElliott Hughes@subsection Location information
750*d5c9a868SElliott Hughes@cindex Hdimage
751*d5c9a868SElliott Hughes
752*d5c9a868SElliott HughesFor each drive, you need to describe where its data is physically
753*d5c9a868SElliott Hughesstored (image file, physical device, partition, offset).
754*d5c9a868SElliott Hughes
755*d5c9a868SElliott Hughes@table @code
756*d5c9a868SElliott Hughes@item file
757*d5c9a868SElliott Hughes@cindex Image file
758*d5c9a868SElliott Hughes@cindex Name of device node
759*d5c9a868SElliott Hughes@cindex File name of device node
760*d5c9a868SElliott Hughes@vindex file
761*d5c9a868SElliott HughesThe name of the file or device holding the disk image. This is
762*d5c9a868SElliott Hughesmandatory. The file name should be enclosed in quotes.
763*d5c9a868SElliott Hughes
764*d5c9a868SElliott Hughes@item partition
765*d5c9a868SElliott Hughes@cindex DOSEMU hard disk image
766*d5c9a868SElliott Hughes@cindex Zip disks (partitions)
767*d5c9a868SElliott Hughes@cindex Jaz disks (partitions)
768*d5c9a868SElliott Hughes@cindex Syquest disks
769*d5c9a868SElliott Hughes@cindex Magneto-optical disks
770*d5c9a868SElliott Hughes@cindex OS/2 (layout of removable media)
771*d5c9a868SElliott Hughes@cindex Windows NT (layout of removable media)
772*d5c9a868SElliott Hughes@cindex Removable media
773*d5c9a868SElliott Hughes@cindex Partitioned image file
774*d5c9a868SElliott HughesTells mtools to treat the drive as a partitioned device, and to use the
775*d5c9a868SElliott Hughesgiven partition. Only primary partitions are accessible using this
776*d5c9a868SElliott Hughesmethod, and they are numbered from 1 to 4. For logical partitions, use
777*d5c9a868SElliott Hughesthe more general @code{offset} variable. The @code{partition} variable
778*d5c9a868SElliott Hughesis intended for removable media such as Syquest disks, ZIP drives, and
779*d5c9a868SElliott Hughesmagneto-optical disks. Although traditional DOS sees Syquest disks and
780*d5c9a868SElliott Hughesmagneto-optical disks as @samp{giant floppy disks} which are
781*d5c9a868SElliott Hughesunpartitioned, OS/2 and Windows NT treat them like hard disks,
782*d5c9a868SElliott Hughesi.e. partitioned devices. The @code{partition} flag is also useful DOSEMU
783*d5c9a868SElliott Hugheshdimages. It is not recommended for hard disks for which direct access
784*d5c9a868SElliott Hughesto partitions is available through mounting.
785*d5c9a868SElliott Hughes
786*d5c9a868SElliott Hughes@item offset
787*d5c9a868SElliott Hughes@cindex Ram disk
788*d5c9a868SElliott Hughes@cindex Atari Ram disk
789*d5c9a868SElliott HughesDescribes where in the file the MS-DOS file system starts. This is useful
790*d5c9a868SElliott Hughesfor logical partitions in DOSEMU hdimages, and for ATARI ram disks. By
791*d5c9a868SElliott Hughesdefault, this is zero, meaning that the file system starts right at the
792*d5c9a868SElliott Hughesbeginning of the device or file.
793*d5c9a868SElliott Hughes@end table
794*d5c9a868SElliott Hughes
795*d5c9a868SElliott Hughes@node geometry description, open flags, location information, per drive variables
796*d5c9a868SElliott Hughes@subsection Disk Geometry Configuration
797*d5c9a868SElliott Hughes@cindex Disk Geometry
798*d5c9a868SElliott Hughes@cindex Configuration of disk geometry
799*d5c9a868SElliott Hughes@cindex Description of disk geometry
800*d5c9a868SElliott Hughes@cindex Format of disk
801*d5c9a868SElliott Hughes@cindex High density disk
802*d5c9a868SElliott Hughes@cindex Low density disk
803*d5c9a868SElliott Hughes@pindex mformat (geometry used for)
804*d5c9a868SElliott Hughes
805*d5c9a868SElliott HughesGeometry information describes the physical characteristics about the
806*d5c9a868SElliott Hughesdisk. Its has three purposes:
807*d5c9a868SElliott Hughes
808*d5c9a868SElliott Hughes@table @asis
809*d5c9a868SElliott Hughes@item formatting
810*d5c9a868SElliott HughesThe geometry information is written into the boot sector of the newly
811*d5c9a868SElliott Hughesmade disk. However, you may also describe the geometry information on
812*d5c9a868SElliott Hughesthe command line. @xref{mformat}, for details.
813*d5c9a868SElliott Hughes@item filtering
814*d5c9a868SElliott HughesOn some Unixes there are device nodes which only support one physical
815*d5c9a868SElliott Hughesgeometry. For instance, you might need a different node to access a disk
816*d5c9a868SElliott Hughesas high density or as low density. The geometry is compared to the
817*d5c9a868SElliott Hughesactual geometry stored on the boot sector to make sure that this device
818*d5c9a868SElliott Hughesnode is able to correctly read the disk. If the geometry doesn't match,
819*d5c9a868SElliott Hughesthis drive entry fails, and the next drive entry bearing the same drive
820*d5c9a868SElliott Hughesletter is tried. @xref{multiple descriptions}, for more details on
821*d5c9a868SElliott Hughessupplying several descriptions for one drive letter.
822*d5c9a868SElliott Hughes
823*d5c9a868SElliott HughesIf no geometry information is supplied in the configuration file, all
824*d5c9a868SElliott Hughesdisks are accepted. On Linux (and on SPARC) there exist device nodes
825*d5c9a868SElliott Hugheswith configurable geometry (@file{/dev/fd0}, @file{/dev/fd1} etc),
826*d5c9a868SElliott Hughesand thus filtering is not needed (and ignored) for disk drives.  (Mtools
827*d5c9a868SElliott Hughesstill does do filtering on plain files (disk images) in Linux: this is
828*d5c9a868SElliott Hughesmainly intended for test purposes, as I don't have access to a Unix
829*d5c9a868SElliott Hugheswhich would actually need filtering).
830*d5c9a868SElliott Hughes
831*d5c9a868SElliott HughesIf you do not need filtering, but want still a default geometry for
832*d5c9a868SElliott Hughesmformatting, you may switch off filtering using the @code{mformat_only}
833*d5c9a868SElliott Hughesflag.
834*d5c9a868SElliott Hughes
835*d5c9a868SElliott HughesIf you want filtering, you should supply the @code{filter} flag.  If you
836*d5c9a868SElliott Hughessupply a geometry, you must supply one of both flags.
837*d5c9a868SElliott Hughes
838*d5c9a868SElliott Hughes@item initial geometry
839*d5c9a868SElliott HughesOn devices that support it (usually floppy devices), the geometry
840*d5c9a868SElliott Hughesinformation is also used to set the initial geometry. This initial
841*d5c9a868SElliott Hughesgeometry is applied while reading the boot sector, which contains the
842*d5c9a868SElliott Hughesreal geometry.  If no geometry information is supplied in the
843*d5c9a868SElliott Hughesconfiguration file, or if the @code{mformat_only} flag is supplied, no
844*d5c9a868SElliott Hughesinitial configuration is done.
845*d5c9a868SElliott Hughes
846*d5c9a868SElliott HughesOn Linux, initial geometry is not really needed, as the configurable
847*d5c9a868SElliott Hughesdevices are able to auto-detect the disk type accurately enough (for
848*d5c9a868SElliott Hughesmost common formats) to read the boot sector.
849*d5c9a868SElliott Hughes@end table
850*d5c9a868SElliott Hughes
851*d5c9a868SElliott HughesWrong geometry information may lead to very bizarre errors. That's why I
852*d5c9a868SElliott Hughesstrongly recommend that you add the @code{mformat_only} flag to your
853*d5c9a868SElliott Hughesdrive description, unless you really need filtering or initial geometry.
854*d5c9a868SElliott Hughes
855*d5c9a868SElliott HughesThe following geometry related variables are available:
856*d5c9a868SElliott Hughes
857*d5c9a868SElliott Hughes@table @code
858*d5c9a868SElliott Hughes@item cylinders
859*d5c9a868SElliott Hughes@itemx tracks
860*d5c9a868SElliott Hughes@vindex cylinders
861*d5c9a868SElliott Hughes@vindex tracks
862*d5c9a868SElliott HughesThe number of cylinders. (@code{cylinders} is the preferred form,
863*d5c9a868SElliott Hughes@code{tracks} is considered obsolete)
864*d5c9a868SElliott Hughes@item heads
865*d5c9a868SElliott Hughes@vindex heads
866*d5c9a868SElliott HughesThe number of heads (sides).
867*d5c9a868SElliott Hughes@item sectors
868*d5c9a868SElliott Hughes@vindex sectors
869*d5c9a868SElliott HughesThe number of sectors per track.
870*d5c9a868SElliott Hughes@end table
871*d5c9a868SElliott Hughes
872*d5c9a868SElliott HughesExample: the following drive section describes a 1.44M drive:
873*d5c9a868SElliott Hughes
874*d5c9a868SElliott Hughes@example
875*d5c9a868SElliott Hughes  drive a:
876*d5c9a868SElliott Hughes      file="/dev/fd0H1440"
877*d5c9a868SElliott Hughes      fat_bits=12
878*d5c9a868SElliott Hughes      cylinders=80 heads=2 sectors=18
879*d5c9a868SElliott Hughes      mformat_only
880*d5c9a868SElliott Hughes@end example
881*d5c9a868SElliott Hughes
882*d5c9a868SElliott HughesThe following shorthand geometry descriptions are available:
883*d5c9a868SElliott Hughes
884*d5c9a868SElliott Hughes@table @code
885*d5c9a868SElliott Hughes@item 1.44m
886*d5c9a868SElliott Hugheshigh density 3 1/2 disk. Equivalent to:
887*d5c9a868SElliott Hughes@code{fat_bits=12 cylinders=80 heads=2 sectors=18}
888*d5c9a868SElliott Hughes@item 1.2m
889*d5c9a868SElliott Hugheshigh density 5 1/4 disk. Equivalent to:
890*d5c9a868SElliott Hughes@code{fat_bits=12 cylinders=80 heads=2 sectors=15}
891*d5c9a868SElliott Hughes@item 720k
892*d5c9a868SElliott Hughesdouble density 3 1/2 disk. Equivalent to:
893*d5c9a868SElliott Hughes@code{fat_bits=12 cylinders=80 heads=2 sectors=9}
894*d5c9a868SElliott Hughes@item 360k
895*d5c9a868SElliott Hughesdouble density 5 1/4 disk. Equivalent to:
896*d5c9a868SElliott Hughes@code{fat_bits=12 cylinders=40 heads=2 sectors=9}
897*d5c9a868SElliott Hughes@end table
898*d5c9a868SElliott Hughes
899*d5c9a868SElliott HughesThe shorthand format descriptions may be amended. For example,
900*d5c9a868SElliott Hughes@code{360k sectors=8}
901*d5c9a868SElliott Hughesdescribes a 320k disk and is equivalent to:
902*d5c9a868SElliott Hughes@code{fat_bits=12 cylinders=40 heads=2 sectors=8}
903*d5c9a868SElliott Hughes
904*d5c9a868SElliott Hughes@node open flags, miscellaneous variables, geometry description, per drive variables
905*d5c9a868SElliott Hughes@subsection Open Flags
906*d5c9a868SElliott Hughes@vindex sync
907*d5c9a868SElliott Hughes@vindex nodelay
908*d5c9a868SElliott Hughes@vindex exclusive
909*d5c9a868SElliott Hughes@cindex open flags
910*d5c9a868SElliott Hughes@cindex synchronous writing
911*d5c9a868SElliott Hughes@cindex exclusive access to a drive
912*d5c9a868SElliott Hughes
913*d5c9a868SElliott HughesMoreover, the following flags are available:
914*d5c9a868SElliott Hughes
915*d5c9a868SElliott Hughes@table @code
916*d5c9a868SElliott Hughes@item sync
917*d5c9a868SElliott HughesAll i/o operations are done synchronously
918*d5c9a868SElliott Hughes@item nodelay
919*d5c9a868SElliott HughesThe device or file is opened with the O_NDELAY flag. This is needed on
920*d5c9a868SElliott Hughessome non-Linux architectures.
921*d5c9a868SElliott Hughes@item exclusive
922*d5c9a868SElliott HughesThe device or file is opened with the O_EXCL flag. On Linux, this
923*d5c9a868SElliott Hughesensures exclusive access to the floppy drive. On most other
924*d5c9a868SElliott Hughesarchitectures, and for plain files it has no effect at all.
925*d5c9a868SElliott Hughes@end table
926*d5c9a868SElliott Hughes
927*d5c9a868SElliott Hughes
928*d5c9a868SElliott Hughes@node miscellaneous variables, miscellaneous flags, open flags, per drive variables
929*d5c9a868SElliott Hughes@subsection General Purpose Drive Variables
930*d5c9a868SElliott Hughes
931*d5c9a868SElliott HughesThe following general purpose drive variables are available.  Depending
932*d5c9a868SElliott Hughesto their type, these variables can be set to a string (precmd) or
933*d5c9a868SElliott Hughesan integer (all others)
934*d5c9a868SElliott Hughes
935*d5c9a868SElliott Hughes@table @code
936*d5c9a868SElliott Hughes@item fat_bits
937*d5c9a868SElliott Hughes@vindex fat_bits
938*d5c9a868SElliott HughesThe number of FAT bits. This may be 12 or 16. This is very rarely
939*d5c9a868SElliott Hughesneeded, as it can almost always be deduced from information in the
940*d5c9a868SElliott Hughesboot sector. On the contrary, describing the number of fat bits may
941*d5c9a868SElliott Hughesactually be harmful if you get it wrong. You should only use it if
942*d5c9a868SElliott Hughesmtools gets the auto-detected number of fat bits wrong, or if you want
943*d5c9a868SElliott Hughesto mformat a disk with a weird number of fat bits.
944*d5c9a868SElliott Hughes@item codepage
945*d5c9a868SElliott HughesDescribes the DOS code page used for short filenames. This is a number
946*d5c9a868SElliott Hughesbetween 1 and 999. By default, code page 850 is used. The reason for
947*d5c9a868SElliott Hughesthis is because this code page contains most of the characters that are
948*d5c9a868SElliott Hughesalso available in ISO-Latin-1. You may also specify a global code page
949*d5c9a868SElliott Hughesfor all drives by using the global @code{default_codepage} parameter
950*d5c9a868SElliott Hughes(outside of any drive description). This parameters exists starting at
951*d5c9a868SElliott Hughesversion 4.0.0
952*d5c9a868SElliott Hughes
953*d5c9a868SElliott Hughes@item data_map
954*d5c9a868SElliott HughesRemaps data from image file. This is useful for image files which
955*d5c9a868SElliott Hughesmight need additional zero-filled sectors to be inserted. Such is the
956*d5c9a868SElliott Hughescase for instance for IBM 3174 floppy images. These images represent
957*d5c9a868SElliott Hughesfloppy disks with fewer sectors on their first cylinder. These missing
958*d5c9a868SElliott Hughessectors are not stored in the image, but are still counted in the
959*d5c9a868SElliott Hughesfilesystem layout. The data_map allows to fake these missing sectors
960*d5c9a868SElliott Hughesfor the upper layers of mtools. A data_map is a comma-separated
961*d5c9a868SElliott Hughessequence of source type and size. Source type may be @code{zero} for
962*d5c9a868SElliott Hugheszero-filled sectors created by map, @code{skip} for data in raw image
963*d5c9a868SElliott Hughesto be ignored (skipped), and nothing for data to be used as is
964*d5c9a868SElliott Hughes(copied) from the raw image. Datamap is automatically complemented by
965*d5c9a868SElliott Hughesan implicit last element of data to be used as is from current offset
966*d5c9a868SElliott Hughesto end of file. Each size is a number followed by a unit: @code{s} for
967*d5c9a868SElliott Hughesa 512 byte sector, @code{K} for Kbytes, @code{M} for megabytes,
968*d5c9a868SElliott Hughes@code{G} for gigabytes, and nothing for single bytes.
969*d5c9a868SElliott Hughes
970*d5c9a868SElliott HughesExample:
971*d5c9a868SElliott Hughes
972*d5c9a868SElliott Hughes@code{data_map=1s,zero31s,28s,skip1s} would be a map for use with IBM
973*d5c9a868SElliott Hughes3174 floppy images. First sector (@code{1s}, boot sector) is used as
974*d5c9a868SElliott Hughesis. Then follow 31 fake zero-filled sectors (@code{zero31s}), then the
975*d5c9a868SElliott Hughesnext 28 sectors from image (@code{28s}) are used as is (they contain
976*d5c9a868SElliott HughesFAT and root directory), then one sector from image is skipped
977*d5c9a868SElliott Hughes(@code{skip1s}), and finally the rest of image is used as is
978*d5c9a868SElliott Hughes(implicit)
979*d5c9a868SElliott Hughes
980*d5c9a868SElliott Hughes
981*d5c9a868SElliott Hughes@item precmd
982*d5c9a868SElliott Hughes@cindex Solaris (volcheck)
983*d5c9a868SElliott Hughes@cindex Executing commands before opening the device
984*d5c9a868SElliott HughesOn some variants of Solaris, it is necessary to call 'volcheck -v'
985*d5c9a868SElliott Hughesbefore opening a floppy device, in order for the system to notice that
986*d5c9a868SElliott Hughesthere is indeed a disk in the drive. @code{precmd="volcheck -v"} in the
987*d5c9a868SElliott Hughesdrive clause establishes the desired behavior.
988*d5c9a868SElliott Hughes
989*d5c9a868SElliott Hughes@item blocksize
990*d5c9a868SElliott Hughes@cindex raw device
991*d5c9a868SElliott Hughes@cindex character devices
992*d5c9a868SElliott Hughes@cindex blocksize
993*d5c9a868SElliott HughesThis parameter represents a default block size to be always used on this
994*d5c9a868SElliott Hughesdevice.  All I/O is done with multiples of this block size,
995*d5c9a868SElliott Hughesindependently of the sector size registered in the file system's boot
996*d5c9a868SElliott Hughessector.  This is useful for character devices whose sector size is not
997*d5c9a868SElliott Hughes512, such as for example CD-ROM drives on Solaris.
998*d5c9a868SElliott Hughes
999*d5c9a868SElliott Hughes@end table
1000*d5c9a868SElliott Hughes
1001*d5c9a868SElliott HughesOnly the @code{file} variable is mandatory. The other parameters may
1002*d5c9a868SElliott Hughesbe left out. In that case a default value or an auto-detected value is
1003*d5c9a868SElliott Hughesused.
1004*d5c9a868SElliott Hughes
1005*d5c9a868SElliott Hughes
1006*d5c9a868SElliott Hughes
1007*d5c9a868SElliott Hughes@node miscellaneous flags, multiple descriptions, miscellaneous variables, per drive variables
1008*d5c9a868SElliott Hughes@subsection General Purpose Drive Flags
1009*d5c9a868SElliott Hughes
1010*d5c9a868SElliott HughesA flag can either be set to 1 (enabled) or 0 (disabled). If the value is
1011*d5c9a868SElliott Hughesomitted, it is enabled.  For example, @code{scsi} is equivalent to
1012*d5c9a868SElliott Hughes@code{scsi=1}
1013*d5c9a868SElliott Hughes
1014*d5c9a868SElliott Hughes@table @code
1015*d5c9a868SElliott Hughes@item nolock
1016*d5c9a868SElliott Hughes@cindex disable locking
1017*d5c9a868SElliott Hughes@cindex locking (disabling it)
1018*d5c9a868SElliott Hughes@cindex plain floppy: device xxx busy
1019*d5c9a868SElliott HughesInstruct mtools to not use locking on this drive.  This is needed on
1020*d5c9a868SElliott Hughessystems with buggy locking semantics.  However, enabling this makes
1021*d5c9a868SElliott Hughesoperation less safe in cases where several users may access the same
1022*d5c9a868SElliott Hughesdrive at the same time.
1023*d5c9a868SElliott Hughes
1024*d5c9a868SElliott Hughes@item scsi
1025*d5c9a868SElliott Hughes@cindex setuid installation (needed for raw SCSI I/O)
1026*d5c9a868SElliott Hughes@cindex Solaris (Raw access to SCSI devices such as Zip & Jaz)
1027*d5c9a868SElliott Hughes@cindex SunOS (Raw access to SCSI devices such as Zip & Jaz)
1028*d5c9a868SElliott Hughes@cindex Zip disks (raw SCSI access)
1029*d5c9a868SElliott Hughes@cindex Jaz disks (raw SCSI access)
1030*d5c9a868SElliott Hughes@cindex Syquest disks (raw SCSI access)
1031*d5c9a868SElliott Hughes@cindex SCSI devices
1032*d5c9a868SElliott HughesWhen set to 1, this option tells mtools to use raw SCSI I/O instead of
1033*d5c9a868SElliott Hughesthe standard read/write calls to access the device. Currently, this is
1034*d5c9a868SElliott Hughessupported on HP-UX, Solaris and SunOS.  This is needed because on some
1035*d5c9a868SElliott Hughesarchitectures, such as SunOS or Solaris, PC media can't be accessed
1036*d5c9a868SElliott Hughesusing the @code{read} and @code{write} system calls, because the OS expects
1037*d5c9a868SElliott Hughesthem to contain a Sun specific "disk label".
1038*d5c9a868SElliott Hughes
1039*d5c9a868SElliott HughesAs raw SCSI access always uses the whole device, you need to specify the
1040*d5c9a868SElliott Hughes"partition" flag in addition
1041*d5c9a868SElliott Hughes
1042*d5c9a868SElliott HughesOn some architectures, such as Solaris, mtools needs root privileges to
1043*d5c9a868SElliott Hughesbe able to use the @code{scsi} option.  Thus mtools should be installed
1044*d5c9a868SElliott Hughessetuid root on Solaris if you want to access Zip/Jaz drives.  Thus, if
1045*d5c9a868SElliott Hughesthe @code{scsi} flag is given, @code{privileged} is automatically
1046*d5c9a868SElliott Hughesimplied, unless explicitly disabled by @code{privileged=0}
1047*d5c9a868SElliott Hughes
1048*d5c9a868SElliott HughesMtools uses its root privileges to open the device, and to issue the
1049*d5c9a868SElliott Hughesactual SCSI I/O calls.  Moreover, root privileges are only used for
1050*d5c9a868SElliott Hughesdrives described in a system-wide configuration file such as
1051*d5c9a868SElliott Hughes@file{@value{SYSCONFDIR}mtools.conf}, and not for those described in
1052*d5c9a868SElliott Hughes@file{~/.mtoolsrc} or @file{$MTOOLSRC}.
1053*d5c9a868SElliott Hughes
1054*d5c9a868SElliott Hughes@item privileged
1055*d5c9a868SElliott Hughes@cindex setuid installation
1056*d5c9a868SElliott Hughes@cindex setgid installation
1057*d5c9a868SElliott HughesWhen set to 1, this instructs mtools to use its setuid and setgid
1058*d5c9a868SElliott Hughesprivileges for opening the given drive.  This option is only valid for
1059*d5c9a868SElliott Hughesdrives described in the system-wide configuration files (such as
1060*d5c9a868SElliott Hughes@file{@value{SYSCONFDIR}mtools.conf}, not @file{~/.mtoolsrc} or
1061*d5c9a868SElliott Hughes@file{$MTOOLSRC}).  Obviously, this option is also a no op if mtools is
1062*d5c9a868SElliott Hughesnot installed setuid or setgid.  This option is implied by 'scsi=1', but
1063*d5c9a868SElliott Hughesagain only for drives defined in system-wide configuration files.
1064*d5c9a868SElliott HughesPrivileged may also be set explicitly to 0, in order to tell mtools not
1065*d5c9a868SElliott Hughesto use its privileges for a given drive even if @code{scsi=1} is set.
1066*d5c9a868SElliott Hughes
1067*d5c9a868SElliott HughesMtools only needs to be installed setuid if you use the
1068*d5c9a868SElliott Hughes@code{privileged} or @code{scsi} drive variables.  If you do not use
1069*d5c9a868SElliott Hughesthese options, mtools works perfectly well even when not installed
1070*d5c9a868SElliott Hughessetuid root.
1071*d5c9a868SElliott Hughes
1072*d5c9a868SElliott Hughes@item vold
1073*d5c9a868SElliott Hughes@cindex Solaris (vold)
1074*d5c9a868SElliott Hughes@cindex Vold (mediamgr)
1075*d5c9a868SElliott Hughes
1076*d5c9a868SElliott HughesInstructs mtools to interpret the device name as a vold identifier
1077*d5c9a868SElliott Hughesrather than as a filename.  The vold identifier is translated into a
1078*d5c9a868SElliott Hughesreal filename using the @code{media_findname()} and
1079*d5c9a868SElliott Hughes@code{media_oldaliases()} functions of the @code{volmgt} library.  This
1080*d5c9a868SElliott Hughesflag is only available if you configured mtools with the
1081*d5c9a868SElliott Hughes@code{--enable-new-vold} option before compilation.
1082*d5c9a868SElliott Hughes
1083*d5c9a868SElliott Hughes@item swap
1084*d5c9a868SElliott Hughes@cindex Atari
1085*d5c9a868SElliott Hughes@cindex Wordswapped
1086*d5c9a868SElliott Hughes
1087*d5c9a868SElliott HughesConsider the media as a word-swapped Atari disk.
1088*d5c9a868SElliott Hughes
1089*d5c9a868SElliott Hughes@item use_xdf
1090*d5c9a868SElliott Hughes@cindex XDF disks (how to configure)
1091*d5c9a868SElliott Hughes@vindex use_xdf
1092*d5c9a868SElliott HughesIf this is set to a non-zero value, mtools also tries to access this
1093*d5c9a868SElliott Hughesdisk as an XDF disk. XDF is a high capacity format used by OS/2. This
1094*d5c9a868SElliott Hughesis off by default. @xref{XDF}, for more details.
1095*d5c9a868SElliott Hughes@item mformat_only
1096*d5c9a868SElliott Hughes@vindex mformat_only
1097*d5c9a868SElliott HughesTells mtools to use the geometry for this drive only for mformatting and
1098*d5c9a868SElliott Hughesnot for filtering.
1099*d5c9a868SElliott Hughes
1100*d5c9a868SElliott Hughes@item filter
1101*d5c9a868SElliott Hughes@vindex filter
1102*d5c9a868SElliott HughesTells mtools to use the geometry for this drive both for mformatting and
1103*d5c9a868SElliott Hughesfiltering.
1104*d5c9a868SElliott Hughes
1105*d5c9a868SElliott Hughes@item remote
1106*d5c9a868SElliott HughesTells mtools to connect to floppyd (@pxref{floppyd}).
1107*d5c9a868SElliott Hughes@end table
1108*d5c9a868SElliott Hughes
1109*d5c9a868SElliott Hughes
1110*d5c9a868SElliott Hughes@node multiple descriptions, , miscellaneous flags, per drive variables
1111*d5c9a868SElliott Hughes@subsection Supplying multiple descriptions for a drive
1112*d5c9a868SElliott Hughes
1113*d5c9a868SElliott HughesIt is possible to supply multiple descriptions for a drive. In that
1114*d5c9a868SElliott Hughescase, the descriptions are tried in order until one is found that
1115*d5c9a868SElliott Hughesfits. Descriptions may fail for several reasons:
1116*d5c9a868SElliott Hughes
1117*d5c9a868SElliott Hughes@enumerate
1118*d5c9a868SElliott Hughes@item
1119*d5c9a868SElliott Hughesbecause the geometry is not appropriate,
1120*d5c9a868SElliott Hughes@item
1121*d5c9a868SElliott Hughesbecause there is no disk in the drive,
1122*d5c9a868SElliott Hughes@item
1123*d5c9a868SElliott Hughesor because of other problems.
1124*d5c9a868SElliott Hughes@end enumerate
1125*d5c9a868SElliott Hughes
1126*d5c9a868SElliott HughesMultiple definitions are useful when using physical devices which are
1127*d5c9a868SElliott Hughesonly able to support one single disk geometry.
1128*d5c9a868SElliott HughesExample:
1129*d5c9a868SElliott Hughes@example
1130*d5c9a868SElliott Hughes  drive a: file="/dev/fd0H1440" 1.44m
1131*d5c9a868SElliott Hughes  drive a: file="/dev/fd0H720" 720k
1132*d5c9a868SElliott Hughes@end example
1133*d5c9a868SElliott Hughes
1134*d5c9a868SElliott HughesThis instructs mtools to use /dev/fd0H1440 for 1.44m (high density)
1135*d5c9a868SElliott Hughesdisks and /dev/fd0H720 for 720k (double density) disks. On Linux, this
1136*d5c9a868SElliott Hughesfeature is not really needed, as the /dev/fd0 device is able to handle
1137*d5c9a868SElliott Hughesany geometry.
1138*d5c9a868SElliott Hughes
1139*d5c9a868SElliott HughesYou may also use multiple drive descriptions to access both of your
1140*d5c9a868SElliott Hughesphysical drives through one drive letter:
1141*d5c9a868SElliott Hughes
1142*d5c9a868SElliott Hughes@example
1143*d5c9a868SElliott Hughes  drive z: file="/dev/fd0"
1144*d5c9a868SElliott Hughes  drive z: file="/dev/fd1"
1145*d5c9a868SElliott Hughes@end example
1146*d5c9a868SElliott Hughes
1147*d5c9a868SElliott HughesWith this description, @code{mdir z:} accesses your first physical
1148*d5c9a868SElliott Hughesdrive if it contains a disk. If the first drive doesn't contain a disk,
1149*d5c9a868SElliott Hughesmtools checks the second drive.
1150*d5c9a868SElliott Hughes
1151*d5c9a868SElliott HughesWhen using multiple configuration files, drive descriptions in the files
1152*d5c9a868SElliott Hughesparsed last override descriptions for the same drive in earlier
1153*d5c9a868SElliott Hughesfiles. In order to avoid this, use the @code{drive+} or @code{+drive}
1154*d5c9a868SElliott Hugheskeywords instead of @code{drive}. The first adds a description to the
1155*d5c9a868SElliott Hughesend of the list (i.e. it will be tried last), and the first adds it to
1156*d5c9a868SElliott Hughesthe start of the list.
1157*d5c9a868SElliott Hughes
1158*d5c9a868SElliott Hughes@node parsing order, old style configuration, per drive variables, Configuration
1159*d5c9a868SElliott Hughes@section Location of configuration files and parsing order
1160*d5c9a868SElliott Hughes@cindex Parsing order
1161*d5c9a868SElliott Hughes@cindex Configuration file parsing order
1162*d5c9a868SElliott Hughes@cindex Configuration file name (parsing order)
1163*d5c9a868SElliott Hughes@cindex Name of configuration files (parsing order)
1164*d5c9a868SElliott Hughes@cindex Location of configuration files (parsing order)
1165*d5c9a868SElliott Hughes
1166*d5c9a868SElliott HughesThe configuration files are parsed in the following order:
1167*d5c9a868SElliott Hughes@enumerate
1168*d5c9a868SElliott Hughes@item
1169*d5c9a868SElliott Hughescompiled-in defaults
1170*d5c9a868SElliott Hughes@item
1171*d5c9a868SElliott Hughes@file{@value{SYSCONFDIR}mtools.conf}
1172*d5c9a868SElliott Hughes@item
1173*d5c9a868SElliott Hughes@file{~/.mtoolsrc}.
1174*d5c9a868SElliott Hughes@item
1175*d5c9a868SElliott Hughes@file{$MTOOLSRC} (file pointed by the @code{MTOOLSRC} environmental
1176*d5c9a868SElliott Hughesvariable)
1177*d5c9a868SElliott Hughes@end enumerate
1178*d5c9a868SElliott Hughes
1179*d5c9a868SElliott HughesOptions described in the later files override those described in the
1180*d5c9a868SElliott Hughesearlier files. Drives defined in earlier files persist if they are not
1181*d5c9a868SElliott Hughesoverridden in the later files. For instance, drives A and B may be
1182*d5c9a868SElliott Hughesdefined in @file{@value{SYSCONFDIR}mtools.conf} and drives C and D may be
1183*d5c9a868SElliott Hughesdefined in @file{~/.mtoolsrc} However, if @file{~/.mtoolsrc} also
1184*d5c9a868SElliott Hughesdefines drive A, this new description would override the description of
1185*d5c9a868SElliott Hughesdrive A in @file{@value{SYSCONFDIR}mtools.conf} instead of adding to it. If
1186*d5c9a868SElliott Hughesyou want to add a new description to a drive already described in an
1187*d5c9a868SElliott Hughesearlier file, you need to use either the @code{+drive} or @code{drive+}
1188*d5c9a868SElliott Hugheskeyword.
1189*d5c9a868SElliott Hughes
1190*d5c9a868SElliott Hughes@node old style configuration, , parsing order, Configuration
1191*d5c9a868SElliott Hughes@section Backwards compatibility with old configuration file syntax
1192*d5c9a868SElliott Hughes@cindex Backwards compatibility
1193*d5c9a868SElliott Hughes@cindex Old configuration file syntax
1194*d5c9a868SElliott Hughes@cindex Configuration file, old syntax
1195*d5c9a868SElliott Hughes
1196*d5c9a868SElliott HughesThe syntax described herein is new for version @code{mtools-3.0}. The
1197*d5c9a868SElliott Hughesold line-oriented syntax is still supported. Each line beginning with a
1198*d5c9a868SElliott Hughessingle letter is considered to be a drive description using the old
1199*d5c9a868SElliott Hughessyntax. Old style and new style drive sections may be mixed within the
1200*d5c9a868SElliott Hughessame configuration file, in order to make upgrading easier. Support for
1201*d5c9a868SElliott Hughesthe old syntax will be phased out eventually, and in order to discourage
1202*d5c9a868SElliott Hughesits use, I purposefully omit its description here.
1203*d5c9a868SElliott Hughes
1204*d5c9a868SElliott Hughes@comment MANskip 5
1205*d5c9a868SElliott Hughes
1206*d5c9a868SElliott Hughes@node Commands, Compiling mtools, Configuration, Top
1207*d5c9a868SElliott Hughes@chapter Command list
1208*d5c9a868SElliott Hughes@cindex Command list
1209*d5c9a868SElliott Hughes@cindex List of available commands
1210*d5c9a868SElliott Hughes
1211*d5c9a868SElliott Hughes This section describes the available mtools commands, and the command
1212*d5c9a868SElliott Hughesline parameters that each of them accepts. Options which are common to
1213*d5c9a868SElliott Hughesall mtools commands are not described here, @ref{arguments} for a
1214*d5c9a868SElliott Hughesdescription of those.
1215*d5c9a868SElliott Hughes
1216*d5c9a868SElliott Hughes@menu
1217*d5c9a868SElliott Hughes* floppyd::           floppy daemon to run on your X server box
1218*d5c9a868SElliott Hughes* floppyd_installtest:: small utility to check for the presence of floppyd
1219*d5c9a868SElliott Hughes* mattrib::           change MS-DOS file attribute flags
1220*d5c9a868SElliott Hughes* mbadblocks::        tests a floppy disk, and marks the bad blocks in the FAT
1221*d5c9a868SElliott Hughes* mcat::              same as cat. Only useful with floppyd.
1222*d5c9a868SElliott Hughes* mcd::               change MS-DOS directory
1223*d5c9a868SElliott Hughes* mcopy::             copy MS-DOS files to/from Unix
1224*d5c9a868SElliott Hughes* mdel::              delete an MS-DOS file
1225*d5c9a868SElliott Hughes* mdeltree::          recursively delete an MS-DOS directory
1226*d5c9a868SElliott Hughes* mdir::              display an MS-DOS directory
1227*d5c9a868SElliott Hughes* mdu::               list space occupied by directory and its contents
1228*d5c9a868SElliott Hughes* mformat::           add an MS-DOS file system to a low-level formatted floppy disk
1229*d5c9a868SElliott Hughes* minfo::             get information about an MS-DOS file system.
1230*d5c9a868SElliott Hughes* mlabel::            make an MS-DOS volume label
1231*d5c9a868SElliott Hughes* mkmanifest::        makes a list of short name equivalents
1232*d5c9a868SElliott Hughes* mmd::               make an MS-DOS subdirectory
1233*d5c9a868SElliott Hughes* mmount::            mount an MS-DOS disk
1234*d5c9a868SElliott Hughes* mpartition::        create an MS-DOS as a partition
1235*d5c9a868SElliott Hughes* mrd::               remove an MS-DOS subdirectory
1236*d5c9a868SElliott Hughes* mmove::             move or rename an MS-DOS file or subdirectory
1237*d5c9a868SElliott Hughes* mren::              rename an existing MS-DOS file
1238*d5c9a868SElliott Hughes* mshortname::        shows the short name of a file
1239*d5c9a868SElliott Hughes* mshowfat::          shows the FAT map of a file
1240*d5c9a868SElliott Hughes* mtoolstest::        tests and displays the configuration
1241*d5c9a868SElliott Hughes* mtype::             display contents of an MS-DOS file
1242*d5c9a868SElliott Hughes* mzip::              zip disk specific commands
1243*d5c9a868SElliott Hughes@end menu
1244*d5c9a868SElliott Hughes
1245*d5c9a868SElliott Hughes@node floppyd, floppyd_installtest, Commands, Commands
1246*d5c9a868SElliott Hughes@section Floppyd
1247*d5c9a868SElliott Hughes@pindex floppyd
1248*d5c9a868SElliott Hughes@cindex X terminal
1249*d5c9a868SElliott Hughes@cindex remote floppy access
1250*d5c9a868SElliott Hughes
1251*d5c9a868SElliott Hughes@code{Floppyd} is used as a server to grant access to the floppy drive
1252*d5c9a868SElliott Hughesto clients running on a remote machine, just as an X server grants
1253*d5c9a868SElliott Hughesaccess to the display to remote clients.  It has the following syntax:
1254*d5c9a868SElliott Hughes
1255*d5c9a868SElliott Hughes@code{floppyd} [@code{-d}] [@code{-l}] [@code{-s} @var{port}] [@code{-r}
1256*d5c9a868SElliott Hughes@var{user}] [@code{-b} @var{ipaddr}] [@code{-x} @var{display}] @var{devicenames}
1257*d5c9a868SElliott Hughes
1258*d5c9a868SElliott Hughes
1259*d5c9a868SElliott Hughes@code{floppyd} is always associated with an X server.  It runs on the
1260*d5c9a868SElliott Hughessame machine as its X server, and listens on port 5703 and above.
1261*d5c9a868SElliott Hughes
1262*d5c9a868SElliott Hughes@subsection Authentication
1263*d5c9a868SElliott Hughes
1264*d5c9a868SElliott Hughes@code{floppyd} authenticates remote clients using the @code{Xauthority}
1265*d5c9a868SElliott Hughesprotocol. Xhost authentication is not supported. Each floppyd is
1266*d5c9a868SElliott Hughesassociated with an X server.  When a remote client attempts to connect
1267*d5c9a868SElliott Hughesto floppyd, it sends floppyd the X authority record corresponding to
1268*d5c9a868SElliott Hughesfloppyd's X server.  Floppyd in turn then tries to open up a connection
1269*d5c9a868SElliott Hughesto the X server in order to verify the authenticity of the xauth record.
1270*d5c9a868SElliott HughesIf the connection to the X server succeeds, the client is granted
1271*d5c9a868SElliott Hughesaccess.
1272*d5c9a868SElliott Hughes@code{DISPLAY}.
1273*d5c9a868SElliott Hughes
1274*d5c9a868SElliott Hughes@strong{Caution}: In order to make authentication work correctly, the
1275*d5c9a868SElliott Hugheslocal host should @strong{not} be listed in the @code{xhost} list of
1276*d5c9a868SElliott Hughesallowed hosts.
1277*d5c9a868SElliott Hughes Indeed, hosts listed in @code{xhost} do not need a correct
1278*d5c9a868SElliott Hughes@code{Xauthority} cookie to connect to the X server. As @code{floppyd}
1279*d5c9a868SElliott Hughesruns on the same host as the X server, all its probe connection would
1280*d5c9a868SElliott Hughessucceed even for clients who supplied a bad cookie.  This means that
1281*d5c9a868SElliott Hughesyour floppy drive would be open to the world, i.e. a huge security hole.
1282*d5c9a868SElliott Hughes If your X server does not allow you to remove @code{localhost:0} and
1283*d5c9a868SElliott Hughes@code{:0} from the @code{xhost} list, you can prevent floppyd from
1284*d5c9a868SElliott Hughesprobing those display names with the @code{-l} option.
1285*d5c9a868SElliott Hughes
1286*d5c9a868SElliott Hughes@subsection Command line options
1287*d5c9a868SElliott Hughes
1288*d5c9a868SElliott Hughes@table @code
1289*d5c9a868SElliott Hughes@item d
1290*d5c9a868SElliott HughesDaemon mode. Floppyd runs its own server loop.  Do not supply this if
1291*d5c9a868SElliott Hughesyou start floppyd from @code{inetd.conf}
1292*d5c9a868SElliott Hughes@item s  @var{port}
1293*d5c9a868SElliott HughesPort number for daemon mode.  Default is 5703 + @var{displaynumber}.
1294*d5c9a868SElliott HughesThis flag implies daemon mode.  For example, for display
1295*d5c9a868SElliott Hughes@code{hitchhiker:5}, the port would be 5708.
1296*d5c9a868SElliott Hughes@item b  @var{ipaddr}
1297*d5c9a868SElliott HughesBind address (for multi homed hosts). This flag implies daemon mode
1298*d5c9a868SElliott Hughes@item r @var{user}
1299*d5c9a868SElliott HughesRun the server under as the given user
1300*d5c9a868SElliott Hughes@item x @var{display}
1301*d5c9a868SElliott HughesX display to use for authentication. By default, this is taken from the
1302*d5c9a868SElliott Hughes@code{DISPLAY} variable. If neither the @code{x} attribute is present
1303*d5c9a868SElliott Hughesnor @code{DISPLAY} is set, floppyd uses @code{:0.0}.
1304*d5c9a868SElliott Hughes@end table
1305*d5c9a868SElliott Hughes
1306*d5c9a868SElliott Hughes@var{devicenames} is a list of device nodes to be opened.  Default
1307*d5c9a868SElliott Hughesis @code{/dev/fd0}. Multiple devices are only supported on mtools
1308*d5c9a868SElliott Hughesversions newer than 3.9.11.
1309*d5c9a868SElliott Hughes
1310*d5c9a868SElliott Hughes
1311*d5c9a868SElliott Hughes@subsection Connecting to floppyd
1312*d5c9a868SElliott Hughes
1313*d5c9a868SElliott Hughes In order to use floppyd, add the flag @code{remote} to the device
1314*d5c9a868SElliott Hughesdescription in your @file{~/.mtoolsrc} file.  If the flag @code{remote}
1315*d5c9a868SElliott Hughesis given, the @code{file} parameter of the device description is taken
1316*d5c9a868SElliott Hughesto be a remote address.  It's format is the following:
1317*d5c9a868SElliott Hughes@var{hostname}@code{:}@var{displaynumber}[@code{/}[@var{baseport}][@code{/}@var{drive}]]. When
1318*d5c9a868SElliott Hughesusing this entry, mtools connects to port
1319*d5c9a868SElliott Hughes@var{baseport}+@var{displaynumber} at @var{hostname}. By default
1320*d5c9a868SElliott Hughes@var{baseport} is 5703. The drive parameter is to distinguish among
1321*d5c9a868SElliott Hughesmultiple drives associated with a single display (only mtools versions
1322*d5c9a868SElliott Hughesmore recent than 3.9.11)
1323*d5c9a868SElliott Hughes
1324*d5c9a868SElliott Hughes@subsection Examples:
1325*d5c9a868SElliott Hughes
1326*d5c9a868SElliott Hughes The following starts a floppy daemon giving access to @file{/dev/fd0},
1327*d5c9a868SElliott Hugheslistening on the default port 5703, tied to the default X servers:
1328*d5c9a868SElliott Hughes
1329*d5c9a868SElliott Hughes@example
1330*d5c9a868SElliott Hughesfloppyd -d /dev/fd0
1331*d5c9a868SElliott Hughes@end example
1332*d5c9a868SElliott Hughes
1333*d5c9a868SElliott Hughes Each of the following starts a floppy daemon giving access to
1334*d5c9a868SElliott Hughes@file{/dev/fd1}, tied to the :1 local X servers, and listening on port
1335*d5c9a868SElliott Hughes5704. We assume that the local host is named @code{hitchhiker}.
1336*d5c9a868SElliott Hughes
1337*d5c9a868SElliott Hughes@example
1338*d5c9a868SElliott Hughesfloppyd -d /dev/fd0
1339*d5c9a868SElliott Hughesfloppyd -d -x :1 -p 5704 /dev/fd0
1340*d5c9a868SElliott Hughes@end example
1341*d5c9a868SElliott Hughes
1342*d5c9a868SElliott Hughes If you want to start floppyd by @code{inetd} instead of running it as a
1343*d5c9a868SElliott Hughesdaemon, insert the following lines into @file{/etc/services}:
1344*d5c9a868SElliott Hughes@example
1345*d5c9a868SElliott Hughes# floppy daemon
1346*d5c9a868SElliott Hughesfloppyd-0    5703/tcp    # floppy daemon for X server :0
1347*d5c9a868SElliott Hughesfloppyd-1    5704/tcp    # floppy daemon for X server :1
1348*d5c9a868SElliott Hughes@end example
1349*d5c9a868SElliott Hughes
1350*d5c9a868SElliott Hughes And insert the following into @file{/etc/inetd.conf} (assuming that you
1351*d5c9a868SElliott Hugheshave defined a user named floppy in your @file{/etc/passwd}):
1352*d5c9a868SElliott Hughes
1353*d5c9a868SElliott Hughes@example
1354*d5c9a868SElliott Hughes# floppy daemon
1355*d5c9a868SElliott Hughesfloppyd-0 stream  tcp  wait  floppy  /usr/sbin/floppyd floppyd /dev/fd0
1356*d5c9a868SElliott Hughesfloppyd-1 stream  tcp  wait  floppy  /usr/sbin/floppyd floppyd -x :1 /dev/fd0
1357*d5c9a868SElliott Hughes@end example
1358*d5c9a868SElliott Hughes
1359*d5c9a868SElliott Hughes Note that you need to supply the X display names for the second
1360*d5c9a868SElliott Hughesfloppyd.  This is because the port is opened by inetd.conf, and hence
1361*d5c9a868SElliott Hughesfloppyd cannot know its number to interfere the display number.
1362*d5c9a868SElliott Hughes
1363*d5c9a868SElliott Hughes
1364*d5c9a868SElliott HughesOn the client side, insert the following into your @file{~/.mtoolsrc}
1365*d5c9a868SElliott Hughesto define a drive letter accessing floppy drive in your X terminal:
1366*d5c9a868SElliott Hughes@example
1367*d5c9a868SElliott Hughesdrive x: file="$DISPLAY" remote
1368*d5c9a868SElliott Hughes@end example
1369*d5c9a868SElliott Hughes
1370*d5c9a868SElliott HughesIf your X terminal has more than one drive, you may access the
1371*d5c9a868SElliott Hughesadditional drives as follows:
1372*d5c9a868SElliott Hughes@example
1373*d5c9a868SElliott Hughesdrive y: file="$DISPLAY//1" remote
1374*d5c9a868SElliott Hughesdrive z: file="$DISPLAY//2" remote
1375*d5c9a868SElliott Hughes@end example
1376*d5c9a868SElliott Hughes
1377*d5c9a868SElliott Hughes@node floppyd_installtest, mattrib, floppyd, Commands
1378*d5c9a868SElliott Hughes@section Floppyd_installtest
1379*d5c9a868SElliott Hughes@pindex floppyd_installtest
1380*d5c9a868SElliott Hughes@cindex X terminal
1381*d5c9a868SElliott Hughes@cindex remote floppy access
1382*d5c9a868SElliott Hughes
1383*d5c9a868SElliott Hughes@code{Floppyd_installtest} is used to check for the presence of a running
1384*d5c9a868SElliott Hughesfloppyd daemon. This is useful, if you have a small front-end script to
1385*d5c9a868SElliott Hughesmtools, which decides whether to use floppyd or not.
1386*d5c9a868SElliott Hughes
1387*d5c9a868SElliott Hughes@code{floppyd_installtest} [@code{-f}]  Connect-String
1388*d5c9a868SElliott Hughes
1389*d5c9a868SElliott HughesIf the @code{-f} option is specified, @code{floppyd_installtest} does a
1390*d5c9a868SElliott Hughesfull X-Cookie authentication and complains if this does not work.
1391*d5c9a868SElliott Hughes
1392*d5c9a868SElliott HughesThe connect-String has the format described in the floppyd-section:
1393*d5c9a868SElliott Hughes@var{hostname}@code{:}@var{displaynumber}[@code{/}@var{baseport}]
1394*d5c9a868SElliott Hughes
1395*d5c9a868SElliott Hughes@node mattrib, mbadblocks, floppyd_installtest, Commands
1396*d5c9a868SElliott Hughes@section Mattrib
1397*d5c9a868SElliott Hughes@pindex mattrib
1398*d5c9a868SElliott Hughes@cindex Changing file attributes
1399*d5c9a868SElliott Hughes@cindex Hidden files
1400*d5c9a868SElliott Hughes@cindex Read-only files (changing the attribute)
1401*d5c9a868SElliott Hughes@cindex System files
1402*d5c9a868SElliott Hughes@cindex Archive bit
1403*d5c9a868SElliott Hughes
1404*d5c9a868SElliott Hughes@code{Mattrib} is used to change MS-DOS file attribute flags. It has the
1405*d5c9a868SElliott Hughesfollowing syntax:
1406*d5c9a868SElliott Hughes
1407*d5c9a868SElliott Hughes@code{mattrib} [@code{-a|+a}] [@code{-h|+h}] [@code{-r|+r}]
1408*d5c9a868SElliott Hughes[@code{-s|+s}] [@code{-/}]  [@code{-p}] [@code{-X}] @var{msdosfile} [ @var{msdosfiles} @dots{} ]
1409*d5c9a868SElliott Hughes
1410*d5c9a868SElliott Hughes@code{Mattrib} adds attribute flags to an MS-DOS file (with the
1411*d5c9a868SElliott Hughes`@code{+}' operator) or remove attribute flags (with the `@code{-}'
1412*d5c9a868SElliott Hughesoperator).
1413*d5c9a868SElliott Hughes
1414*d5c9a868SElliott Hughes@code{Mattrib} supports the following attribute bits:
1415*d5c9a868SElliott Hughes
1416*d5c9a868SElliott Hughes@table @code
1417*d5c9a868SElliott Hughes@item a
1418*d5c9a868SElliott HughesArchive bit.  Used by some backup programs to indicate a new file.
1419*d5c9a868SElliott Hughes@item r
1420*d5c9a868SElliott HughesRead-only bit.  Used to indicate a read-only file.  Files with this bit
1421*d5c9a868SElliott Hughesset cannot be erased by @code{DEL} nor modified.
1422*d5c9a868SElliott Hughes@item s
1423*d5c9a868SElliott HughesSystem bit.  Used by MS-DOS to indicate a operating system file.
1424*d5c9a868SElliott Hughes@item h
1425*d5c9a868SElliott HughesHidden bit.  Used to make files hidden from @code{DIR}.
1426*d5c9a868SElliott Hughes@end table
1427*d5c9a868SElliott Hughes
1428*d5c9a868SElliott Hughes@code{Mattrib} supports the following command line flags:
1429*d5c9a868SElliott Hughes@table @code
1430*d5c9a868SElliott Hughes@item /
1431*d5c9a868SElliott HughesRecursive.  Recursively list the attributes of the files in the subdirectories.
1432*d5c9a868SElliott Hughes@item X
1433*d5c9a868SElliott HughesConcise. Prints the attributes without any whitespace padding.  If
1434*d5c9a868SElliott Hughesneither the "/" option is given, nor the @var{msdosfile} contains a
1435*d5c9a868SElliott Hugheswildcard, and there is only one MS-DOS file parameter on the command
1436*d5c9a868SElliott Hughesline, only the attribute is printed, and not the filename.  This option
1437*d5c9a868SElliott Hughesis convenient for scripts
1438*d5c9a868SElliott Hughes@item p
1439*d5c9a868SElliott HughesReplay mode.  Outputs a series of @code{mformat} commands that will
1440*d5c9a868SElliott Hughesreproduce the current situation, starting from a situation as left by
1441*d5c9a868SElliott Hughesuntarring the MS-DOS file system.  Commands are only output for
1442*d5c9a868SElliott Hughesattribute settings that differ from the default (archive bit set for
1443*d5c9a868SElliott Hughesfiles, unset for directories).  This option is intended to be used in
1444*d5c9a868SElliott Hughesaddition to tar. The @code{readonly} attribute is not taken into
1445*d5c9a868SElliott Hughesaccount, as tar can set that one itself.
1446*d5c9a868SElliott Hughes@end table
1447*d5c9a868SElliott Hughes
1448*d5c9a868SElliott Hughes@node mbadblocks, mcat, mattrib, Commands
1449*d5c9a868SElliott Hughes@section Mbadblocks
1450*d5c9a868SElliott Hughes@pindex mbadblocks
1451*d5c9a868SElliott Hughes@cindex Marking blocks as bad
1452*d5c9a868SElliott Hughes@cindex Bad blocks
1453*d5c9a868SElliott Hughes@cindex Read errors
1454*d5c9a868SElliott Hughes
1455*d5c9a868SElliott HughesThe @code{mbadblocks} command is used to mark some clusters on an
1456*d5c9a868SElliott HughesMS-DOS filesystem bad. It has the following syntax:
1457*d5c9a868SElliott Hughes
1458*d5c9a868SElliott Hughes@code{mbadblocks} [@code{-s} @var{sectorlist}|@code{-c} @var{clusterlist}|-w] @var{drive}@code{:}
1459*d5c9a868SElliott Hughes
1460*d5c9a868SElliott HughesIf no command line flags are supplied, @code{Mbadblocks} scans an
1461*d5c9a868SElliott HughesMS-DOS filesystem for bad blocks by simply trying to read them and
1462*d5c9a868SElliott Hughesflag them if read fails. All blocks that are unused are scanned, and
1463*d5c9a868SElliott Hughesif detected bad are marked as such in the FAT.
1464*d5c9a868SElliott Hughes
1465*d5c9a868SElliott HughesThis command is intended to be used right after @code{mformat}.  It is
1466*d5c9a868SElliott Hughesnot intended to salvage data from bad disks.
1467*d5c9a868SElliott Hughes
1468*d5c9a868SElliott Hughes
1469*d5c9a868SElliott Hughes@subsection Command line options
1470*d5c9a868SElliott Hughes
1471*d5c9a868SElliott Hughes@table @code
1472*d5c9a868SElliott Hughes@item c @var{file}
1473*d5c9a868SElliott HughesUse a list of bad clusters, rather than scanning for bad clusters
1474*d5c9a868SElliott Hughesitself.
1475*d5c9a868SElliott Hughes@item s @var{file}
1476*d5c9a868SElliott HughesUse a list of bad sectors (counted from beginning of filesystem),
1477*d5c9a868SElliott Hughesrather than trying for bad clusters itself.
1478*d5c9a868SElliott Hughes@item w
1479*d5c9a868SElliott HughesWrite a random pattern to each cluster, then read it back and flag
1480*d5c9a868SElliott Hughescluster as bad if mismatch. Only free clusters are tested in such a
1481*d5c9a868SElliott Hughesway, so any file data is preserved.
1482*d5c9a868SElliott Hughes@end table
1483*d5c9a868SElliott Hughes
1484*d5c9a868SElliott Hughes@subsection Bugs
1485*d5c9a868SElliott Hughes@code{Mbadblocks} should (but doesn't yet :-( ) also try to salvage bad
1486*d5c9a868SElliott Hughesblocks which are in use by reading them repeatedly, and then mark them
1487*d5c9a868SElliott Hughesbad.
1488*d5c9a868SElliott Hughes
1489*d5c9a868SElliott Hughes@node mcat, mcd, mbadblocks, Commands
1490*d5c9a868SElliott Hughes@section Mcat
1491*d5c9a868SElliott Hughes
1492*d5c9a868SElliott HughesThe @code{mcat} command is used to copy an entire disk image from or
1493*d5c9a868SElliott Hughesto the floppy device. It uses the following syntax:
1494*d5c9a868SElliott Hughes
1495*d5c9a868SElliott Hughes@code{mcat} [@code{-w}] @var{drive}@code{:}
1496*d5c9a868SElliott Hughes@pindex mcat
1497*d5c9a868SElliott Hughes@cindex Copying an entire disk image
1498*d5c9a868SElliott Hughes@cindex Disk image
1499*d5c9a868SElliott Hughes@cindex Floppyd cat
1500*d5c9a868SElliott Hughes
1501*d5c9a868SElliott Hughes@code{Mcat} performs the same task as the Unix @code{cat} command. It
1502*d5c9a868SElliott Hughesis included into the mtools package, since @code{cat} cannot access
1503*d5c9a868SElliott Hughesremote floppy devices offered by the mtools floppy daemon.
1504*d5c9a868SElliott HughesNow it is possible to create boot floppies remotely.
1505*d5c9a868SElliott Hughes
1506*d5c9a868SElliott HughesThe default operation is reading. The output is written to stdout.
1507*d5c9a868SElliott Hughes
1508*d5c9a868SElliott HughesIf the @code{-w} option is specified, mcat reads a disk-image from
1509*d5c9a868SElliott Hughesstdin and writes it to the given device.
1510*d5c9a868SElliott Hughes@strong{Use this carefully!} Because of the low-level nature of this
1511*d5c9a868SElliott Hughescommand, it will happily destroy any data written before on the
1512*d5c9a868SElliott Hughesdisk without warning!
1513*d5c9a868SElliott Hughes
1514*d5c9a868SElliott Hughes@node mcd, mcopy, mcat, Commands
1515*d5c9a868SElliott Hughes@section Mcd
1516*d5c9a868SElliott Hughes@pindex mcd
1517*d5c9a868SElliott Hughes@cindex Directory (changing)
1518*d5c9a868SElliott Hughes@cindex Working directory
1519*d5c9a868SElliott Hughes@cindex Current working directory (changing the)
1520*d5c9a868SElliott Hughes@cindex Default directory (changing the)
1521*d5c9a868SElliott Hughes@cindex Mcwd file
1522*d5c9a868SElliott Hughes
1523*d5c9a868SElliott HughesThe @code{mcd} command is used to change the mtools working directory
1524*d5c9a868SElliott Hugheson the MS-DOS disk. It uses the following syntax:
1525*d5c9a868SElliott Hughes
1526*d5c9a868SElliott Hughes@example
1527*d5c9a868SElliott Hughes@code{mcd} [@var{msdosdirectory}]
1528*d5c9a868SElliott Hughes@end example
1529*d5c9a868SElliott Hughes
1530*d5c9a868SElliott HughesWithout arguments, @code{mcd} reports the current device and working
1531*d5c9a868SElliott Hughesdirectory.  Otherwise, @code{mcd} changes the current device and current
1532*d5c9a868SElliott Hughesworking directory relative to an MS-DOS file system.
1533*d5c9a868SElliott Hughes
1534*d5c9a868SElliott HughesThe environmental variable @code{MCWD} may be used to locate the file
1535*d5c9a868SElliott Hugheswhere the device and current working directory information is stored.
1536*d5c9a868SElliott HughesThe default is @file{$HOME/.mcwd}.  Information in this file is ignored
1537*d5c9a868SElliott Hughesif the file is more than 6 hours old.
1538*d5c9a868SElliott Hughes
1539*d5c9a868SElliott Hughes@code{Mcd} returns 0 on success or 1 on failure.
1540*d5c9a868SElliott Hughes
1541*d5c9a868SElliott HughesUnlike MS-DOS versions of @code{CD}, @code{mcd} can be used to change to
1542*d5c9a868SElliott Hughesanother device. It may be wise to remove old @file{.mcwd} files at logout.
1543*d5c9a868SElliott Hughes
1544*d5c9a868SElliott Hughes@node mcopy, mdel, mcd, Commands
1545*d5c9a868SElliott Hughes@section Mcopy
1546*d5c9a868SElliott Hughes@pindex mcopy
1547*d5c9a868SElliott Hughes@cindex Reading MS-DOS files
1548*d5c9a868SElliott Hughes@cindex Writing MS-DOS files
1549*d5c9a868SElliott Hughes@cindex Copying MS-DOS files
1550*d5c9a868SElliott Hughes@cindex Concatenating MS-DOS files
1551*d5c9a868SElliott Hughes@cindex Text files
1552*d5c9a868SElliott Hughes@cindex CR/LF conversions
1553*d5c9a868SElliott Hughes
1554*d5c9a868SElliott HughesThe @code{mcopy} command is used to copy MS-DOS files to and from
1555*d5c9a868SElliott HughesUnix. It uses the following syntax:
1556*d5c9a868SElliott Hughes
1557*d5c9a868SElliott Hughes@example
1558*d5c9a868SElliott Hughes@code{mcopy} [@code{-bspanvmQT}] [@code{-D} @var{clash_option}] @var{sourcefile} @var{targetfile}
1559*d5c9a868SElliott Hughes@code{mcopy} [@code{-bspanvmQT}] [@code{-D} @var{clash_option}] @var{sourcefile} [ @var{sourcefiles}@dots{} ] @var{targetdirectory}
1560*d5c9a868SElliott Hughes@code{mcopy} [@code{-tnvm}] @var{MSDOSsourcefile}
1561*d5c9a868SElliott Hughes@end example
1562*d5c9a868SElliott Hughes
1563*d5c9a868SElliott Hughes
1564*d5c9a868SElliott Hughes
1565*d5c9a868SElliott Hughes@code{Mcopy} copies the specified file to the named file, or copies
1566*d5c9a868SElliott Hughesmultiple files to the named directory.  The source and target can be
1567*d5c9a868SElliott Hugheseither MS-DOS or Unix files.
1568*d5c9a868SElliott Hughes
1569*d5c9a868SElliott HughesThe use of a drive letter designation on the MS-DOS files, 'a:' for
1570*d5c9a868SElliott Hughesexample, determines the direction of the transfer.  A missing drive
1571*d5c9a868SElliott Hughesdesignation implies a Unix file whose path starts in the current
1572*d5c9a868SElliott Hughesdirectory.  If a source drive letter is specified with no attached file
1573*d5c9a868SElliott Hughesname (e.g. @code{mcopy a: .}), all files are copied from that drive.
1574*d5c9a868SElliott Hughes
1575*d5c9a868SElliott HughesIf only a single, MS-DOS source parameter is provided (e.g. "mcopy
1576*d5c9a868SElliott Hughesa:foo.exe"), an implied destination of the current directory
1577*d5c9a868SElliott Hughes(`@code{.}') is assumed.
1578*d5c9a868SElliott Hughes
1579*d5c9a868SElliott HughesA filename of `@code{-}' means standard input or standard output, depending
1580*d5c9a868SElliott Hugheson its position on the command line.
1581*d5c9a868SElliott Hughes
1582*d5c9a868SElliott Hughes@code{Mcopy} accepts the following command line options:
1583*d5c9a868SElliott Hughes
1584*d5c9a868SElliott Hughes@table @code
1585*d5c9a868SElliott Hughes@item t
1586*d5c9a868SElliott HughesText file transfer.  Mcopy translates incoming carriage return/line
1587*d5c9a868SElliott Hughesfeeds to line feeds when copying from MS-DOS to Unix, and vice-versa when
1588*d5c9a868SElliott Hughescopying from Unix to MS-DOS.
1589*d5c9a868SElliott Hughes@item b
1590*d5c9a868SElliott HughesBatch mode. Optimized for huge recursive copies, but less secure if a
1591*d5c9a868SElliott Hughescrash happens during the copy.
1592*d5c9a868SElliott Hughes@item s
1593*d5c9a868SElliott HughesRecursive copy.  Also copies directories and their contents
1594*d5c9a868SElliott Hughes@item p
1595*d5c9a868SElliott HughesPreserves the attributes of the copied files
1596*d5c9a868SElliott Hughes@item Q
1597*d5c9a868SElliott HughesWhen mcopying multiple files, quits as soon as one copy fails (for
1598*d5c9a868SElliott Hughesexample due to lacking storage space on the target disk)
1599*d5c9a868SElliott Hughes@item a
1600*d5c9a868SElliott HughesText (ASCII) file transfer.  @code{ASCII} translates incoming carriage
1601*d5c9a868SElliott Hughesreturn/line feeds to line feeds.
1602*d5c9a868SElliott Hughes@item T
1603*d5c9a868SElliott HughesText (ASCII) file transfer with character set conversion.  Differs from
1604*d5c9a868SElliott Hughes@code{-a} in the @code{ASCII} also translates incoming PC-8 characters
1605*d5c9a868SElliott Hughesto ISO-8859-1 equivalents as far as possible.  When reading DOS files,
1606*d5c9a868SElliott Hughesuntranslatable characters are replaced by '@code{#}'; when writing DOS files,
1607*d5c9a868SElliott Hughesuntranslatable characters are replaced by '@code{.}'.
1608*d5c9a868SElliott Hughes@item n
1609*d5c9a868SElliott HughesNo confirmation when overwriting Unix files.  @code{ASCII} doesn't
1610*d5c9a868SElliott Hugheswarn the user when overwriting an existing Unix file. If the target
1611*d5c9a868SElliott Hughesfile already exists, and the @code{-n} option is not in effect,
1612*d5c9a868SElliott Hughes@code{mcopy} asks whether to overwrite the file or to rename the new
1613*d5c9a868SElliott Hughesfile (see @ref{name clashes}) for details).  In order to switch off
1614*d5c9a868SElliott Hughesconfirmation for DOS files, use @code{-o}.
1615*d5c9a868SElliott Hughes@item m
1616*d5c9a868SElliott HughesPreserve the file modification time.
1617*d5c9a868SElliott Hughes@item v
1618*d5c9a868SElliott HughesVerbose. Displays the name of each file as it is copied.
1619*d5c9a868SElliott Hughes@end table
1620*d5c9a868SElliott Hughes
1621*d5c9a868SElliott Hughes@subsection Bugs
1622*d5c9a868SElliott HughesUnlike MS-DOS, the '+' operator (append) from MS-DOS is not
1623*d5c9a868SElliott Hughessupported. However, you may use @code{mtype} to produce the same effect:
1624*d5c9a868SElliott Hughes@example
1625*d5c9a868SElliott Hughesmtype a:file1 a:file2 a:file3 >unixfile
1626*d5c9a868SElliott Hughesmtype a:file1 a:file2 a:file3 | mcopy - a:msdosfile
1627*d5c9a868SElliott Hughes@end example
1628*d5c9a868SElliott Hughes
1629*d5c9a868SElliott Hughes@node mdel, mdeltree, mcopy, Commands
1630*d5c9a868SElliott Hughes@section Mdel
1631*d5c9a868SElliott Hughes@pindex mdel
1632*d5c9a868SElliott Hughes@cindex removing MS-DOS files
1633*d5c9a868SElliott Hughes@cindex erasing MS-DOS files
1634*d5c9a868SElliott Hughes@cindex deleting MS-DOS files
1635*d5c9a868SElliott Hughes
1636*d5c9a868SElliott HughesThe @code{mdel} command is used to delete an MS-DOS file. Its syntax
1637*d5c9a868SElliott Hughesis:
1638*d5c9a868SElliott Hughes
1639*d5c9a868SElliott Hughes@display
1640*d5c9a868SElliott Hughes@code{mdel} [@code{-v}] @var{msdosfile} [ @var{msdosfiles} @dots{}  ]
1641*d5c9a868SElliott Hughes@end display
1642*d5c9a868SElliott Hughes
1643*d5c9a868SElliott Hughes@code{Mdel} deletes files on an MS-DOS file system.
1644*d5c9a868SElliott Hughes
1645*d5c9a868SElliott Hughes@code{Mdel} asks for verification prior to removing a read-only file.
1646*d5c9a868SElliott Hughes
1647*d5c9a868SElliott Hughes@node mdeltree, mdir, mdel, Commands
1648*d5c9a868SElliott Hughes@section Mdeltree
1649*d5c9a868SElliott Hughes@pindex mdeltree
1650*d5c9a868SElliott Hughes@cindex removing an MS-DOS directory recursively
1651*d5c9a868SElliott Hughes@cindex erasing an MS-DOS directory recursively
1652*d5c9a868SElliott Hughes@cindex deleting an MS-DOS directory recursively
1653*d5c9a868SElliott Hughes@cindex recursively removing an MS-DOS directory
1654*d5c9a868SElliott Hughes
1655*d5c9a868SElliott HughesThe @code{mdeltree} command is used to delete an MS-DOS file. Its syntax
1656*d5c9a868SElliott Hughesis:
1657*d5c9a868SElliott Hughes
1658*d5c9a868SElliott Hughes@display
1659*d5c9a868SElliott Hughes@code{mdeltree} [@code{-v}] @var{msdosdirectory} [@var{msdosdirectories}@dots{}]
1660*d5c9a868SElliott Hughes@end display
1661*d5c9a868SElliott Hughes
1662*d5c9a868SElliott Hughes@code{Mdeltree} removes a directory and all the files and subdirectories
1663*d5c9a868SElliott Hughesit contains from an MS-DOS file system. An error occurs if the directory
1664*d5c9a868SElliott Hughesto be removed does not exist.
1665*d5c9a868SElliott Hughes
1666*d5c9a868SElliott Hughes@node mdir, mdu, mdeltree, Commands
1667*d5c9a868SElliott Hughes@section Mdir
1668*d5c9a868SElliott Hughes@pindex mdir
1669*d5c9a868SElliott Hughes@cindex Read-only files (listing them)
1670*d5c9a868SElliott Hughes@cindex Listing a directory
1671*d5c9a868SElliott Hughes@cindex Directory listing
1672*d5c9a868SElliott Hughes
1673*d5c9a868SElliott HughesThe @code{mdir} command is used to display an MS-DOS directory. Its
1674*d5c9a868SElliott Hughessyntax is:
1675*d5c9a868SElliott Hughes
1676*d5c9a868SElliott Hughes@code{mdir} [@code{-/}] [@code{-f}] [@code{-w}] [@code{-a}] [@code{-b}] @var{msdosfile} [ @var{msdosfiles}@dots{}]
1677*d5c9a868SElliott Hughes
1678*d5c9a868SElliott Hughes@code{Mdir}
1679*d5c9a868SElliott Hughesdisplays the contents of MS-DOS directories, or the entries for some
1680*d5c9a868SElliott HughesMS-DOS files.
1681*d5c9a868SElliott Hughes
1682*d5c9a868SElliott Hughes@code{Mdir} supports the following command line options:
1683*d5c9a868SElliott Hughes
1684*d5c9a868SElliott Hughes@table @code
1685*d5c9a868SElliott Hughes@item /
1686*d5c9a868SElliott HughesRecursive output, just like MS-DOS' @code{-s} option
1687*d5c9a868SElliott Hughes@item w
1688*d5c9a868SElliott HughesWide output.  With this option, @code{mdir} prints the filenames across
1689*d5c9a868SElliott Hughesthe page without displaying the file size or creation date.
1690*d5c9a868SElliott Hughes@item a
1691*d5c9a868SElliott HughesAlso list hidden files.
1692*d5c9a868SElliott Hughes@item f
1693*d5c9a868SElliott HughesFast.  Do not try to find out free space.  On larger disks, finding out
1694*d5c9a868SElliott Hughesthe amount of free space takes up some non trivial amount of time, as
1695*d5c9a868SElliott Hughesthe whole FAT must be read in and scanned.  The @code{-f} flag bypasses
1696*d5c9a868SElliott Hughesthis step.  This flag is not needed on FAT32 file systems, which store
1697*d5c9a868SElliott Hughesthe size explicitly.
1698*d5c9a868SElliott Hughes@item b
1699*d5c9a868SElliott HughesConcise listing. Lists each directory name or filename, one per line
1700*d5c9a868SElliott Hughes(including the filename extension). This switch displays no heading
1701*d5c9a868SElliott Hughesinformation and no summary. Only a newline separated list of pathnames
1702*d5c9a868SElliott Hughesis displayed.
1703*d5c9a868SElliott Hughes@end table
1704*d5c9a868SElliott Hughes
1705*d5c9a868SElliott HughesAn error occurs if a component of the path is not a directory.
1706*d5c9a868SElliott Hughes
1707*d5c9a868SElliott Hughes@node mdu, mformat, mdir, Commands
1708*d5c9a868SElliott Hughes@section Mdu
1709*d5c9a868SElliott Hughes@pindex mdu
1710*d5c9a868SElliott Hughes@cindex Space occupied by directories and files
1711*d5c9a868SElliott Hughes@cindex du
1712*d5c9a868SElliott Hughes@cindex Listing space occupied by directories and files
1713*d5c9a868SElliott Hughes@cindex Occupation of space by directories and files
1714*d5c9a868SElliott Hughes
1715*d5c9a868SElliott Hughes@code{Mdu} is used to list the space occupied by a directory, its
1716*d5c9a868SElliott Hughessubdirectories and its files. It is similar to the @code{du} command on
1717*d5c9a868SElliott HughesUnix.  The unit used are clusters.  Use the minfo command to find out
1718*d5c9a868SElliott Hughesthe cluster size.
1719*d5c9a868SElliott Hughes
1720*d5c9a868SElliott Hughes@code{mdu} [@code{-a}] [ @var{msdosfiles} @dots{} ]
1721*d5c9a868SElliott Hughes
1722*d5c9a868SElliott Hughes
1723*d5c9a868SElliott Hughes@table @code
1724*d5c9a868SElliott Hughes@item a
1725*d5c9a868SElliott HughesAll files.  List also the space occupied for individual files.
1726*d5c9a868SElliott Hughes@item s
1727*d5c9a868SElliott HughesOnly list the total space, don't give details for each subdirectory.
1728*d5c9a868SElliott Hughes@end table
1729*d5c9a868SElliott Hughes
1730*d5c9a868SElliott Hughes
1731*d5c9a868SElliott Hughes
1732*d5c9a868SElliott Hughes@node mformat, mkmanifest, mdu, Commands
1733*d5c9a868SElliott Hughes@section Mformat
1734*d5c9a868SElliott Hughes@pindex mformat
1735*d5c9a868SElliott Hughes@cindex Initializing disks
1736*d5c9a868SElliott Hughes@cindex Formatting disks
1737*d5c9a868SElliott Hughes@cindex File system creation
1738*d5c9a868SElliott Hughes
1739*d5c9a868SElliott HughesThe @code{mformat} command is used to add an MS-DOS file system to a
1740*d5c9a868SElliott Hugheslow-level formatted diskette. Its syntax is:
1741*d5c9a868SElliott Hughes
1742*d5c9a868SElliott Hughes@display
1743*d5c9a868SElliott Hughes@code{mformat} [@code{-t} @var{cylinders}|@code{-T} @var{tot_sectors}] [@code{-h} @var{heads}] [@code{-s} @var{sectors}]
1744*d5c9a868SElliott Hughes  [@code{-f} @var{size}] [@code{-1}] [@code{-4}] [@code{-8}]
1745*d5c9a868SElliott Hughes  [@code{-v} @var{volume_label}]
1746*d5c9a868SElliott Hughes  [@code{-F}] [@code{-S} @var{sizecode}]
1747*d5c9a868SElliott Hughes  [@code{-M} @var{software_sector_size}]
1748*d5c9a868SElliott Hughes  [@code{-N} @var{serial_number}] [@code{-a}]
1749*d5c9a868SElliott Hughes  [@code{-C}] [@code{-H} @var{hidden_sectors}] [@code{-I} @var{fsVersion}]
1750*d5c9a868SElliott Hughes  [@code{-r} @var{root_sectors}] [@code{-L} @var{fat_len}]
1751*d5c9a868SElliott Hughes  [@code{-B} @var{boot_sector}] [@code{-k}]
1752*d5c9a868SElliott Hughes  [@code{-m} @var{media_descriptor}]
1753*d5c9a868SElliott Hughes  [@code{-K} @var{backup_boot}]
1754*d5c9a868SElliott Hughes  [@code{-R} @var{nb_reserved_sectors}]
1755*d5c9a868SElliott Hughes  [@code{-c} @var{clusters_per_sector}]
1756*d5c9a868SElliott Hughes  [@code{-d} @var{fat_copies}]
1757*d5c9a868SElliott Hughes  [@code{-X}] [@code{-2} @var{sectors_on_track_0}] [@code{-3}]
1758*d5c9a868SElliott Hughes  [@code{-0} @var{rate_on_track_0}] [@code{-A} @var{rate_on_other_tracks}]
1759*d5c9a868SElliott Hughes  @var{drive:}
1760*d5c9a868SElliott Hughes@end display
1761*d5c9a868SElliott Hughes
1762*d5c9a868SElliott Hughes@code{Mformat} adds a minimal MS-DOS file system (boot sector, FAT, and
1763*d5c9a868SElliott Hughesroot directory) to a diskette that has already been formatted by a Unix
1764*d5c9a868SElliott Hugheslow-level format.
1765*d5c9a868SElliott Hughes
1766*d5c9a868SElliott Hughes
1767*d5c9a868SElliott HughesThe following options are supported: (The S, 2, 1 and M options may not
1768*d5c9a868SElliott Hughesexist if this copy of mtools has been compiled without the USE_2M
1769*d5c9a868SElliott Hughesoption)
1770*d5c9a868SElliott Hughes
1771*d5c9a868SElliott HughesThe following options are the same as for MS-DOS's format command:
1772*d5c9a868SElliott Hughes
1773*d5c9a868SElliott Hughes@comment xMANoptions
1774*d5c9a868SElliott Hughes
1775*d5c9a868SElliott Hughes@table @code
1776*d5c9a868SElliott Hughes@item v
1777*d5c9a868SElliott HughesSpecifies the volume label. A volume label identifies the disk and can
1778*d5c9a868SElliott Hughesbe a maximum of 11 characters. If you omit the -v switch, mformat will
1779*d5c9a868SElliott Hughesassign no label to the disk.
1780*d5c9a868SElliott Hughes@item f
1781*d5c9a868SElliott HughesSpecifies the size of the DOS file system to format. Only a certain
1782*d5c9a868SElliott Hughesnumber of predefined sizes are supported by this flag; for others use
1783*d5c9a868SElliott Hughesthe -h/-t/-s flags. The following sizes are supported:
1784*d5c9a868SElliott Hughes@table @asis
1785*d5c9a868SElliott Hughes@item 160
1786*d5c9a868SElliott Hughes160K, single-sided, 8 sectors per track, 40 cylinders (for 5 1/4 DD)
1787*d5c9a868SElliott Hughes@item 180
1788*d5c9a868SElliott Hughes160K, single-sided, 9 sectors per track, 40 cylinders (for 5 1/4 DD)
1789*d5c9a868SElliott Hughes@item 320
1790*d5c9a868SElliott Hughes320K, double-sided, 8 sectors per track, 40 cylinders (for 5 1/4 DD)
1791*d5c9a868SElliott Hughes@item 360
1792*d5c9a868SElliott Hughes360K, double-sided, 9 sectors per track, 40 cylinders (for 5 1/4 DD)
1793*d5c9a868SElliott Hughes@item 720
1794*d5c9a868SElliott Hughes720K, double-sided, 9 sectors per track, 80 cylinders (for 3 1/2 DD)
1795*d5c9a868SElliott Hughes@item 1200
1796*d5c9a868SElliott Hughes1200K, double-sided, 15 sectors per track, 80 cylinders (for 5 1/4 HD)
1797*d5c9a868SElliott Hughes@item 1440
1798*d5c9a868SElliott Hughes1440K, double-sided, 18 sectors per track, 80 cylinders (for 3 1/2 HD)
1799*d5c9a868SElliott Hughes@item 2880
1800*d5c9a868SElliott Hughes2880K, double-sided, 36 sectors per track, 80 cylinders (for 3 1/2 ED)
1801*d5c9a868SElliott Hughes@end table
1802*d5c9a868SElliott Hughes
1803*d5c9a868SElliott Hughes@item t
1804*d5c9a868SElliott HughesSpecifies the number of tracks on the disk.
1805*d5c9a868SElliott Hughes@item T
1806*d5c9a868SElliott HughesSpecifies the number of total sectors on the disk. Only one of these 2
1807*d5c9a868SElliott Hughesoptions may be specified (tracks or total sectors)
1808*d5c9a868SElliott Hughes@item h
1809*d5c9a868SElliott HughesThe number of heads (sides).
1810*d5c9a868SElliott Hughes@item s
1811*d5c9a868SElliott HughesSpecifies the number of sectors per track. If the 2m option is given,
1812*d5c9a868SElliott Hughesnumber of 512-byte sector equivalents on generic tracks (i.e. not head 0
1813*d5c9a868SElliott Hughestrack 0).  If the 2m option is not given, number of physical sectors per
1814*d5c9a868SElliott Hughestrack (which may be bigger than 512 bytes).
1815*d5c9a868SElliott Hughes
1816*d5c9a868SElliott Hughes@item 1
1817*d5c9a868SElliott HughesFormats a single side (equivalent to -h 1)
1818*d5c9a868SElliott Hughes
1819*d5c9a868SElliott Hughes@item 4
1820*d5c9a868SElliott HughesFormats a 360K double-sided disk (equivalent to -f 360). When used
1821*d5c9a868SElliott Hughestogether with -the 1 switch, this switch formats a 180K disk
1822*d5c9a868SElliott Hughes
1823*d5c9a868SElliott Hughes@item 8
1824*d5c9a868SElliott HughesFormats a disk with 8 sectors per track.
1825*d5c9a868SElliott Hughes
1826*d5c9a868SElliott Hughes@end table
1827*d5c9a868SElliott Hughes
1828*d5c9a868SElliott HughesMS-DOS format's @code{q}, @code{u} and @code{b} options are not
1829*d5c9a868SElliott Hughessupported, and @code{s} has a different meaning.
1830*d5c9a868SElliott Hughes
1831*d5c9a868SElliott HughesThe following options are specific to mtools:
1832*d5c9a868SElliott Hughes
1833*d5c9a868SElliott Hughes@table @code
1834*d5c9a868SElliott Hughes
1835*d5c9a868SElliott Hughes@item F
1836*d5c9a868SElliott HughesFormat the partition as FAT32.
1837*d5c9a868SElliott Hughes
1838*d5c9a868SElliott Hughes@item S
1839*d5c9a868SElliott HughesThe size code. The size of the sector is 2 ^ (sizecode + 7).
1840*d5c9a868SElliott Hughes@item X
1841*d5c9a868SElliott Hughesformats the disk as an XDF disk. @xref{XDF}, for more details. The disk
1842*d5c9a868SElliott Hugheshas first to be low-level formatted using the xdfcopy utility included
1843*d5c9a868SElliott Hughesin the fdutils package. XDF disks are used for instance for OS/2 install
1844*d5c9a868SElliott Hughesdisks.
1845*d5c9a868SElliott Hughes@item 2
1846*d5c9a868SElliott Hughes2m format. The parameter to this option describes the number of
1847*d5c9a868SElliott Hughessectors on track 0, head 0. This option is recommended for sectors
1848*d5c9a868SElliott Hughesbigger than normal.
1849*d5c9a868SElliott Hughes@item 3
1850*d5c9a868SElliott Hughesdon't use a 2m format, even if the current geometry of the disk is a 2m
1851*d5c9a868SElliott Hughesgeometry.
1852*d5c9a868SElliott Hughes@item 0
1853*d5c9a868SElliott HughesData transfer rate on track 0
1854*d5c9a868SElliott Hughes@item A
1855*d5c9a868SElliott HughesData transfer rate on tracks other than 0
1856*d5c9a868SElliott Hughes@item M
1857*d5c9a868SElliott Hughessoftware sector size. This parameter describes the sector size in bytes used
1858*d5c9a868SElliott Hughesby the MS-DOS file system. By default it is the physical sector size.
1859*d5c9a868SElliott Hughes@item N
1860*d5c9a868SElliott HughesUses the requested serial number, instead of generating one
1861*d5c9a868SElliott Hughesautomatically
1862*d5c9a868SElliott Hughes@item a
1863*d5c9a868SElliott HughesIf this option is given, an Atari style serial number is generated.
1864*d5c9a868SElliott HughesAtaris store their serial number in the OEM label.
1865*d5c9a868SElliott Hughes@item C
1866*d5c9a868SElliott Hughescreates the disk image file to install the MS-DOS file system on
1867*d5c9a868SElliott Hughesit. Obviously, this is useless on physical devices such as floppies
1868*d5c9a868SElliott Hughesand hard disk partitions, but is interesting for image files.
1869*d5c9a868SElliott Hughes@item H
1870*d5c9a868SElliott Hughesnumber of hidden sectors. This parameter is useful for formatting hard
1871*d5c9a868SElliott Hughesdisk partition, which are not aligned on track boundaries (i.e. first
1872*d5c9a868SElliott Hugheshead of first track doesn't belong to the partition, but contains a
1873*d5c9a868SElliott Hughespartition table). In that case the number of hidden sectors is in
1874*d5c9a868SElliott Hughesgeneral the number of sectors per cylinder. This is untested.
1875*d5c9a868SElliott Hughes@item I
1876*d5c9a868SElliott HughesSets the fsVersion id when formatting a FAT32 drive.  In order to find
1877*d5c9a868SElliott Hughesthis out, run minfo on an existing FAT32 drive, and mail me about it, so
1878*d5c9a868SElliott HughesI can include the correct value in future versions of mtools.
1879*d5c9a868SElliott Hughes@item c
1880*d5c9a868SElliott HughesSets the size of a cluster (in sectors).  If this cluster size would
1881*d5c9a868SElliott Hughesgenerate a FAT that too big for its number of bits, mtools automatically
1882*d5c9a868SElliott Hughesincreases the cluster size, until the FAT is small enough. If no
1883*d5c9a868SElliott Hughescluster size is specified explicitly, mtools uses a default value as
1884*d5c9a868SElliott Hughesdescribed in section ``Number of sectors per cluster'' below.
1885*d5c9a868SElliott Hughes@item d
1886*d5c9a868SElliott HughesSets the number of FAT copies. Default is 2. This setting can also be
1887*d5c9a868SElliott Hughesspecified using the @code{MTOOLS_NFATS} environment variable.
1888*d5c9a868SElliott Hughes@item r
1889*d5c9a868SElliott HughesSets the size of the root directory (in sectors).  Only applicable to 12
1890*d5c9a868SElliott Hughesand 16 bit FATs. This setting can also be specified using the
1891*d5c9a868SElliott Hughes@code{MTOOLS_DIR_LEN} environment variable.
1892*d5c9a868SElliott Hughes@item L
1893*d5c9a868SElliott HughesSets the length of the FAT.
1894*d5c9a868SElliott Hughes@item B
1895*d5c9a868SElliott HughesUse the boot sector stored in the given file or device, instead of using
1896*d5c9a868SElliott Hughesits own.  Only the geometry fields are updated to match the target disks
1897*d5c9a868SElliott Hughesparameters.
1898*d5c9a868SElliott Hughes@item k
1899*d5c9a868SElliott HughesKeep the existing boot sector as much as possible.  Only the geometry
1900*d5c9a868SElliott Hughesfields and other similar file system data are updated to match the target
1901*d5c9a868SElliott Hughesdisks parameters.
1902*d5c9a868SElliott Hughes@item K
1903*d5c9a868SElliott HughesSets the sector number where the backup of the boot sector should be
1904*d5c9a868SElliott Hughesstored (only relevant on FAT32).
1905*d5c9a868SElliott Hughes@item R
1906*d5c9a868SElliott HughesSets the number of reserved sectors for this filesystem. This must be
1907*d5c9a868SElliott Hughesat least 1 for non-FAT32 disks, and at least 3 for FAT disks (in order
1908*d5c9a868SElliott Hughesto accommodate the boot sector, the info sector and the backup boot
1909*d5c9a868SElliott Hughessector).
1910*d5c9a868SElliott Hughes
1911*d5c9a868SElliott Hughes@item m
1912*d5c9a868SElliott HughesUse a non-standard media descriptor byte for this disk. The media
1913*d5c9a868SElliott Hughesdescriptor is stored at position 21 of the boot sector, and as first
1914*d5c9a868SElliott Hughesbyte in each FAT copy. Using this option may confuse DOS or older mtools
1915*d5c9a868SElliott Hughesversion, and may make the disk unreadable. Only use if you know what you
1916*d5c9a868SElliott Hughesare doing.
1917*d5c9a868SElliott Hughes
1918*d5c9a868SElliott Hughes@end table
1919*d5c9a868SElliott Hughes
1920*d5c9a868SElliott HughesTo format a diskette at a density other than the default, you must supply
1921*d5c9a868SElliott Hughes(at least) those command line parameters that are different from the
1922*d5c9a868SElliott Hughesdefault.
1923*d5c9a868SElliott Hughes
1924*d5c9a868SElliott Hughes@code{Mformat} returns 0 on success or 1 on failure.
1925*d5c9a868SElliott Hughes
1926*d5c9a868SElliott HughesIt doesn't record bad block information to the Fat, use
1927*d5c9a868SElliott Hughes@code{mbadblocks} for that.
1928*d5c9a868SElliott Hughes
1929*d5c9a868SElliott Hughes@subsection Number of sectors per cluster
1930*d5c9a868SElliott Hughes
1931*d5c9a868SElliott HughesIf the user indicates no cluster size, mformat figures out a default
1932*d5c9a868SElliott Hughesvalue for it.
1933*d5c9a868SElliott Hughes
1934*d5c9a868SElliott HughesFor FAT32 it uses the following table to determine the number of
1935*d5c9a868SElliott Hughessectors per cluster, depending on the total number of sectors on the
1936*d5c9a868SElliott Hughesfilesystem.
1937*d5c9a868SElliott Hughes
1938*d5c9a868SElliott Hughesmore than 32*1024*1024*2: 64 sectors@*
1939*d5c9a868SElliott Hughesbetween 16*1024*1024*2 and 32*1024*1024*2: 32 sectors@*
1940*d5c9a868SElliott Hughesbetween 8*1024*1024*2 and 16*1024*1024*2: 16 sectors@*
1941*d5c9a868SElliott Hughesbetween 260*1024*2 and 81024*1024*2: 1 sectors@*
1942*d5c9a868SElliott Hughes
1943*d5c9a868SElliott HughesThis is derived from information on page 20 of Microsoft's
1944*d5c9a868SElliott Hughes@code{fatgen103} document, which currently can be found at the
1945*d5c9a868SElliott Hughesfollowing address:
1946*d5c9a868SElliott Hughes
1947*d5c9a868SElliott Hughes@code{https://staff.washington.edu/dittrich/misc/fatgen103.pdf}
1948*d5c9a868SElliott Hughes
1949*d5c9a868SElliott HughesFor FAT12 and FAT16, mformat uses an iterative approach, where it
1950*d5c9a868SElliott Hughesstarts with a set value, which it doubles until it is able to fill up
1951*d5c9a868SElliott Hughesthe disk using that cluster size and a number of cluster less than the
1952*d5c9a868SElliott Hughesmaximum allowed.
1953*d5c9a868SElliott Hughes
1954*d5c9a868SElliott HughesThe starting value is 1 for disks with one head or less than 2000
1955*d5c9a868SElliott Hughessectors, and 2 for disks with more than one head, and more than 2000
1956*d5c9a868SElliott Hughessectors.
1957*d5c9a868SElliott Hughes
1958*d5c9a868SElliott HughesThe number of sectors per cluster cannot go beyond 128.
1959*d5c9a868SElliott Hughes
1960*d5c9a868SElliott Hughes@node mkmanifest, minfo, mformat, Commands
1961*d5c9a868SElliott Hughes@section Mkmanifest
1962*d5c9a868SElliott Hughes@pindex mkmanifest
1963*d5c9a868SElliott Hughes@cindex packing list
1964*d5c9a868SElliott Hughes
1965*d5c9a868SElliott HughesThe @code{mkmanifest} command is used to create a shell script (packing
1966*d5c9a868SElliott Hugheslist) to restore Unix filenames. Its syntax is:
1967*d5c9a868SElliott Hughes
1968*d5c9a868SElliott Hughes@code{mkmanifest} [ @var{files} ]
1969*d5c9a868SElliott Hughes
1970*d5c9a868SElliott Hughes@code{Mkmanifest} creates a shell script that aids in the restoration of
1971*d5c9a868SElliott HughesUnix filenames that got clobbered by the MS-DOS filename restrictions.
1972*d5c9a868SElliott HughesMS-DOS filenames are restricted to 8 character names, 3 character
1973*d5c9a868SElliott Hughesextensions, upper case only, no device names, and no illegal characters.
1974*d5c9a868SElliott Hughes
1975*d5c9a868SElliott Hughes
1976*d5c9a868SElliott HughesThe mkmanifest program is compatible with the methods used in
1977*d5c9a868SElliott Hughes@code{pcomm, arc,} and @code{mtools} to change perfectly good Unix
1978*d5c9a868SElliott Hughesfilenames to fit the MS-DOS restrictions. This command is only useful if
1979*d5c9a868SElliott Hughesthe target system which will read the diskette cannot handle VFAT long
1980*d5c9a868SElliott Hughesnames.
1981*d5c9a868SElliott Hughes
1982*d5c9a868SElliott Hughes@subsection Example
1983*d5c9a868SElliott HughesYou want to copy the following Unix files to a MS-DOS diskette (using the
1984*d5c9a868SElliott Hughes@code{mcopy} command).
1985*d5c9a868SElliott Hughes
1986*d5c9a868SElliott Hughes@example
1987*d5c9a868SElliott Hughes  very_long_name
1988*d5c9a868SElliott Hughes  2.many.dots
1989*d5c9a868SElliott Hughes  illegal:
1990*d5c9a868SElliott Hughes  good.c
1991*d5c9a868SElliott Hughes  prn.dev
1992*d5c9a868SElliott Hughes  Capital
1993*d5c9a868SElliott Hughes@end example
1994*d5c9a868SElliott Hughes
1995*d5c9a868SElliott Hughes@code{ASCII}
1996*d5c9a868SElliott Hughesconverts the names to:
1997*d5c9a868SElliott Hughes
1998*d5c9a868SElliott Hughes@example
1999*d5c9a868SElliott Hughes  very_lon
2000*d5c9a868SElliott Hughes  2xmany.dot
2001*d5c9a868SElliott Hughes  illegalx
2002*d5c9a868SElliott Hughes  good.c
2003*d5c9a868SElliott Hughes  xprn.dev
2004*d5c9a868SElliott Hughes  capital
2005*d5c9a868SElliott Hughes@end example
2006*d5c9a868SElliott Hughes
2007*d5c9a868SElliott HughesThe command:
2008*d5c9a868SElliott Hughes@example
2009*d5c9a868SElliott Hughesmkmanifest very_long_name 2.many.dots illegal: good.c prn.dev Capital >manifest
2010*d5c9a868SElliott Hughes@end example
2011*d5c9a868SElliott Hugheswould produce the following:
2012*d5c9a868SElliott Hughes@example
2013*d5c9a868SElliott Hughes  mv very_lon very_long_name
2014*d5c9a868SElliott Hughes  mv 2xmany.dot 2.many.dots
2015*d5c9a868SElliott Hughes  mv illegalx illegal:
2016*d5c9a868SElliott Hughes  mv xprn.dev prn.dev
2017*d5c9a868SElliott Hughes  mv capital Capital
2018*d5c9a868SElliott Hughes@end example
2019*d5c9a868SElliott Hughes
2020*d5c9a868SElliott HughesNotice that "good.c" did not require any conversion, so it did not
2021*d5c9a868SElliott Hughesappear in the output.
2022*d5c9a868SElliott Hughes
2023*d5c9a868SElliott HughesSuppose I've copied these files from the diskette to another Unix
2024*d5c9a868SElliott Hughessystem, and I now want the files back to their original names.  If the
2025*d5c9a868SElliott Hughesfile "manifest" (the output captured above) was sent along with those
2026*d5c9a868SElliott Hughesfiles, it could be used to convert the filenames.
2027*d5c9a868SElliott Hughes
2028*d5c9a868SElliott Hughes@subsection Bugs
2029*d5c9a868SElliott Hughes
2030*d5c9a868SElliott HughesThe short names generated by @code{mkmanifest} follow the old convention
2031*d5c9a868SElliott Hughes(from mtools-2.0.7) and not the one from Windows 95 and mtools-3.0.
2032*d5c9a868SElliott Hughes
2033*d5c9a868SElliott Hughes
2034*d5c9a868SElliott Hughes@node minfo, mlabel, mkmanifest, Commands
2035*d5c9a868SElliott Hughes@section Minfo
2036*d5c9a868SElliott Hughes@pindex minfo
2037*d5c9a868SElliott Hughes@cindex mformat parameters
2038*d5c9a868SElliott Hughes@cindex getting parameters of a MS-DOS file system
2039*d5c9a868SElliott Hughes
2040*d5c9a868SElliott HughesThe @code{minfo} command prints the parameters of a MS-DOS file system, such
2041*d5c9a868SElliott Hughesas number of sectors, heads and cylinders.  It also prints an mformat
2042*d5c9a868SElliott Hughescommand line which can be used to create a similar MS-DOS file system on
2043*d5c9a868SElliott Hughesanother media.  However, this doesn't work with 2m or XDF media, and
2044*d5c9a868SElliott Hugheswith MS-DOS 1.0 file systems
2045*d5c9a868SElliott Hughes@display
2046*d5c9a868SElliott Hughes@code{minfo} @var{drive}:
2047*d5c9a868SElliott Hughes@end display
2048*d5c9a868SElliott Hughes
2049*d5c9a868SElliott HughesMinfo supports the following option:
2050*d5c9a868SElliott Hughes@table @code
2051*d5c9a868SElliott Hughes@item v
2052*d5c9a868SElliott HughesPrints a hexdump of the boot sector, in addition to the other information
2053*d5c9a868SElliott Hughes@end table
2054*d5c9a868SElliott Hughes
2055*d5c9a868SElliott Hughes
2056*d5c9a868SElliott Hughes@node mlabel, mmd, minfo, Commands
2057*d5c9a868SElliott Hughes@section Mlabel
2058*d5c9a868SElliott Hughes@pindex mlabel
2059*d5c9a868SElliott Hughes@cindex Labeling a disk
2060*d5c9a868SElliott Hughes@cindex Disk label
2061*d5c9a868SElliott Hughes
2062*d5c9a868SElliott HughesThe @code{mlabel} command adds a volume label to a disk. Its syntax is:
2063*d5c9a868SElliott Hughes@display
2064*d5c9a868SElliott Hughes@code{mlabel} [@code{-vcsn}] [@code{-N} @var{serial}] @var{drive}:[@var{new_label}]
2065*d5c9a868SElliott Hughes@end display
2066*d5c9a868SElliott Hughes
2067*d5c9a868SElliott Hughes@code{Mlabel} displays the current volume label, if present. If
2068*d5c9a868SElliott Hughes@var{new_label} is not given, and if neither the @code{c} nor the
2069*d5c9a868SElliott Hughes@code{s} options are set, it prompts the user for a new volume label.
2070*d5c9a868SElliott HughesTo delete an existing volume label, press return at the prompt.
2071*d5c9a868SElliott Hughes
2072*d5c9a868SElliott HughesThe label is limited to 11 single-byte characters,
2073*d5c9a868SElliott Hughese.g. @code{Name1234567}.
2074*d5c9a868SElliott Hughes
2075*d5c9a868SElliott HughesReasonable care is taken to create a valid MS-DOS volume label.  If an
2076*d5c9a868SElliott Hughesinvalid label is specified, @code{mlabel} changes the label (and
2077*d5c9a868SElliott Hughesdisplays the new label if the verbose mode is set). @code{Mlabel}
2078*d5c9a868SElliott Hughesreturns 0 on success or 1 on failure.
2079*d5c9a868SElliott Hughes
2080*d5c9a868SElliott HughesMlabel supports the following options:
2081*d5c9a868SElliott Hughes@table @code
2082*d5c9a868SElliott Hughes@item c
2083*d5c9a868SElliott HughesClears an existing label, without prompting the user
2084*d5c9a868SElliott Hughes@item s
2085*d5c9a868SElliott HughesShows the existing label, without prompting the user.
2086*d5c9a868SElliott Hughes@item n
2087*d5c9a868SElliott HughesAssigns a new (random) serial number to the disk
2088*d5c9a868SElliott Hughes@item N @var{serial}
2089*d5c9a868SElliott HughesSets the supplied serial number. The serial number should be supplied as
2090*d5c9a868SElliott Hughesan 8 digit hexadecimal number, without spaces
2091*d5c9a868SElliott Hughes@end table
2092*d5c9a868SElliott Hughes
2093*d5c9a868SElliott Hughes
2094*d5c9a868SElliott Hughes@node mmd, mmount, mlabel, Commands
2095*d5c9a868SElliott Hughes@section Mmd
2096*d5c9a868SElliott Hughes@pindex mmd
2097*d5c9a868SElliott Hughes@cindex Making a directory
2098*d5c9a868SElliott Hughes@cindex Creating a directory
2099*d5c9a868SElliott Hughes@cindex Directory creation
2100*d5c9a868SElliott Hughes@cindex Subdirectory creation
2101*d5c9a868SElliott Hughes
2102*d5c9a868SElliott HughesThe @code{mmd} command is used to make an MS-DOS subdirectory. Its
2103*d5c9a868SElliott Hughessyntax is:
2104*d5c9a868SElliott Hughes
2105*d5c9a868SElliott Hughes@code{mmd} [@code{-D} @var{clash_option}] @var{msdosdirectory} [
2106*d5c9a868SElliott Hughes@var{msdosdirectories}@dots{} ]
2107*d5c9a868SElliott Hughes
2108*d5c9a868SElliott Hughes@code{Mmd} makes a new directory on an MS-DOS file system. An error occurs
2109*d5c9a868SElliott Hughesif the directory already exists.
2110*d5c9a868SElliott Hughes
2111*d5c9a868SElliott Hughes
2112*d5c9a868SElliott Hughes@node mmount, mmove, mmd, Commands
2113*d5c9a868SElliott Hughes@section Mmount
2114*d5c9a868SElliott Hughes@pindex mmount
2115*d5c9a868SElliott Hughes@cindex Linux enhancements (mmount)
2116*d5c9a868SElliott Hughes@cindex Mounting a disk
2117*d5c9a868SElliott Hughes@cindex High capacity formats, mounting
2118*d5c9a868SElliott Hughes
2119*d5c9a868SElliott HughesThe @code{mmount} command is used to mount an MS-DOS disk. It is only
2120*d5c9a868SElliott Hughesavailable on Linux, as it is only useful if the OS kernel allows
2121*d5c9a868SElliott Hughesconfiguration of the disk geometry. Its syntax is:
2122*d5c9a868SElliott Hughes
2123*d5c9a868SElliott Hughes@code{mmount} @var{msdosdrive} [@var{mountargs}]
2124*d5c9a868SElliott Hughes
2125*d5c9a868SElliott Hughes@code{Mmount}
2126*d5c9a868SElliott Hughesreads the boot sector of an MS-DOS disk, configures the drive geometry,
2127*d5c9a868SElliott Hughesand finally mounts it passing
2128*d5c9a868SElliott Hughes@code{mountargs} to @code{mount. }
2129*d5c9a868SElliott HughesIf no mount arguments are specified, the name of the device is
2130*d5c9a868SElliott Hughesused. If the disk is write protected, it is automatically mounted read
2131*d5c9a868SElliott Hughesonly.
2132*d5c9a868SElliott Hughes
2133*d5c9a868SElliott Hughes
2134*d5c9a868SElliott Hughes@node mmove, mpartition, mmount, Commands
2135*d5c9a868SElliott Hughes@section Mmove
2136*d5c9a868SElliott Hughes@pindex mmove
2137*d5c9a868SElliott Hughes@cindex Moving files (mmove)
2138*d5c9a868SElliott Hughes@cindex Renaming files (mmove)
2139*d5c9a868SElliott Hughes
2140*d5c9a868SElliott HughesThe @code{mmove} command is used to move or rename an existing MS-DOS
2141*d5c9a868SElliott Hughesfile or subdirectory.
2142*d5c9a868SElliott Hughes@display
2143*d5c9a868SElliott Hughes@code{mmove} [@code{-v}] [@code{-D} @var{clash_option}] @var{sourcefile} @var{targetfile}
2144*d5c9a868SElliott Hughes@code{mmove} [@code{-v}]  [@code{-D} @var{clash_option}] @var{sourcefile} [ @var{sourcefiles}@dots{} ] @var{targetdirectory}
2145*d5c9a868SElliott Hughes@end display
2146*d5c9a868SElliott Hughes@code{Mmove} moves or renames an existing MS-DOS file or
2147*d5c9a868SElliott Hughessubdirectory. Unlike the MS-DOS version of @code{MOVE}, @code{mmove} is
2148*d5c9a868SElliott Hughesable to move subdirectories.  Files or directories can only be moved
2149*d5c9a868SElliott Hugheswithin one file system. Data cannot be moved from MS-DOS to Unix or
2150*d5c9a868SElliott Hughesvice-versa.  If you omit the drive letter from the target file or
2151*d5c9a868SElliott Hughesdirectory, the same letter as for the source is assumed.  If you omit
2152*d5c9a868SElliott Hughesthe drive letter from all parameters, drive a: is assumed by default.
2153*d5c9a868SElliott Hughes
2154*d5c9a868SElliott Hughes@node mpartition, mrd, mmove, Commands
2155*d5c9a868SElliott Hughes@section Mpartition
2156*d5c9a868SElliott Hughes@pindex mpartition
2157*d5c9a868SElliott Hughes@cindex partitions (creating)
2158*d5c9a868SElliott Hughes@cindex Zip disks (partitioning them)
2159*d5c9a868SElliott Hughes@cindex Jaz disks (partitioning them)
2160*d5c9a868SElliott Hughes
2161*d5c9a868SElliott HughesThe @code{mpartition} command is used to create MS-DOS file systems as
2162*d5c9a868SElliott Hughespartitions.  This is intended to be used on non-Linux systems,
2163*d5c9a868SElliott Hughesi.e. systems where fdisk and easy access to SCSI devices are not
2164*d5c9a868SElliott Hughesavailable.  This command only works on drives whose partition variable
2165*d5c9a868SElliott Hughesis set.
2166*d5c9a868SElliott Hughes
2167*d5c9a868SElliott Hughes@display
2168*d5c9a868SElliott Hughes@code{mpartition} @code{-p} @var{drive}
2169*d5c9a868SElliott Hughes@code{mpartition} @code{-r} @var{drive}
2170*d5c9a868SElliott Hughes@code{mpartition} @code{-I} [@code{-B} @var{bootSector}] @var{drive}
2171*d5c9a868SElliott Hughes@code{mpartition} @code{-a} @var{drive}
2172*d5c9a868SElliott Hughes@code{mpartition} @code{-d} @var{drive}
2173*d5c9a868SElliott Hughes@code{mpartition} @code{-c} [@code{-s} @var{sectors}] [@code{-h} @var{heads}]
2174*d5c9a868SElliott Hughes[@code{-t} @var{cylinders}] [@code{-v} [@code{-T} @var{type}] [@code{-b}
2175*d5c9a868SElliott Hughes@var{begin}] [@code{-l} length] [@code{-f}]
2176*d5c9a868SElliott Hughes
2177*d5c9a868SElliott Hughes@end display
2178*d5c9a868SElliott Hughes
2179*d5c9a868SElliott HughesMpartition supports the following operations:
2180*d5c9a868SElliott Hughes
2181*d5c9a868SElliott Hughes@table @code
2182*d5c9a868SElliott Hughes@item p
2183*d5c9a868SElliott HughesPrints a command line to recreate the partition for the drive.  Nothing
2184*d5c9a868SElliott Hughesis printed if the partition for the drive is not defined, or an
2185*d5c9a868SElliott Hughesinconsistency has been detected.  If verbose (@code{-v}) is also set,
2186*d5c9a868SElliott Hughesprints the current partition table.
2187*d5c9a868SElliott Hughes@item r
2188*d5c9a868SElliott HughesRemoves the partition described by @var{drive}.
2189*d5c9a868SElliott Hughes@item I
2190*d5c9a868SElliott HughesInitializes the partition table, and removes all partitions.
2191*d5c9a868SElliott Hughes@item c
2192*d5c9a868SElliott HughesCreates the partition described by @var{drive}.
2193*d5c9a868SElliott Hughes@item a
2194*d5c9a868SElliott Hughes"Activates" the partition, i.e. makes it bootable.  Only one partition
2195*d5c9a868SElliott Hughescan be bootable at a time.
2196*d5c9a868SElliott Hughes@item d
2197*d5c9a868SElliott Hughes"Deactivates" the partition, i.e. makes it unbootable.
2198*d5c9a868SElliott Hughes@end table
2199*d5c9a868SElliott Hughes
2200*d5c9a868SElliott HughesIf no operation is given, the current settings are printed.
2201*d5c9a868SElliott Hughes
2202*d5c9a868SElliott HughesFor partition creations, the following options are available:
2203*d5c9a868SElliott Hughes@table @code
2204*d5c9a868SElliott Hughes@item s @var{sectors}
2205*d5c9a868SElliott HughesThe number of sectors per track of the partition (which is also the
2206*d5c9a868SElliott Hughesnumber of sectors per track for the whole drive).
2207*d5c9a868SElliott Hughes@item h @var{heads}
2208*d5c9a868SElliott HughesThe number of heads of the partition (which is also the number of heads
2209*d5c9a868SElliott Hughesfor the whole drive).  By default, the geometry information (number of
2210*d5c9a868SElliott Hughessectors and heads) is figured out from neighboring partition table
2211*d5c9a868SElliott Hughesentries, or guessed from the size.
2212*d5c9a868SElliott Hughes@item t @var{cylinders}
2213*d5c9a868SElliott HughesThe number of cylinders of the partition (not the number of cylinders of
2214*d5c9a868SElliott Hughesthe whole drive.
2215*d5c9a868SElliott Hughes@item b @var{begin}
2216*d5c9a868SElliott HughesThe starting offset of the partition, expressed in sectors. If begin
2217*d5c9a868SElliott Hughesis not given, @code{mpartition} lets the partition begin at the start
2218*d5c9a868SElliott Hughesof the disk (partition number 1), or immediately after the end of the
2219*d5c9a868SElliott Hughesprevious partition.
2220*d5c9a868SElliott Hughes@item l @var{length}
2221*d5c9a868SElliott HughesThe size (length) of the partition, expressed in sectors.  If end is
2222*d5c9a868SElliott Hughesnot given, @code{mpartition} figures out the size from the number of
2223*d5c9a868SElliott Hughessectors, heads and cylinders.  If these are not given either, it gives
2224*d5c9a868SElliott Hughesthe partition the biggest possible size, considering disk size and
2225*d5c9a868SElliott Hughesstart of the next partition.
2226*d5c9a868SElliott Hughes@end table
2227*d5c9a868SElliott Hughes
2228*d5c9a868SElliott HughesThe following option is available for all operation which modify the
2229*d5c9a868SElliott Hughespartition table:
2230*d5c9a868SElliott Hughes@table @code
2231*d5c9a868SElliott Hughes@item f
2232*d5c9a868SElliott HughesUsually, before writing back any changes to the partition, mpartition
2233*d5c9a868SElliott Hughesperforms certain consistency checks, such as checking for overlaps and
2234*d5c9a868SElliott Hughesproper alignment of the partitions.  If any of these checks fails, the
2235*d5c9a868SElliott Hughespartition table is not changed.  The @code{-f} allows you to override
2236*d5c9a868SElliott Hughesthese safeguards.
2237*d5c9a868SElliott Hughes@end table
2238*d5c9a868SElliott Hughes
2239*d5c9a868SElliott HughesThe following options are available for all operations:
2240*d5c9a868SElliott Hughes@table @code
2241*d5c9a868SElliott Hughes@item v
2242*d5c9a868SElliott HughesTogether with @code{-p} prints the partition table as it is now (no
2243*d5c9a868SElliott Hugheschange operation), or as it is after it is modified.
2244*d5c9a868SElliott Hughes@item vv
2245*d5c9a868SElliott HughesIf the verbosity flag is given twice, @code{mpartition} will print out
2246*d5c9a868SElliott Hughesa hexdump of the partition table when reading it from and writing it
2247*d5c9a868SElliott Hughesto the device.
2248*d5c9a868SElliott Hughes@end table
2249*d5c9a868SElliott Hughes
2250*d5c9a868SElliott HughesThe following option is available for partition table initialization:
2251*d5c9a868SElliott Hughes@table @code
2252*d5c9a868SElliott Hughes@item B @var{bootSector}
2253*d5c9a868SElliott HughesReads the template master boot record from file @var{bootSector}.
2254*d5c9a868SElliott Hughes@end table
2255*d5c9a868SElliott Hughes
2256*d5c9a868SElliott Hughes@subsection Choice of partition type
2257*d5c9a868SElliott Hughes
2258*d5c9a868SElliott HughesMpartition proceeds as follows to pick a type for the partition:
2259*d5c9a868SElliott Hughes
2260*d5c9a868SElliott Hughes@itemize -
2261*d5c9a868SElliott Hughes@item
2262*d5c9a868SElliott HughesFAT32 partitions are assigned type 0x0C (``@code{Win95 FAT32, LBA}'')
2263*d5c9a868SElliott Hughes
2264*d5c9a868SElliott Hughes@item
2265*d5c9a868SElliott HughesFor all others, if the partition fits entirely within the first 65536
2266*d5c9a868SElliott Hughessectors of the disk, assign 0x01 (``@code{DOS FAT12, CHS}'') for FAT12
2267*d5c9a868SElliott Hughespartition and 0x04 (``@code{DOS FAT16, CHS}'') for FAT16 partitions
2268*d5c9a868SElliott Hughes
2269*d5c9a868SElliott Hughes@item
2270*d5c9a868SElliott HughesIf not covered by the above, assign 0x06 (``@code{DOS BIG FAT16 CHS}'') if partition fits entirely within the first 1024 cylinders (CHS mode)
2271*d5c9a868SElliott Hughes
2272*d5c9a868SElliott Hughes@item
2273*d5c9a868SElliott HughesAll remaining cases get 0x0E (``@code{Win95 BIG FAT16, LBA}'')
2274*d5c9a868SElliott Hughes
2275*d5c9a868SElliott Hughes@end itemize
2276*d5c9a868SElliott Hughes
2277*d5c9a868SElliott HughesIf number of fat bits is not known (not specified in drive's
2278*d5c9a868SElliott Hughesdefinition), then FAT12 is assumed for all drives with less than 4096
2279*d5c9a868SElliott Hughessectors, and FAT16 for those with more than 4096 sectors.
2280*d5c9a868SElliott Hughes
2281*d5c9a868SElliott HughesThis corresponds more or less to the definitions outlined at @code{https://en.wikipedia.org/wiki/Partition_type#List_of_partition_IDs}
2282*d5c9a868SElliott Hughesand
2283*d5c9a868SElliott Hughes@code{https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc977219(v=technet.10)},
2284*d5c9a868SElliott Hugheswith two notable differences:
2285*d5c9a868SElliott Hughes
2286*d5c9a868SElliott Hughes@itemize -
2287*d5c9a868SElliott Hughes@item
2288*d5c9a868SElliott HughesIf fat bits are unknown, the reference documents consider drives with
2289*d5c9a868SElliott Hughesless than 32680 sectors to be FAT12. Mtools uses 4096 sectors as the
2290*d5c9a868SElliott Hughescutoff point, as older versions of DOS only support FAT12 on disks
2291*d5c9a868SElliott Hugheswith less than 4096 sectors (and these older versions are the ones
2292*d5c9a868SElliott Hugheswhich would be most likely to use FAT12 in the first place).
2293*d5c9a868SElliott Hughes
2294*d5c9a868SElliott Hughes@item
2295*d5c9a868SElliott HughesThe reference documents use a 8GB (wikipedia) or a 4GB (Microsoft)
2296*d5c9a868SElliott Hughescutoff between 0x06 (@code{DOS BIG FAT16 CHS}) and 0x0E. Mtools uses
2297*d5c9a868SElliott Hughes1024 cylinders. This is because any partition beyond 1024 cylinders
2298*d5c9a868SElliott Hughesmust be LBA and cannot be CHS. 8GB works out to be the biggest
2299*d5c9a868SElliott Hughescapacity which can be represented as CHS (63 sectors, 255 heads and
2300*d5c9a868SElliott Hughes1024 cylinders). 4GB is the capacity limit for windows 2000, so it
2301*d5c9a868SElliott Hughesmakes sense that a documentation for windows 2000 would specify this
2302*d5c9a868SElliott Hughesas the upper limit for any partition type.
2303*d5c9a868SElliott Hughes
2304*d5c9a868SElliott Hughes@end itemize
2305*d5c9a868SElliott Hughes
2306*d5c9a868SElliott Hughes@node mrd, mren, mpartition, Commands
2307*d5c9a868SElliott Hughes@section Mrd
2308*d5c9a868SElliott Hughes@pindex mrd
2309*d5c9a868SElliott Hughes@cindex Removing a directory
2310*d5c9a868SElliott Hughes@cindex Erasing a directory
2311*d5c9a868SElliott Hughes@cindex Deleting a directory
2312*d5c9a868SElliott Hughes@cindex Directory removing
2313*d5c9a868SElliott Hughes@cindex Subdirectory removing
2314*d5c9a868SElliott Hughes
2315*d5c9a868SElliott HughesThe @code{mrd} command is used to remove an MS-DOS subdirectory. Its
2316*d5c9a868SElliott Hughessyntax is:
2317*d5c9a868SElliott Hughes
2318*d5c9a868SElliott Hughes@display
2319*d5c9a868SElliott Hughes@code{mrd} [@code{-v}] @var{msdosdirectory} [ @var{msdosdirectories}@dots{} ]
2320*d5c9a868SElliott Hughes@end display
2321*d5c9a868SElliott Hughes
2322*d5c9a868SElliott Hughes@code{Mrd} removes a directory from an MS-DOS file system. An error occurs
2323*d5c9a868SElliott Hughesif the directory does not exist or is not empty.
2324*d5c9a868SElliott Hughes
2325*d5c9a868SElliott Hughes@node mren, mshortname, mrd, Commands
2326*d5c9a868SElliott Hughes@section Mren
2327*d5c9a868SElliott Hughes@pindex mren
2328*d5c9a868SElliott Hughes@cindex Renaming files (mren)
2329*d5c9a868SElliott Hughes@cindex Moving files (mren)
2330*d5c9a868SElliott Hughes
2331*d5c9a868SElliott HughesThe @code{mren} command is used to rename or move an existing MS-DOS
2332*d5c9a868SElliott Hughesfile or subdirectory. Its syntax is:
2333*d5c9a868SElliott Hughes
2334*d5c9a868SElliott Hughes@display
2335*d5c9a868SElliott Hughes@code{mren} [@code{-voOsSrRA}] @var{sourcefile} @var{targetfile}
2336*d5c9a868SElliott Hughes@end display
2337*d5c9a868SElliott Hughes
2338*d5c9a868SElliott Hughes@code{Mren}
2339*d5c9a868SElliott Hughesrenames an existing file on an MS-DOS file system.
2340*d5c9a868SElliott Hughes
2341*d5c9a868SElliott HughesIn verbose mode, @code{Mren} displays the new filename if the name
2342*d5c9a868SElliott Hughessupplied is invalid.
2343*d5c9a868SElliott Hughes
2344*d5c9a868SElliott HughesIf the first syntax is used (only one source file), and if the target
2345*d5c9a868SElliott Hughesname doesn't contain any slashes or colons, the file (or subdirectory)
2346*d5c9a868SElliott Hughesis renamed in the same directory, instead of being moved to the current
2347*d5c9a868SElliott Hughes@code{mcd} directory as would be the case with @code{mmove}. Unlike the
2348*d5c9a868SElliott HughesMS-DOS version of @code{REN}, @code{mren} can be used to rename
2349*d5c9a868SElliott Hughesdirectories.
2350*d5c9a868SElliott Hughes
2351*d5c9a868SElliott Hughes@node mshortname, mshowfat, mren, Commands
2352*d5c9a868SElliott Hughes@section Mshortname
2353*d5c9a868SElliott Hughes@pindex mshortname
2354*d5c9a868SElliott Hughes
2355*d5c9a868SElliott HughesThe @code{mshortname} command is used to display the short name of a
2356*d5c9a868SElliott Hughesfile.  Syntax:
2357*d5c9a868SElliott Hughes
2358*d5c9a868SElliott Hughes@display
2359*d5c9a868SElliott Hughes@code{mshortname} @var{files}
2360*d5c9a868SElliott Hughes@end display
2361*d5c9a868SElliott Hughes
2362*d5c9a868SElliott HughesThe shortname is displayed as it is stored in raw format on disk,
2363*d5c9a868SElliott Hugheswithout any character set conversion.
2364*d5c9a868SElliott Hughes
2365*d5c9a868SElliott Hughes@node mshowfat, mtoolstest, mshortname, Commands
2366*d5c9a868SElliott Hughes@section Mshowfat
2367*d5c9a868SElliott Hughes@pindex mshowfat
2368*d5c9a868SElliott Hughes@cindex Clusters of a file
2369*d5c9a868SElliott Hughes@cindex Fat
2370*d5c9a868SElliott Hughes
2371*d5c9a868SElliott HughesThe @code{mshowfat} command is used to display the FAT entries for a
2372*d5c9a868SElliott Hughesfile.  Syntax:
2373*d5c9a868SElliott Hughes
2374*d5c9a868SElliott Hughes@display
2375*d5c9a868SElliott Hughes@code{mshowfat} [@code{-o} @var{offset}] @var{files}
2376*d5c9a868SElliott Hughes@end display
2377*d5c9a868SElliott Hughes
2378*d5c9a868SElliott HughesIf no offset is given, a list of all clusters occupied by the file is
2379*d5c9a868SElliott Hughesprinted. If an offset is given, only the number of the cluster
2380*d5c9a868SElliott Hughescontaining that offset is printed.
2381*d5c9a868SElliott Hughes
2382*d5c9a868SElliott Hughes@node mtoolstest, mtype, mshowfat, Commands
2383*d5c9a868SElliott Hughes@section Mtoolstest
2384*d5c9a868SElliott Hughes@pindex mtoolstest
2385*d5c9a868SElliott Hughes@cindex Testing configuration file for correctness
2386*d5c9a868SElliott Hughes@cindex Checking configuration file
2387*d5c9a868SElliott Hughes@cindex Verifying configuration file
2388*d5c9a868SElliott Hughes
2389*d5c9a868SElliott HughesThe @code{mtoolstest} command is used to tests the mtools configuration
2390*d5c9a868SElliott Hughesfiles. To invoke it, just type @code{mtoolstest} without any arguments.
2391*d5c9a868SElliott Hughes@code{Mtoolstest} reads the mtools configuration files, and prints the
2392*d5c9a868SElliott Hughescumulative configuration to @code{stdout}. The output can be used as a
2393*d5c9a868SElliott Hughesconfiguration file itself (although you might want to remove redundant
2394*d5c9a868SElliott Hughesclauses).  You may use this program to convert old-style configuration
2395*d5c9a868SElliott Hughesfiles into new style configuration files.
2396*d5c9a868SElliott Hughes
2397*d5c9a868SElliott Hughes@node mtype, mzip, mtoolstest, Commands
2398*d5c9a868SElliott Hughes@section Mtype
2399*d5c9a868SElliott Hughes
2400*d5c9a868SElliott HughesThe @code{mtype} command is used to display contents of an MS-DOS
2401*d5c9a868SElliott Hughesfile. Its syntax is:
2402*d5c9a868SElliott Hughes
2403*d5c9a868SElliott Hughes@display
2404*d5c9a868SElliott Hughes@code{mtype} [@code{-ts}] @var{msdosfile} [ @var{msdosfiles}@dots{} ]
2405*d5c9a868SElliott Hughes@end display
2406*d5c9a868SElliott Hughes
2407*d5c9a868SElliott Hughes@code{Mtype} displays the specified MS-DOS file on the screen.
2408*d5c9a868SElliott Hughes
2409*d5c9a868SElliott HughesIn addition to the standard options, @code{Mtype} allows the following
2410*d5c9a868SElliott Hughescommand line options:
2411*d5c9a868SElliott Hughes
2412*d5c9a868SElliott Hughes@table @code
2413*d5c9a868SElliott Hughes@item t
2414*d5c9a868SElliott HughesText file viewing.  @code{Mtype} translates incoming carriage
2415*d5c9a868SElliott Hughesreturn/line feeds to line feeds.
2416*d5c9a868SElliott Hughes@item s
2417*d5c9a868SElliott Hughes@code{Mtype} strips the high bit from the data.
2418*d5c9a868SElliott Hughes@end table
2419*d5c9a868SElliott Hughes
2420*d5c9a868SElliott HughesThe @code{mcd} command may be used to establish the device and the
2421*d5c9a868SElliott Hughescurrent working directory (relative to MS-DOS), otherwise the default is
2422*d5c9a868SElliott Hughes@code{A:/}.
2423*d5c9a868SElliott Hughes
2424*d5c9a868SElliott Hughes@code{Mtype} returns 0 on success, 1 on utter failure, or 2 on partial
2425*d5c9a868SElliott Hughesfailure.
2426*d5c9a868SElliott Hughes
2427*d5c9a868SElliott HughesUnlike the MS-DOS version of @code{TYPE}, @code{mtype} allows multiple
2428*d5c9a868SElliott Hughesarguments.
2429*d5c9a868SElliott Hughes
2430*d5c9a868SElliott Hughes
2431*d5c9a868SElliott Hughes@node mzip, , mtype, Commands
2432*d5c9a868SElliott Hughes@section Mzip
2433*d5c9a868SElliott Hughes@cindex Zip disk (utilities)
2434*d5c9a868SElliott Hughes@cindex Jaz disk (utilities)
2435*d5c9a868SElliott Hughes@cindex Ejecting a Zip/Jaz disk
2436*d5c9a868SElliott Hughes@cindex Write protecting a Zip/Jaz disk
2437*d5c9a868SElliott Hughes@pindex mzip
2438*d5c9a868SElliott Hughes@cindex ZipTools disk
2439*d5c9a868SElliott Hughes@cindex Tools disk (Zip and Jaz drives)
2440*d5c9a868SElliott Hughes@cindex APlaceForYourStuff
2441*d5c9a868SElliott Hughes@cindex password protected Zip disks
2442*d5c9a868SElliott Hughes
2443*d5c9a868SElliott HughesThe @code{mzip} command is used to issue ZIP disk specific commands on
2444*d5c9a868SElliott HughesLinux, Solaris or HP-UX. Its syntax is:
2445*d5c9a868SElliott Hughes
2446*d5c9a868SElliott Hughes@display
2447*d5c9a868SElliott Hughes@code{mzip} [@code{-epqrwx}]
2448*d5c9a868SElliott Hughes@end display
2449*d5c9a868SElliott Hughes
2450*d5c9a868SElliott Hughes@code{Mzip} allows the following
2451*d5c9a868SElliott Hughescommand line options:
2452*d5c9a868SElliott Hughes
2453*d5c9a868SElliott Hughes@table @code
2454*d5c9a868SElliott Hughes@item e
2455*d5c9a868SElliott HughesEjects the disk.
2456*d5c9a868SElliott Hughes@item f
2457*d5c9a868SElliott HughesForce eject even if the disk is mounted (must be given in addition to
2458*d5c9a868SElliott Hughes@code{-e}).
2459*d5c9a868SElliott Hughes@item r
2460*d5c9a868SElliott HughesWrite protect the disk.
2461*d5c9a868SElliott Hughes@item w
2462*d5c9a868SElliott HughesRemove write protection.
2463*d5c9a868SElliott Hughes@item p
2464*d5c9a868SElliott HughesPassword write protect.
2465*d5c9a868SElliott Hughes@item x
2466*d5c9a868SElliott HughesPassword protect
2467*d5c9a868SElliott Hughes@item u
2468*d5c9a868SElliott HughesTemporarily unprotect the disk until it is ejected.  The disk becomes
2469*d5c9a868SElliott Hugheswritable, and reverts back to its old state when ejected.
2470*d5c9a868SElliott Hughes@item q
2471*d5c9a868SElliott HughesQueries the status
2472*d5c9a868SElliott Hughes@end table
2473*d5c9a868SElliott Hughes
2474*d5c9a868SElliott HughesTo remove the password, set it to one of the password-less modes
2475*d5c9a868SElliott Hughes@code{-r} or @code{-w}: mzip will then ask you for the password, and
2476*d5c9a868SElliott Hughesunlock the disk.  If you have forgotten the password, you can get rid of
2477*d5c9a868SElliott Hughesit by low-level formatting the disk (using your SCSI adapter's BIOS
2478*d5c9a868SElliott Hughessetup).
2479*d5c9a868SElliott Hughes
2480*d5c9a868SElliott HughesThe ZipTools disk shipped with the drive is also password protected.  On
2481*d5c9a868SElliott HughesMS-DOS or on a Mac, this password is automatically removed once the
2482*d5c9a868SElliott HughesZipTools have been installed.  From various articles posted to Usenet, I
2483*d5c9a868SElliott Hugheslearned that the password for the tools disk is
2484*d5c9a868SElliott Hughes@code{APlaceForYourStuff}@footnote{To see the articles, search for
2485*d5c9a868SElliott Hughes@code{APlaceForYourStuff} using Google Groups}.  Mzip knows about this
2486*d5c9a868SElliott Hughespassword, and tries it first, before prompting you for a password.  Thus
2487*d5c9a868SElliott Hughes@code{mzip -w z:} unlocks the tools disk@footnote{I didn't know about
2488*d5c9a868SElliott Hughesthis yet when I bought my own Zip drive.  Thus I ended up reformatting
2489*d5c9a868SElliott Hughesmy tools disk, and hence I haven't had the opportunity to test the
2490*d5c9a868SElliott Hughespassword yet.  If anybody still has their tools disk with the original
2491*d5c9a868SElliott Hughespassword, could you try it out? Thanks in advance}.  The tools disk is
2492*d5c9a868SElliott Hughesformatted in a special way so as to be usable both in a PC and in a Mac.
2493*d5c9a868SElliott HughesOn a PC, the Mac file system appears as a hidden file named
2494*d5c9a868SElliott Hughes@file{partishn.mac}.  You may erase it to reclaim the 50 Megs of space
2495*d5c9a868SElliott Hughestaken up by the Mac file system.
2496*d5c9a868SElliott Hughes
2497*d5c9a868SElliott Hughes
2498*d5c9a868SElliott Hughes@subsection Bugs
2499*d5c9a868SElliott Hughes
2500*d5c9a868SElliott HughesThis command is a big kludge.  A proper implementation would take a
2501*d5c9a868SElliott Hughesrework of significant parts of mtools, but unfortunately I don't have
2502*d5c9a868SElliott Hughesthe time for this right now. The main downside of this implementation is
2503*d5c9a868SElliott Hughesthat it is inefficient on some architectures (several successive calls
2504*d5c9a868SElliott Hughesto mtools, which defeats mtools' caching).
2505*d5c9a868SElliott Hughes
2506*d5c9a868SElliott Hughes@node Compiling mtools, Porting mtools, Commands, Top
2507*d5c9a868SElliott Hughes@chapter Architecture specific compilation flags
2508*d5c9a868SElliott Hughes@cindex XDF disks (compile time configuration)
2509*d5c9a868SElliott Hughes@cindex Solaris (compile time configuration of vold)
2510*d5c9a868SElliott Hughes@cindex Vold (compile time configuration)
2511*d5c9a868SElliott Hughes@cindex Compile time configuration
2512*d5c9a868SElliott Hughes
2513*d5c9a868SElliott HughesTo compile mtools, first invoke @code{./configure} before
2514*d5c9a868SElliott Hughes@code{make}. In addition to the standard @code{autoconfigure} flags,
2515*d5c9a868SElliott Hughesthere are two architecture specific flags available.
2516*d5c9a868SElliott Hughes
2517*d5c9a868SElliott Hughes@table @code
2518*d5c9a868SElliott Hughes@item ./configure --enable-xdf
2519*d5c9a868SElliott Hughes@itemx ./configure --disable-xdf
2520*d5c9a868SElliott HughesEnables support for XDF disks. This is on by default. @xref{XDF},
2521*d5c9a868SElliott Hughesfor details.
2522*d5c9a868SElliott Hughes@item ./configure --enable-vold
2523*d5c9a868SElliott Hughes@itemx ./configure --disable-vold
2524*d5c9a868SElliott HughesEnables support for vold on Solaris. When used in conjunction with vold,
2525*d5c9a868SElliott Hughesmtools should use different device nodes than for direct access.
2526*d5c9a868SElliott Hughes
2527*d5c9a868SElliott Hughes@item ./configure --enable-new-vold
2528*d5c9a868SElliott Hughes@itemx ./configure --disable-new-vold
2529*d5c9a868SElliott HughesEnables new support for vold on Solaris. This is supposed to work more
2530*d5c9a868SElliott Hughessmoothly than the old support.
2531*d5c9a868SElliott Hughes
2532*d5c9a868SElliott Hughes@item ./configure --enable-floppyd
2533*d5c9a868SElliott Hughes@itemx ./configure --disable-floppyd
2534*d5c9a868SElliott HughesEnables support for floppyd.  By default, floppyd support is enabled as
2535*d5c9a868SElliott Hugheslong as the necessary X includes and libraries are available.
2536*d5c9a868SElliott Hughes@end table
2537*d5c9a868SElliott Hughes
2538*d5c9a868SElliott Hughes@node Porting mtools, Command Index, Compiling mtools, Top
2539*d5c9a868SElliott Hughes@chapter Porting mtools to architectures which are not supported yet
2540*d5c9a868SElliott Hughes@cindex Porting
2541*d5c9a868SElliott Hughes@cindex Compiled-in defaults
2542*d5c9a868SElliott Hughes
2543*d5c9a868SElliott Hughes This chapter is only interesting for those who want to port mtools to
2544*d5c9a868SElliott Hughesan architecture which is not yet supported. For most common systems,
2545*d5c9a868SElliott Hughesdefault drives are already defined. If you want to add default drives
2546*d5c9a868SElliott Hughesfor a still unsupported system, run configuration.guess, to see which
2547*d5c9a868SElliott Hughesidentification autoconf uses for that system. This identification is
2548*d5c9a868SElliott Hughesof the form cpu-vendor-os (for example sparc-sun-sunos). The cpu and
2549*d5c9a868SElliott Hughesthe OS parts are passed to the compiler as preprocessor flags.
2550*d5c9a868SElliott Hughes The OS part is passed to the compiler in three forms.
2551*d5c9a868SElliott Hughes@enumerate
2552*d5c9a868SElliott Hughes@item
2553*d5c9a868SElliott HughesThe complete OS name, with dots replaced by underscores.  SCO3.2v2 would
2554*d5c9a868SElliott Hughesyield sco3_2v2
2555*d5c9a868SElliott Hughes@item
2556*d5c9a868SElliott HughesThe base OS name. SCO3.2v2 would yield Sco
2557*d5c9a868SElliott Hughes@item
2558*d5c9a868SElliott HughesThe base OS name plus its major version. SCO3.2v2 would yield Sco3
2559*d5c9a868SElliott Hughes@end enumerate
2560*d5c9a868SElliott Hughes
2561*d5c9a868SElliott Hughes All three versions are passed, if they are different.
2562*d5c9a868SElliott Hughes
2563*d5c9a868SElliott Hughes To define the devices, use the entries for the systems that are already
2564*d5c9a868SElliott Hughespresent as templates. In general, they have the following form:
2565*d5c9a868SElliott Hughes
2566*d5c9a868SElliott Hughes@example
2567*d5c9a868SElliott Hughes#if (defined (my_cpu) && defined(my_os))
2568*d5c9a868SElliott Hughes#define predefined_devices
2569*d5c9a868SElliott Hughesstruct device devices[] = @{
2570*d5c9a868SElliott Hughes        @{ "/dev/first_drive", 'drive_letter', drive_description@},
2571*d5c9a868SElliott Hughes        @dots{}
2572*d5c9a868SElliott Hughes        @{ "/dev/last_drive", 'drive_letter', drive_description@}
2573*d5c9a868SElliott Hughes@}
2574*d5c9a868SElliott Hughes#define INIT_NOOP
2575*d5c9a868SElliott Hughes#endif
2576*d5c9a868SElliott Hughes@end example
2577*d5c9a868SElliott Hughes
2578*d5c9a868SElliott Hughes "/dev/first_drive" is the name of the device or image file
2579*d5c9a868SElliott Hughesrepresenting the drive. Drive_letter is a letter ranging from a to z
2580*d5c9a868SElliott Hughesgiving access to the drive. Drive_description describes the type of the
2581*d5c9a868SElliott Hughesdrive:
2582*d5c9a868SElliott Hughes@table @code
2583*d5c9a868SElliott Hughes@item ED312
2584*d5c9a868SElliott Hughesextra density (2.88M) 3 1/2 disk
2585*d5c9a868SElliott Hughes@item HD312
2586*d5c9a868SElliott Hugheshigh density 3 1/2 disk
2587*d5c9a868SElliott Hughes@item DD312
2588*d5c9a868SElliott Hughesdouble density 3 1/2 disk
2589*d5c9a868SElliott Hughes@item HD514
2590*d5c9a868SElliott Hugheshigh density 5 1/4 disk
2591*d5c9a868SElliott Hughes@item DD514
2592*d5c9a868SElliott Hughesdouble density 5 1/4 disk
2593*d5c9a868SElliott Hughes@item DDsmall
2594*d5c9a868SElliott Hughes8 sector double density 5 1/4 disk
2595*d5c9a868SElliott Hughes@item SS514
2596*d5c9a868SElliott Hughessingle sided double density 5 1/4 disk
2597*d5c9a868SElliott Hughes@item SSsmall
2598*d5c9a868SElliott Hughessingle sided 8 sector double density 5 1/4 disk
2599*d5c9a868SElliott Hughes@item GENFD
2600*d5c9a868SElliott Hughesgeneric floppy drive (12 bit FAT)
2601*d5c9a868SElliott Hughes@item GENHD
2602*d5c9a868SElliott Hughesgeneric hard disk (16 bit FAT)
2603*d5c9a868SElliott Hughes@item GEN
2604*d5c9a868SElliott Hughesgeneric device (all parameters match)
2605*d5c9a868SElliott Hughes@item ZIPJAZ(flags)
2606*d5c9a868SElliott Hughesgeneric ZIP drive using normal access. This uses partition 4.
2607*d5c9a868SElliott Hughes@code{Flags} are any special flags to be passed to open.
2608*d5c9a868SElliott Hughes@item RZIPJAZ(flags)
2609*d5c9a868SElliott Hughesgeneric ZIP drive using raw SCSI access. This uses partition 4.
2610*d5c9a868SElliott Hughes@code{Flags} are any special flags to be passed to open.
2611*d5c9a868SElliott Hughes@item REMOTE
2612*d5c9a868SElliott Hughesthe remote drive used for floppyd.  Unlike the other items, this macro
2613*d5c9a868SElliott Hughesalso includes the file name ($DISPLAY) and the drive letter (X)
2614*d5c9a868SElliott Hughes@end table
2615*d5c9a868SElliott Hughes
2616*d5c9a868SElliott Hughes Entries may be described in more detail:
2617*d5c9a868SElliott Hughes@example
2618*d5c9a868SElliott Hughes fat_bits,open_flags,cylinders,heads,sectors,DEF_ARG
2619*d5c9a868SElliott Hughes@end example
2620*d5c9a868SElliott Hughes or, if you need to describe an offset (file system doesn't start at
2621*d5c9a868SElliott Hughesbeginning of file system)
2622*d5c9a868SElliott Hughes@example
2623*d5c9a868SElliott Hughes fat_bits, open_flags, cylinders, heads, sectors, offset, DEF_ARG0
2624*d5c9a868SElliott Hughes@end example
2625*d5c9a868SElliott Hughes
2626*d5c9a868SElliott Hughes@table @code
2627*d5c9a868SElliott Hughes@item fat_bits
2628*d5c9a868SElliott Hughesis either 12, 16 or 0. 0 means that the device accepts both types of
2629*d5c9a868SElliott HughesFAT.
2630*d5c9a868SElliott Hughes@item open_flags
2631*d5c9a868SElliott Hughesmay include flags such as O_NDELAY, or O_RDONLY, which might be
2632*d5c9a868SElliott Hughesnecessary to open the device. 0 means no special flags are needed.
2633*d5c9a868SElliott Hughes@item cylinders,heads,sectors
2634*d5c9a868SElliott Hughesdescribe the geometry of the disk. If cylinders is 0, the heads and sectors
2635*d5c9a868SElliott Hughesparameters are ignored, and the drive accepts any geometry.
2636*d5c9a868SElliott Hughes@item offset
2637*d5c9a868SElliott Hughesis used if the DOS file system doesn't begin at the start of the device
2638*d5c9a868SElliott Hughesor image file. This is mostly useful for Atari Ram disks (which contain
2639*d5c9a868SElliott Hughestheir device driver at the beginning of the file) or for DOS emulator
2640*d5c9a868SElliott Hughesimages (which may represent a partitioned device.
2641*d5c9a868SElliott Hughes@end table
2642*d5c9a868SElliott Hughes
2643*d5c9a868SElliott Hughes Definition of defaults in the devices file should only be done if these
2644*d5c9a868SElliott Hughessame devices are found on a large number of hosts of this type. In that
2645*d5c9a868SElliott Hughescase, could you also let me know about your new definitions, so that I
2646*d5c9a868SElliott Hughescan include them into the next release.  For purely local file, I
2647*d5c9a868SElliott Hughesrecommend that you use the @code{@value{SYSCONFDIR}mtools.conf} and
2648*d5c9a868SElliott Hughes@code{~/.mtoolsrc} configuration files.
2649*d5c9a868SElliott Hughes
2650*d5c9a868SElliott Hughes However, the devices files also allows you to supply geometry setting
2651*d5c9a868SElliott Hughesroutines. These are necessary if you want to access high capacity
2652*d5c9a868SElliott Hughesdisks.
2653*d5c9a868SElliott Hughes
2654*d5c9a868SElliott Hughes Two routines should be supplied:
2655*d5c9a868SElliott Hughes
2656*d5c9a868SElliott Hughes@enumerate
2657*d5c9a868SElliott Hughes@item
2658*d5c9a868SElliott HughesReading the current parameters
2659*d5c9a868SElliott Hughes@example
2660*d5c9a868SElliott Hughesstatic inline int get_parameters(int fd, struct generic_floppy_struct *floppy)
2661*d5c9a868SElliott Hughes@end example
2662*d5c9a868SElliott Hughes
2663*d5c9a868SElliott Hughes This probes the current configured geometry, and return it in
2664*d5c9a868SElliott Hughesthe structure generic_floppy_struct (which must also be declared).
2665*d5c9a868SElliott Hughes Fd is an open file descriptor for the device, and buf is an already
2666*d5c9a868SElliott Hughesfilled in stat structure, which may be useful.
2667*d5c9a868SElliott Hughes This routine should return 1 if the probing fails, and 0 otherwise.
2668*d5c9a868SElliott Hughes
2669*d5c9a868SElliott Hughes@item
2670*d5c9a868SElliott HughesSetting new parameters
2671*d5c9a868SElliott Hughes@example
2672*d5c9a868SElliott Hughesstatic inline int set_parameters(int fd, struct generic_floppy_struct *floppy)
2673*d5c9a868SElliott Hughes                                 struct stat *buf)
2674*d5c9a868SElliott Hughes@end example
2675*d5c9a868SElliott Hughes This configures the geometry contained in floppy on the file descriptor
2676*d5c9a868SElliott Hughesfd. Buf is the result of a stat call (already filled in).  This should
2677*d5c9a868SElliott Hughesreturn 1 if the new geometry cannot be configured, and 0 otherwise.
2678*d5c9a868SElliott Hughes@end enumerate
2679*d5c9a868SElliott Hughes
2680*d5c9a868SElliott Hughes A certain number of preprocessor macros should also be supplied:
2681*d5c9a868SElliott Hughes
2682*d5c9a868SElliott Hughes@table @code
2683*d5c9a868SElliott Hughes@item TRACKS(floppy)
2684*d5c9a868SElliott Hughesrefers to the track field in the floppy structure
2685*d5c9a868SElliott Hughes@item HEADS(floppy)
2686*d5c9a868SElliott Hughesrefers to the heads field in the floppy structure
2687*d5c9a868SElliott Hughes@item SECTORS(floppy)
2688*d5c9a868SElliott Hughesrefers to the sectors per track field in the floppy structure
2689*d5c9a868SElliott Hughes@item SECTORS_PER_DISK(floppy)
2690*d5c9a868SElliott Hughesrefers to the sectors per disk field in the floppy structure (if
2691*d5c9a868SElliott Hughesapplicable, otherwise leave undefined)
2692*d5c9a868SElliott Hughes
2693*d5c9a868SElliott Hughes@item BLOCK_MAJOR
2694*d5c9a868SElliott Hughesmajor number of the floppy device, when viewed as a block device
2695*d5c9a868SElliott Hughes
2696*d5c9a868SElliott Hughes@item CHAR_MAJOR
2697*d5c9a868SElliott Hughesmajor number of the floppy device, when viewed as a character device
2698*d5c9a868SElliott Hughes(a.k.a. "raw" device, used for fsck) (leave this undefined, if your OS
2699*d5c9a868SElliott Hughesdoesn't have raw devices)
2700*d5c9a868SElliott Hughes@end table
2701*d5c9a868SElliott Hughes
2702*d5c9a868SElliott Hughes For the truly high capacity formats (XDF, 2m, etc), there is no clean
2703*d5c9a868SElliott Hughesand documented interface yet.
2704*d5c9a868SElliott Hughes
2705*d5c9a868SElliott Hughes@comment MANskip 1
2706*d5c9a868SElliott Hughes
2707*d5c9a868SElliott Hughes@node Command Index, Variable Index,  Porting mtools, Top
2708*d5c9a868SElliott Hughes@unnumbered Command Index
2709*d5c9a868SElliott Hughes@printindex pg
2710*d5c9a868SElliott Hughes
2711*d5c9a868SElliott Hughes@node Variable Index, Concept Index, Command Index, Top
2712*d5c9a868SElliott Hughes@unnumbered Variable index
2713*d5c9a868SElliott Hughes@printindex vr
2714*d5c9a868SElliott Hughes
2715*d5c9a868SElliott Hughes@node Concept Index, , Variable Index, Top
2716*d5c9a868SElliott Hughes@unnumbered Concept index
2717*d5c9a868SElliott Hughes@printindex cp
2718*d5c9a868SElliott Hughes
2719*d5c9a868SElliott Hughes@comment MANend-skip 1
2720*d5c9a868SElliott Hughes@comment MANend-skip 5
2721*d5c9a868SElliott Hughes@bye
2722