source: patches/tar-1.27.1-manpage-1.patch@ b2bbca4

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since b2bbca4 was a7c1552, checked in by William Harrington <kb0iic@…>, 11 years ago

Add tar-1.27.1-manpage-1.patch.

  • Property mode set to 100644
File size: 7.7 KB
RevLine 
[a7c1552]1Submitted By: William Harrington < kb0iic at cross-lfs dot org >
2Date: 2013-10-25
3Initial Package Version: 1.27
4Origin: Debian
5Upstream Status: Unknown
6Description: This makes a tar.1 manpage from src/tar.c
7Usage: perl tarman > /usr/share/man/man1/tar.1
8
9diff -Naur tar-1.27.orig/tarman tar-1.27/tarman
10--- tar-1.27.orig/tarman 1970-01-01 00:00:00.000000000 +0000
11+++ tar-1.27/tarman 2013-10-25 18:56:17.753173995 +0000
12@@ -0,0 +1,323 @@
13+#
14+# tarman - make tar man page from src/tar.c
15+# some text cribbed from debian tar man page
16+#
17+
18+use strict;
19+
20+my $t = "".localtime(time);
21+my $datestr = substr($t,4,3)." ".substr($t,8,2).", ".substr($t,20,4);
22+
23+@ARGV=qw(src/tar.c);
24+my $mode;
25+my @operations;
26+my $lastoperation;
27+my @options;
28+my @formats;
29+my @short;
30+my $examples;
31+my $saw_format;
32+my @env_vars;
33+while (<>) {
34+ my $nflag = 0;
35+ chomp;
36+# print "$mode: $_\n";
37+ if (/getenv.*"/) {
38+ next if defined($mode);
39+ my @c1 = split('"');
40+ if ($#c1 > 0) {
41+ push @env_vars, $c1[1];
42+ }
43+ }
44+ if (/Main operation mode:/) {
45+ $mode = 1;
46+ next;
47+ }
48+ if (/Operation modifiers:/) {
49+ $mode = 2;
50+ next;
51+ }
52+ if (/Examples:/) {
53+ $mode = 3;
54+ next;
55+ }
56+ if (/define GRID/) {
57+ $mode = 2;
58+ }
59+ if (/undef GRID/) {
60+ undef $lastoperation;
61+ undef $mode;
62+ next;
63+ }
64+ if ($mode == 1 || $mode == 2) {
65+ if (/{"/) { # }
66+ my @j = split(',');
67+ my @c1 = split('"', $j[0]);
68+ if (/OPTION_ALIAS/) {
69+ next unless defined($lastoperation);
70+ push @{$$lastoperation{'alias'} }, $c1[1];
71+ next;
72+ }
73+ my %newhash = ();
74+ $lastoperation = \%newhash;
75+ my $name = $c1[1];
76+ if ($name =~ /^ /) {
77+ $name =~ s/^ */format=/;
78+ push @formats, $lastoperation;
79+ } elsif ($mode == 1) {
80+ push @operations, $lastoperation;
81+ } else {
82+ push @options, $lastoperation;
83+ }
84+ $newhash{'name'} = $name;
85+ if ($mode == 2 && $name eq 'format') {
86+ $saw_format = $lastoperation;
87+ }
88+ my @c2 = split("'", $j[1]);
89+ if ($#c2 > 0) {
90+ $newhash{'short'} = $c2[1];
91+ push @short, $c2[1] if ($mode == 1);
92+ }
93+ if ($j[2] =~ /N_/) {
94+ $nflag = 1;
95+ }
96+ }
97+ if (/N_/) {
98+ next unless defined($lastoperation);
99+ my $nrest = $_;
100+ $nrest =~ s/.*N_//;
101+ my @c3 = split('"', $nrest);
102+ if ($#c3 > 0) {
103+ if ($nflag) {
104+ $$lastoperation{'operand'} .= $c3[1];
105+ } else {
106+ $$lastoperation{'description'} .= $c3[1];
107+ }
108+ }
109+ }
110+ }
111+ if ($mode == 3 ) {
112+ my $j = $_;
113+ $j =~ s/\\n.*//;
114+ my ($c1, $c2) = split('#', $j, 2);
115+ $c1 =~ s/ *$//;
116+ $c1 =~ s/^ *//;
117+$c1 =~ s/-/\\-/g;
118+ $c2 =~ s/^ *//;
119+$examples .= <<".";
120+$c2
121+.Bd -literal -offset indent -compact
122+$c1
123+.Ed
124+.
125+ # (
126+ if (/"\)/) {
127+ undef $mode;
128+ }
129+ }
130+}
131+
132+# for my $q ( @operations) {
133+# print "\nshort=".$$q{'short'}."\n";
134+# print "name=".$$q{'name'}."\n";
135+# print "desc=".$$q{'description'}."\n";
136+# if (defined($$q{'alias'})) {
137+# print "alias=".join(',',@{ $$q{'alias'}})."\n";
138+# }
139+# }
140+
141+sub long2nroff {
142+ my $f = shift;
143+ if ($f !~ /^-/) {
144+ $f = "Fl -$f";
145+ }
146+ $f =~ s/-/\\-/g;
147+ return $f;
148+}
149+
150+sub format_options
151+{
152+ my $h = shift;
153+ my $r;
154+ for my $q ( @$h ) {
155+ $r .= ".It";
156+ my @functions;
157+ push @functions, " Fl ".$$q{'short'} if defined($$q{'short'});
158+ push @functions, " ".long2nroff($$q{'name'});
159+ push @functions, join(' ', '', map {long2nroff $_} @{ $$q{'alias'} })
160+ if defined($$q{'alias'});
161+ $r .= join(' ,', @functions);
162+ if (defined($$q{'operand'})) {
163+ if ($#functions > 0) {
164+ $r .= " ";
165+ } else {
166+ $r .= " Ns \\= Ns ";
167+ }
168+ $r .= "Ar ".$$q{'operand'};
169+ }
170+ $r .= "\n".$$q{'description'}."\n";
171+ $r .= $$q{'extra'};
172+ }
173+ return $r;
174+}
175+
176+sub optionkeyword
177+{
178+ my $h = shift;
179+ my $k = $$h{'short'};
180+ $k = $$h{'name'} if !defined($k);
181+ my $l = $k;
182+ if ($l =~ s/^no-//) {
183+ $l .= "-no";
184+ }
185+ return ($l,$k);
186+}
187+
188+sub optioncmp
189+{
190+ my ($x1, $x2) = optionkeyword($a);
191+ my ($y1, $y2) = optionkeyword($b);
192+ my $r = lc($x1) cmp lc($y1);
193+ return $r if $r;
194+ $r = $y1 cmp $x1;
195+ return $r if $r;
196+ return $x2 cmp $y2;
197+}
198+
199+@operations = sort optioncmp @operations;
200+@operations = sort optioncmp @operations;
201+@options = sort optioncmp @options;
202+@formats = sort optioncmp @formats;
203+
204+if ($#formats >= 0 && !$saw_format) {
205+ print STDERR "FIXME: saw --format=X but no root --format!\n";
206+ exit(1);
207+}
208+
209+my $function_letters;
210+my $short_letters = join('', sort @short);
211+my $option_letters;
212+my $format_letters;
213+my $command_string = <<".";
214+.Nm tar
215+.
216+$command_string .= ".Oo Fl Oc";
217+my $env_variables;
218+my %env_description = (
219+'SIMPLE_BACKUP_SUFFIX' => <<".",
220+Backup prefix to use when extracting, if
221+.Fl \\-suffix
222+is not specified.
223+The backup suffix defaults to `~' if neither is specified.
224+.
225+'TAPE' => <<".",
226+Device or file to use for the archive if
227+.Fl \\-file
228+is not specified.
229+If this environment variable is unset, use stdin or stdout instead.
230+.
231+'TAR_OPTIONS' => <<".",
232+Options to prepend to those specified on the command line, separated by
233+whitespace. Embedded backslashes may be used to escape whitespace or
234+backslashes within an option.
235+.
236+);
237+my $sep = "";
238+for my $q ( @operations) {
239+ $command_string .= " Cm";
240+ $command_string .= $sep;
241+ $command_string .= " ".$$q{'short'} if defined($$q{'short'});
242+ $command_string .= " ".long2nroff($$q{'name'});
243+ if (defined($$q{'alias'})) {
244+ my $t = join(' ', '', map{long2nroff $_} @{ $$q{'alias'} });
245+ $t =~ s/ Fl / /g;
246+ $command_string .= $t;
247+ }
248+ $sep = " \\||\\|";
249+}
250+$function_letters = ".Bl -tag -width flag\n";
251+$function_letters .= format_options(\@operations);
252+$function_letters .= ".El";
253+if ($#formats >= 0) {
254+ $format_letters = ".Bl -tag -width flag\n";
255+ $format_letters .= format_options(\@formats);
256+ $format_letters .= ".El\n";
257+ $$saw_format{'extra'} = $format_letters;
258+}
259+### Ar Cm Ic Li Nm Op Pa Va
260+$option_letters = ".Bl -tag -width flag\n";
261+$option_letters .= format_options(\@options);
262+$option_letters .= ".El";
263+$env_variables .= ".Bl -tag -width Ds\n";
264+for my $q ( @env_vars) {
265+ $env_variables .= ".It Ev $q\n";
266+ $env_variables .= $env_description{$q};
267+}
268+$env_variables .= ".El";
269+
270+$examples =~ s/\n$//;
271+$function_letters =~ s/\n$//;
272+$option_letters =~ s/\n$//;
273+$env_variables =~ s/\n$//;
274+print <<".";
275+.\\" generated by script on $t
276+.Dd $datestr
277+.Dt TAR 1
278+.Sh NAME
279+.Nm tar
280+.Nd The GNU version of the tar archiving utility
281+.Sh SYNOPSIS
282+$command_string
283+.Op Ar options
284+.Op Ar pathname ...
285+.Sh DESCRIPTION
286+.Nm Tar
287+stores and extracts files from a tape or disk archive.
288+.Pp
289+The first argument to
290+tar
291+should be a function; either one of the letters
292+.Cm $short_letters ,
293+or one of the long function names.
294+A function letter need not be prefixed with ``\\-'', and may be combined
295+with other single-letter options.
296+A long function name must be prefixed with
297+.Cm \\\\-\\\\- .
298+Some options take a parameter; with the single-letter form
299+these must be given as separate arguments.
300+With the long form, they may be given by appending
301+.Cm = Ns Ar value
302+to the option.
303+.Sh FUNCTION LETTERS
304+Main operation mode:
305+$function_letters
306+.Sh OTHER OPTIONS
307+Operation modifiers:
308+$option_letters
309+.Sh ENVIRONMENT
310+The behavior of tar is controlled by the following environment variables,
311+among others:
312+$env_variables
313+.Sh EXAMPLES
314+$examples
315+.Sh SEE ALSO
316+.\\" libarchive
317+.Xr tar 5 ,
318+.\\" man-pages
319+.Xr symlink 7 ,
320+.Xr rmt 8
321+.Sh HISTORY
322+The
323+.Nm tar
324+command appeared in
325+.At v7 .
326+.Sh BUGS
327+The GNU folks, in general, abhor man pages, and create info documents instead.
328+Unfortunately, the info document describing tar is licensed under the GFDL with
329+invariant cover texts, which makes it impossible to include any text
330+from that document in this man page.
331+Most of the text in this document was automatically extracted from the usage
332+text in the source.
333+It may not completely describe all features of the program.
334+.
335+__END__
Note: See TracBrowser for help on using the repository browser.