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