+++ /dev/null
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" @(#)rmt.8 8.2 (Berkeley) 12/11/93
-.\"
-.Dd December 11, 1993
-.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 tar, cpio, mt, and the remote dump and restore
-programs in manipulating a magnetic tape drive through an interprocess
-communication connection.
-.Nm Rmt
-is normally started up with an
-.Xr rexec 3
-or
-.Xr rcmd 3
-call or the
-.Xr rsh 1
-command.
-.Pp
-The
-.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
-.Tn ASCII
-and in
-one of two forms.
-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
-.Xr intro 2
-and
-.Ar error-message
-is the corresponding error string as printed
-from a call to
-.Xr perror 3 .
-The protocol is comprised of the
-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
-.Ar device
-using the indicated
-.Ar mode .
-.Ar Device
-is a full pathname and
-.Ar mode
-is an
-.Tn ASCII
-representation of a decimal
-number suitable for passing to
-.Xr open 2 .
-If a device had already been opened, it is
-closed before a new open is performed.
-.It Xo Sy C Ar device No \en
-.Xc
-Close the currently open device. The
-.Ar device
-specified is ignored.
-.It Xo Sy L
-.Ar offset No \en
-.Ar whence No \en
-.Xc
-.Sm on
-Perform an
-.Xr lseek 2
-operation using the specified parameters.
-The response value is that returned from the
-.Xr lseek
-call.
-.Sm off
-.It Sy W Ar count No \en
-.Sm on
-Write data onto the open device.
-.Nm Rmt
-reads
-.Ar count
-bytes from the connection, aborting if
-a premature end-of-file is encountered.
-The response value is that returned from
-the
-.Xr write 2
-call.
-.Sm off
-.It Sy R Ar count No \en
-.Sm on
-Read
-.Ar count
-bytes of data from the open device.
-If
-.Ar count
-exceeds the size of the data buffer (10 kilobytes), it is
-truncated to the data buffer size.
-.Nm rmt
-then performs the requested
-.Xr read 2
-and responds with
-.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.
-.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
-.Tn ASCII
-representations of the decimal values
-to place in the
-.Ar mt_op
-and
-.Ar mt_count
-fields of the structure used in the
-.Xr ioctl
-call. The return value is the
-.Ar count
-parameter when the operation is successful.
-.It Sy S
-Return the status of the open device, as
-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).
-.El
-.Sm on
-.Pp
-Any other command causes
-.Nm rmt
-to exit.
-.Sh DIAGNOSTICS
-All responses are of the form described above.
-.Sh SEE ALSO
-.Xr tar 1 ,
-.Xr cpio 1 ,
-.Xr mt 1 ,
-.Xr rsh 1 ,
-.Xr rcmd 3 ,
-.Xr rexec 3 ,
-.Xr mtio 4 ,
-.Xr rdump 8 ,
-.Xr rrestore 8
-.Sh BUGS
-People should be discouraged from using this for a remote
-file access protocol.
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.2 .
+++ /dev/null
-#
-# tarman - make tar man page from src/tar.c
-# some text cribbed from debian tar man page
-#
-
-use strict;
-use POSIX qw(strftime);
-
-my $t = $ENV{'BUILD_DATE'} // strftime("%a, %d %b %Y %H:%M:%S %z", localtime(time));
-my $datestr = substr($t,8,3)." ".substr($t,5,2).", ".substr($t,12,4);
-
-@ARGV=qw(src/tar.c);
-my $mode;
-my @operations;
-my $lastoperation;
-my @options;
-my @formats;
-my @short;
-my $examples;
-my $saw_format;
-my @env_vars;
-while (<>) {
- my $nflag = 0;
- chomp;
-# print "$mode: $_\n";
- if (/getenv.*"/) {
- next if defined($mode);
- my @c1 = split('"');
- if ($#c1 > 0) {
- push @env_vars, $c1[1];
- }
- }
- if (/Main operation mode:/) {
- $mode = 1;
- next;
- }
- if (/Operation modifiers:/) {
- $mode = 2;
- next;
- }
- if (/Examples:/) {
- $mode = 3;
- next;
- }
- if (/define GRID/) {
- $mode = 2;
- }
- if (/undef GRID/) {
- undef $lastoperation;
- undef $mode;
- next;
- }
- if ($mode == 1 || $mode == 2) {
- if (/{"/) { # }
- my @j = split(',');
- my @c1 = split('"', $j[0]);
- if (/OPTION_ALIAS/) {
- next unless defined($lastoperation);
- push @{$$lastoperation{'alias'} }, $c1[1];
- next;
- }
- my %newhash = ();
- $lastoperation = \%newhash;
- my $name = $c1[1];
- if ($name =~ /^ /) {
- $name =~ s/^ */format=/;
- push @formats, $lastoperation;
- } elsif ($mode == 1) {
- push @operations, $lastoperation;
- } else {
- push @options, $lastoperation;
- }
- $newhash{'name'} = $name;
- if ($mode == 2 && $name eq 'format') {
- $saw_format = $lastoperation;
- }
- my @c2 = split("'", $j[1]);
- if ($#c2 > 0) {
- $newhash{'short'} = $c2[1];
- push @short, $c2[1] if ($mode == 1);
- }
- if ($j[2] =~ /N_/) {
- $nflag = 1;
- }
- }
- if (/N_/) {
- next unless defined($lastoperation);
- my $nrest = $_;
- $nrest =~ s/.*N_//;
- my @c3 = split('"', $nrest);
- if ($#c3 > 0) {
- if ($nflag) {
- $$lastoperation{'operand'} .= $c3[1];
- } else {
- $$lastoperation{'description'} .= $c3[1];
- }
- }
- if (!$nflag && !/\}/) {
- while (<>) {
- my @extended_desc = split('"', $_);
- $$lastoperation{'description'} .= $extended_desc[1];
- if (/\}/) {
- last;
- }
- }
- }
- }
- }
- if ($mode == 3 ) {
- my $j = $_;
- $j =~ s/\\n.*//;
- my ($c1, $c2) = split('#', $j, 2);
- $c1 =~ s/ *$//;
- $c1 =~ s/^ *//;
-$c1 =~ s/-/\\-/g;
- $c2 =~ s/^ *//;
-$examples .= <<".";
-$c2
-.Bd -literal -offset indent -compact
-$c1
-.Ed
-.
- # (
- if (/"\)/) {
- undef $mode;
- }
- }
-}
-
-# for my $q ( @operations) {
-# print "\nshort=".$$q{'short'}."\n";
-# print "name=".$$q{'name'}."\n";
-# print "desc=".$$q{'description'}."\n";
-# if (defined($$q{'alias'})) {
-# print "alias=".join(',',@{ $$q{'alias'}})."\n";
-# }
-# }
-
-sub long2nroff {
- my $f = shift;
- if ($f !~ /^-/) {
- $f = "Fl -$f";
- }
- $f =~ s/-/\\-/g;
- return $f;
-}
-
-sub format_options
-{
- my $h = shift;
- my $r;
- for my $q ( @$h ) {
- $r .= ".It";
- my @functions;
- push @functions, " Fl ".$$q{'short'} if defined($$q{'short'});
- push @functions, " ".long2nroff($$q{'name'});
- push @functions, join(' ', '', map {long2nroff $_} @{ $$q{'alias'} })
- if defined($$q{'alias'});
- $r .= join(' ,', @functions);
- if (defined($$q{'operand'})) {
- if ($#functions > 0) {
- $r .= " ";
- } else {
- $r .= " Ns \\= Ns ";
- }
- $r .= "Ar ".$$q{'operand'};
- }
- $r .= "\n".$$q{'description'}."\n";
- $r .= $$q{'extra'};
- }
- return $r;
-}
-
-sub optionkeyword
-{
- my $h = shift;
- my $k = $$h{'short'};
- $k = $$h{'name'} if !defined($k);
- my $l = $k;
- if ($l =~ s/^no-//) {
- $l .= "-no";
- }
- return ($l,$k);
-}
-
-sub optioncmp
-{
- my ($x1, $x2) = optionkeyword($a);
- my ($y1, $y2) = optionkeyword($b);
- my $r = lc($x1) cmp lc($y1);
- return $r if $r;
- $r = $y1 cmp $x1;
- return $r if $r;
- return $x2 cmp $y2;
-}
-
-@operations = sort optioncmp @operations;
-@operations = sort optioncmp @operations;
-@options = sort optioncmp @options;
-@formats = sort optioncmp @formats;
-
-if ($#formats >= 0 && !$saw_format) {
- print STDERR "FIXME: saw --format=X but no root --format!\n";
- exit(1);
-}
-
-my $function_letters;
-my $short_letters = join('', sort @short);
-my $option_letters;
-my $format_letters;
-my $command_string = <<".";
-.Nm tar
-.
-$command_string .= ".Oo Fl Oc";
-my $env_variables;
-my %env_description = (
-'SIMPLE_BACKUP_SUFFIX' => <<".",
-Backup prefix to use when extracting, if
-.Fl \\-suffix
-is not specified.
-The backup suffix defaults to `~' if neither is specified.
-.
-'TAPE' => <<".",
-Device or file to use for the archive if
-.Fl \\-file
-is not specified.
-If this environment variable is unset, use stdin or stdout instead.
-.
-'TAR_OPTIONS' => <<".",
-Options to prepend to those specified on the command line, separated by
-whitespace. Embedded backslashes may be used to escape whitespace or
-backslashes within an option.
-.
-);
-my $sep = "";
-for my $q ( @operations) {
- $command_string .= " Cm";
- $command_string .= $sep;
- $command_string .= " ".$$q{'short'} if defined($$q{'short'});
- $command_string .= " ".long2nroff($$q{'name'});
- if (defined($$q{'alias'})) {
- my $t = join(' ', '', map{long2nroff $_} @{ $$q{'alias'} });
- $t =~ s/ Fl / /g;
- $command_string .= $t;
- }
- $sep = " \\||\\|";
-}
-$function_letters = ".Bl -tag -width flag\n";
-$function_letters .= format_options(\@operations);
-$function_letters .= ".El";
-if ($#formats >= 0) {
- $format_letters = ".Bl -tag -width flag\n";
- $format_letters .= format_options(\@formats);
- $format_letters .= ".El\n";
- $$saw_format{'extra'} = $format_letters;
-}
-### Ar Cm Ic Li Nm Op Pa Va
-$option_letters = ".Bl -tag -width flag\n";
-$option_letters .= format_options(\@options);
-$option_letters .= ".El";
-$env_variables .= ".Bl -tag -width Ds\n";
-for my $q ( @env_vars) {
- $env_variables .= ".It Ev $q\n";
- $env_variables .= $env_description{$q};
-}
-$env_variables .= ".El";
-
-$examples =~ s/\n$//;
-$function_letters =~ s/\n$//;
-$option_letters =~ s/\n$//;
-$env_variables =~ s/\n$//;
-print <<".";
-.\\" generated by script on $t
-.Dd $datestr
-.Dt TAR 1
-.Sh NAME
-.Nm tar
-.Nd The GNU version of the tar archiving utility
-.Sh SYNOPSIS
-$command_string
-.Op Ar options
-.Op Ar pathname ...
-.Sh DESCRIPTION
-.Nm Tar
-stores and extracts files from a tape or disk archive.
-.Pp
-The first argument to
-tar
-should be a function; either one of the letters
-.Cm $short_letters ,
-or one of the long function names.
-A function letter need not be prefixed with ``\\-'', and may be combined
-with other single-letter options.
-A long function name must be prefixed with
-.Cm \\\\-\\\\- .
-Some options take a parameter; with the single-letter form
-these must be given as separate arguments.
-With the long form, they may be given by appending
-.Cm = Ns Ar value
-to the option.
-.Sh FUNCTION LETTERS
-Main operation mode:
-$function_letters
-.Sh OTHER OPTIONS
-Operation modifiers:
-$option_letters
-.Sh ENVIRONMENT
-The behavior of tar is controlled by the following environment variables,
-among others:
-$env_variables
-.Sh EXAMPLES
-$examples
-.Sh SEE ALSO
-.\\" libarchive
-.Xr tar 5 ,
-.\\" man-pages
-.Xr symlink 7 ,
-.Xr rmt 8
-.Sh HISTORY
-The
-.Nm tar
-command appeared in
-.At v7 .
-.Sh BUGS
-The GNU folks, in general, abhor man pages, and create info documents instead.
-Unfortunately, the info document describing tar is licensed under the GFDL with
-invariant cover texts, which makes it impossible to include any text
-from that document in this man page.
-Most of the text in this document was automatically extracted from the usage
-text in the source.
-It may not completely describe all features of the program.
-.
-__END__