DOS(C) UNIX System V
Name
dos: doscat, doscp, dosdir, dosformat, dosmkdir, dosls,
dosrm, dosrmdir - access to and manipulation of DOS files
and DOS filesystems
Syntax
doscat [ -r | -m ] file ...
doscp [ -r | -m ] file1 file2
doscp [ -r | -m ] file ... directory
dosdir directory ...
dosformat [ -fqv ] drive
dosls directory ...
dosmkdir directory ...
dosrm file ...
dosrmdir directory ...
Description
The dos commands provide access to the files and directories
on MS-DOS disks and on a DOS partition of a hard disk. Note
that in order to use these commands on a DOS partition of a
hard disk, the partition must be bootable, although not
active. It is also possible to mount and access a DOS
filesystem while operating from the UNIX partition.
The dos commands perform the following actions:
doscat Copies one or more DOS files to the standard
output. If -r is given, the files are copied
without newline conversions. If -m is given,
the files are copied with newline conversions
(see ``Conversions'' below).
doscp Copies files between a DOS disk and a UNIX
filesystem. If file1 and file2 are given, file1
is copied to file2. If a directory is given,
one or more files are copied to that directory.
If -r is given, the files are copied without
newline conversions. If -m is given, the files
are copied with newline conversions (see
``Conversions'' below).
dosdir Lists DOS files in the standard DOS style
directory format.
dosformat Creates a DOS 2.0 formatted diskette. The drive
may be specified in either DOS drive convention,
using the default file /etc/default/msdos, or
using the UNIX special file name. dosformat
cannot be used to format a hard disk. The -f
option suppresses the interactive feature. The
-q (quiet) option is used to suppress
information normally displayed during dosformat
. The -q option does not suppress the
interactive feature. The -v option prompts the
user for a volume label after the diskette has
been formatted. The maximum size of the volume
label is 11 characters.
dosls Lists DOS directories and files in a UNIX format
(see ls(C)).
dosrm Removes files from a DOS disk.
dosmkdir Creates a directory on a DOS disk.
dosrmdir Deletes directories from a DOS disk.
The file and directory arguments for DOS files and
directories have the form:
device:name
where device is a UNIX pathname for the special device file
containing the DOS disk, and name is a pathname to a file or
directory on the DOS disk. The two components are separated
by a colon (:). For example, the argument:
/dev/fd0:/src/file.asm
specifies the DOS file, file.asm, in the directory, /src, on
the disk in the device file /dev/fd0. Note that slashes
(and not backslashes) are used as filename separators for
DOS pathnames. Arguments without a device: are assumed to
be UNIX files.
For convenience, the user configurable default file,
/etc/default/msdos, can define DOS drive names to be used in
place of the special device file pathnames. It can contain
lines with the following format:
A=/dev/fd0
C=/dev/hd0d
D=/dev/hd1d
The drive letter ``A'' may be used in place of special
device file pathname /dev/fd0 when referencing DOS files
(see ``Examples'' below). The drive letter ``C'' or ``D''
refer to the DOS partition on the first or second hard
disk.
The commands operate on the following kinds of disks:
DOS partitions on a hard disk
5 1/4 inch DOS
3 1/2 inch DOS
8, 9, 15, or 18 sectors per track
40 tracks per side
1 or 2 sides
DOS versions 1.0, 2.0 or 3.0
Conversions
In the case of doscp, certain conversions are performed when
copying a UNIX file. Filenames with a basename longer than
eight characters are truncated. Filename extensions (the
part of the name following separating period) longer than
three characters are truncated. For example, the file
123456789.12345 becomes 12345678.123. A message informs the
user that the name has been changed and the altered name is
displayed. Filenames containing illegal DOS characters are
stripped when writing to the MS-DOS format. A message
informs the user that characters have been removed and
displays the name as written.
All DOS text files use a carriage-return/linefeed
combination, CR-LF , to indicate a newline. UNIX files use
a single newline LF character. When the doscat and doscp
commands transfer DOS text files to the UNIX filesystem,
they automatically strip the CR. When text files are
transferred to DOS , the commands insert a CR before each LF
character.
Under some circumstances the automatic newline conversions
do not occur. The -m option may be used to ensure the
newline conversion. The -r option can be used to override
the automatic conversion and force the command to perform a
true byte copy regardless of file type.
Examples
doscat /dev/fd0:/docs/memo.txt
doscat /tmp/f1 /tmp/f2 /dev/fd0:/src/file.asm
dosdir /dev/fd0:/src
dosdir A:/src A:/dev
doscp /tmp/myfile.txt /dev/fd0:/docs/memo.txt
doscp /tmp/f1 /tmp/f2 /dev/fd0:/mydir
dosformat /dev/fd0
dosls /dev/fd0:/src
dosls B:
dosmkdir /dev/fd0:/usr/docs
dosrm /dev/fd0:/docs/memo.txt
dosrm A:/docs/memo1.txt
dosrmdir /dev/fd0:/usr/docs
Accessing DOS Filesystems From the UNIX Partition
The ability to mount DOS filesystems is an extension of the
DOS utilities documented here.
There are several limitations with the DOS directory
structure which makes this a difficult task. These
limitations are due to insufficient information when
compared to the UNIX filesystem.
The DOS directory structure contains the following
information:
⊕ Filename: up to 8 characters with 3 character extension
(foo.bat)
⊕ File Attribute: read-only/read-write, hidden/visible
file, system/normal file, Volume name/normal file name,
subdirectory/normal file, archive/modified bit
⊕ Time of last modification
⊕ Date of last modification
⊕ Starting point (reference through FAT)
⊕ File size in bytes
Using this information, it is converted to an actual UNIX
inode. There are some UNIX provisions which cannot be
carried over, because the filesystem must remain sane under
DOS.
⊕ Any date in the UNIX inode table for the DOS filesystem
is the same as the modification date (ctime = atime =
mtime).
⊕ The only types of nodes allowed in the DOS filesystem
are directories and normal files. Pipes, semaphores,
and special device files do not exist because they do
not have a counterpart under DOS.
⊕ The permissions are 0777 for readable/writable files
and 0555 for read only files. If a user can access the
filesystem, the user will be limited by the permissions
available under the DOS directory structure. This
permission is read-only or read write. When creating a
file, the creator's umask/mode is examined. The
creation mode is based on the owner write bit.
⊕ The gid/uid for all files on the DOS filesystem is the
same as the mountpoint. The mount point will maintain
the necessary security. If a user can get into the
mountpoint, then the user has the same access as the
owner.
⊕ There is only one link for each file under the DOS
filesystem. ``.'' and ``..'' are a special case and
are not links.
⊕ On every change of the modification time (which on a
UNIX system would change atime, ctime, mtime) the DOS
archive bit is set.
⊕ Following DOS filesystem requirements, all blocks
previous to a written block are allocated before the
original block is written. This differs from UNIX
systems where the program may seek out beyond the end
of a file and write a block. UNIX systems do not
necessarily write blocks which have been skipped over.
⊕ If a program does not use the directory(S) system
calls, but opens the directory in the DOS filesystem as
a file, the program should see the DOS directory
structure as it really exists. By using the
directory(S) system calls, the filesystem switch code
will put together a UNIX style directory entry.
⊕ File contents are not mapped from the DOS filesystem.
The file appears exactly as it is under DOS. For
example, \r\n combinations are left as \r\n and not
mapped to just \n. The file and directory names are
mapped to uppercase.
DOS File Conversion
The utilities xtod(C) and dtox(C) can be used to convert the
EOL sequences used to and from DOS, respectively.
Files
/etc/default/msdos Default information
/dev/fd* Floppy disk devices
/dev/hd* Hard disk devices
See Also
assign(C), dtype(C), mkfs(ADM), dtox(C), xtod(C), and
``Using DOS and OS/2'' in the System Administrator's Guide
Notes
Using the DOS utilities, is not possible to refer to DOS
directories with wild card specifications. The programs
mentioned above cooperate among themselves so no two
programs will access the same DOS disk. Only one process
will access a given DOS disk at any time, while other
processes wait. If a process has to wait too long, it
displays the error message, ``can't seize a device,'' and
exits with an exit code of 1.
You cannot use the dosformat command to format device A:
because it is aliased to /dev/install, which cannot be
formatted. Use /dev/rfd0/ instead.
The following hard disk devices:
/dev/hd0d
/dev/rhd0d
/dev/hd1d
/dev/rhd1d
are similar to /dev/hd0a in that the disk driver determines
which partition is the DOS partition and uses that as hd?d.
This means that software using the DOS partition does not
need to know which partition is DOS.
The Development System supports the creation of DOS
executable files, using cc (CP). Refer to the C User's
Guide and C Library Guide for more information on using your
UNIX system to create programs suitable for DOS systems.
All of the DOS utilities leave temporary files in /tmp.
These files are automatically removed when the system is
rebooted. They can also be manually removed.
You must have DOS 3.3 or earlier. Extended DOS partitions
are not supported.
Value Added
doscat, doscp, dosdir, dosformat, dosls, dosmkdir, dosrm and
dosrmdir are extensions of AT&T System V provided by the
Santa Cruz Operation.
(printed 8/28/89) DOS(C)