furuta@brillig (Richard Furuta) (07/30/87)
Does anyone have any "improved" msdos disk manipulation commands for the pc 7300 under Unix? The existing commands are marginally useful---they don't allow you to delete files on the msdos disk, they won't overwrite files that you want to replace on the disk, they format the disk with eight sectors per track rather than nine (which causes the IBM RT's disk reading program to get confused), they don't directly support IBM PC text formats with CRLF instead of \n and ^Z at the end, etc. Thanks for any information. --Rick
egray@fthood.UUCP (08/01/87)
I bet I've got what you need. I've posted the source to "Mtools" on the
local news network called "unix-pc.sources". If there is enough interest,
I'll cross post the package to "comp.sys.att". Here is the Readme file of
the Mtools package:
MTOOLS v1.2
This is a collection of MSDOS tools to allow you to read and write to
MSDOS formatted diskettes from a Unix based system.
The following MSDOS commands are emulated:
Mtool MSDOS
name equivalent Description
----- ---- -----------
mdel DEL/ERASE delete a MSDOS file
mdir DIR display a MSDOS directory
mmd MD/MKDIR make a MSDOS sub directory
mrd RD/RMDIR remove a MSDOS sub directory
mread COPY read (copy) a MSDOS file to Unix
mren REN/RENAME rename an existing MSDOS file
mtype TYPE display contents of a MSDOS file
mwrite COPY write (copy) a Unix file to MSDOS
* CD change working directory
* by use of the environmental variable MCWD
The standard format of the floppy disk drive associated with the device
/dev/rfp020 is:
512 bytes / sector 512 x 8 x 40 x 2 = 320k
8 sectors / track
40 tracks / side
2 sides
However, the formats of 5.25 inch 40 track IBM PC disk drives are:
bytes per sectors per tracks number total disk introduced
sector track per side of sides capacity size in MSDOS
512 8 40 1 160k 5.25 1.0
512 9 40 1 180k 5.25 1.1
512 8 40 2 320k 5.25 2.0
512 9 40 2 360k 5.25 2.0
The application software has the ability to detect the type of media and
to switch to the proper format as appropriate.
The manuals are very terse... it's assumed that the reader is already
familiar with MSDOS.
The use of the environmental variable MCWD to keep track of the current
working directory is a little awkward, especially since there is no
'change directory' command. Bourne shell users will have to type two
commands to first set their working directory, ie:
MCWD=/TMP
export MCWD
Wildcards are only applied to filenames and not to directory names.
For example '/usr/local/*.c' is appropriate, but '/usr/l*/main.c' is not.
I really wanted to avoid the use of a 'text' mode and a 'data' mode
when transferring files, but I couldn't find a better way. It gets rather
confusing and it's quite possible to mess up a file if you apply the
text mode when it is not appropriate (ie: to a COM or EXE file). Likewise,
if you forget to apply the text mode (to a Unix text file) then if the
file is used under MSDOS, it will be missing carriage returns. However,
if you aren't going to use the files on your Unix system (you just
intend to hold the files and then transfer them back to MSDOS later) then
you shouldn't use the text mode during either mread or mwrite. This is
because, the text mode is only useful if the files are gonna be used
under Unix.
Mwrite adds an EOF marker to every file (not just text files). Mread
ignores all EOF markers.
The MSDOS 'copy' command had to be broken down into two separate Unix
commands since the MSDOS device designations (A: or C:) would be
clumsy to implement.
Mtools is also available in a 'generic' version and in a version written
especially for Masscomp computers.
Emmet P. Gray US Army, HQ III Corps & Fort Hood
...!ihnp4!uiucuxc!fthood!egray Attn: AFZF-DE-ENV
Directorate of Engineering & Housing
Environmental Management Office
Fort Hood, TX 76544-5057