-.\" Copyright (c) 1983 The Regents of the University of California.
+.\" Copyright (c) 1983, 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
-.\" Redistribution and use in source and binary forms are permitted
-.\" provided that the above copyright notice and this paragraph are
-.\" duplicated in all such forms and that any documentation,
-.\" advertising materials, and other materials related to such
-.\" distribution and use acknowledge that the software was developed
-.\" by the University of California, Berkeley. The name of the
-.\" University may not be used to endorse or promote products derived
-.\" from this software without specific prior written permission.
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+.\" %sccs.include.redist.man%
.\"
-.\" @(#)rmt.8 6.2 (Berkeley) %G%
+.\" @(#)rmt.8 6.5 (Berkeley) %G%
.\"
-.TH RMT 8 ""
-.UC 5
-.SH NAME
-rmt \- remote magtape protocol module
-.SH SYNOPSIS
-.B /etc/rmt
-.SH DESCRIPTION
-.I Rmt
+.Dd
+.Dt RMT 8
+.Os BSD 4.2
+.Sh NAME
+.Nm rmt
+.Nd remote magtape protocol module
+.Sh SYNOPSIS
+.Nm rmt
+.Sh DESCRIPTION
+.Nm Rmt
is a program used by the remote dump and restore programs
in manipulating a magnetic tape drive through an interprocess
communication connection.
-.I Rmt
+.Nm Rmt
is normally started up with an
-.IR rexec (3X)
+.Xr rexec 3
or
-.IR rcmd (3X)
+.Xr rcmd 3
call.
-.PP
+.Pp
The
-.I rmt
+.Nm rmt
program accepts requests specific to the manipulation of
magnetic tapes, performs the commands, then responds with
-a status indication. All responses are in ASCII and in
+a status indication. All responses are in
+.Tn ASCII
+and in
one of two forms.
-Successful commands have responses of
-.PP
-.ti +0.5i
-\fBA\fInumber\fR\en
-.PP
-where
-.I number
-is an ASCII representation of a decimal number.
-Unsuccessful commands are responded to with
-.PP
-.ti +0.5i
-\fBE\fIerror-number\fR\en\fIerror-message\fR\en,
-.PP
-where
-.I error-number
+Successful commands have responses of:
+.Bd -filled -offset indent
+.Sm off
+.Sy A Ar number No \en
+.Sm on
+.Ed
+.Pp
+.Ar Number
+is an
+.Tn ASCII
+representation of a decimal number.
+Unsuccessful commands are responded to with:
+.Bd -filled -offset indent
+.Sm off
+.Xo Sy E Ar error-number
+.No \en Ar error-message
+.No \en
+.Xc
+.Sm on
+.Ed
+.Pp
+.Ar Error-number
is one of the possible error
numbers described in
-.IR intro (2)
+.Xr intro 2
and
-.I error-message
+.Ar error-message
is the corresponding error string as printed
from a call to
-.IR perror (3).
+.Xr perror 3 .
The protocol is comprised of the
-following commands (a space is present between each token).
-.TP 15
-.B O device mode
+following commands, which are sent as indicated - no spaces are supplied
+between the command and its arguments, or between its arguments, and
+.Ql \en
+indicates that a newline should be supplied:
+.Bl -tag -width Ds
+.Sm off
+.It Xo Sy \&O Ar device
+.No \en Ar mode No \en
+.Xc
Open the specified
-.I device
+.Ar device
using the indicated
-.IR mode .
-.I Device
+.Ar mode .
+.Ar Device
is a full pathname and
-.I mode
-is an ASCII representation of a decimal
+.Ar mode
+is an
+.Tn ASCII
+representation of a decimal
number suitable for passing to
-.IR open (2).
+.Xr open 2 .
If a device had already been opened, it is
closed before a new open is performed.
-.TP 15
-.B C device
+.It Xo Sy C Ar device No \en
+.Xc
Close the currently open device. The
-.I device
+.Ar device
specified is ignored.
-.TP 15
-.B L whence offset
+.It Xo Sy L
+.Ar whence No \en
+.Ar offset No \en
+.Xc
+.Sm on
Perform an
-.IR lseek (2)
+.Xr lseek 2
operation using the specified parameters.
The response value is that returned from the
-.I lseek
+.Xr lseek
call.
-.TP 15
-.B W count
+.Sm off
+.It Sy W Ar count No \en
+.Sm on
Write data onto the open device.
-.I Rmt
+.Nm Rmt
reads
-.I count
+.Ar count
bytes from the connection, aborting if
a premature end-of-file is encountered.
The response value is that returned from
the
-.IR write (2)
+.Xr write 2
call.
-.TP 15
-.B R count
+.Sm off
+.It Sy R Ar count No \en
+.Sm on
Read
-.I count
+.Ar count
bytes of data from the open device.
If
-.I count
+.Ar count
exceeds the size of the data buffer (10 kilobytes), it is
truncated to the data buffer size.
-.I Rmt
+.Nm rmt
then performs the requested
-.IR read (2)
+.Xr read 2
and responds with
-\fBA\fIcount-read\fR\en if the read was
+.Sm off
+.Sy A Ar count-read No \en
+.Sm on
+if the read was
successful; otherwise an error in the
standard format is returned. If the read
was successful, the data read is then sent.
-.TP 15
-.B I operation count
-Perform a MTIOCOP
-.IR ioctl (2)
+.Sm off
+.It Xo Sy I Ar operation
+.No \en Ar count No \en
+.Xc
+.Sm on
+Perform a
+.Dv MTIOCOP
+.Xr ioctl 2
command using the specified parameters.
The parameters are interpreted as the
-ASCII representations of the decimal values
+.Tn ASCII
+representations of the decimal values
to place in the
-.I mt_op
+.Ar mt_op
and
-.I mt_count
+.Ar mt_count
fields of the structure used in the
-.I ioctl
+.Xr ioctl
call. The return value is the
-.I count
+.Ar count
parameter when the operation is successful.
-.TP 15
-.B S
+.It Sy S
Return the status of the open device, as
-obtained with a MTIOCGET
-.I ioctl
+obtained with a
+.Dv MTIOCGET
+.Xr ioctl
call. If the operation was successful,
an ``ack'' is sent with the size of the
status buffer, then the status buffer is
sent (in binary).
-.PP
+.El
+.Sm on
+.Pp
Any other command causes
-.I rmt
+.Nm rmt
to exit.
-.SH DIAGNOSTICS
+.Sh DIAGNOSTICS
All responses are of the form described above.
-.SH "SEE ALSO"
-rcmd(3), rexec(3), mtio(4), rdump(8), rrestore(8)
-.SH BUGS
+.Sh SEE ALSO
+.Xr rcmd 3 ,
+.Xr rexec 3 ,
+.Xr mtio 4 ,
+.Xr rdump 8 ,
+.Xr rrestore 8
+.Sh BUGS
People tempted to use this for a remote file access protocol
are discouraged.
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.2 .