Fix various memory leaks in transport-helper.c
[git/raj.git] / Documentation / cat-texi.perl
blob828ec62554fe927eb16a03f835448e6db0c303a1
1 #!/usr/bin/perl -w
3 my @menu = ();
4 my $output = $ARGV[0];
6 open TMP, '>', "$output.tmp";
8 while (<STDIN>) {
9 next if (/^\\input texinfo/../\@node Top/);
10 next if (/^\@bye/ || /^\.ft/);
11 if (s/^\@top (.*)/\@node $1,,,Top/) {
12 push @menu, $1;
14 s/\(\@pxref{\[(URLS|REMOTES)\]}\)//;
15 print TMP;
17 close TMP;
19 printf '\input texinfo
20 @setfilename gitman.info
21 @documentencoding UTF-8
22 @dircategory Development
23 @direntry
24 * Git Man Pages: (gitman). Manual pages for Git revision control system
25 @end direntry
26 @node Top,,, (dir)
27 @top Git Manual Pages
28 @documentlanguage en
29 @menu
30 ', $menu[0];
32 for (@menu) {
33 print "* ${_}::\n";
35 print "\@end menu\n";
36 open TMP, '<', "$output.tmp";
37 while (<TMP>) {
38 print;
40 close TMP;
41 print "\@bye\n";
42 unlink "$output.tmp";