diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-16 00:05:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-16 00:05:12 +0000 |
commit | 70f7efeb5c9965a63a4143ad1c1f473585dc364c (patch) | |
tree | bf734c5c492ca5491ffaeb2192cdb9b32f42f726 /Build/source/mswin32/add-info-toc.pl | |
parent | f896f9e413c0dc0d4178846634963c84505e5029 (diff) |
mswin32/
git-svn-id: svn://tug.org/texlive/trunk@1482 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/mswin32/add-info-toc.pl')
-rw-r--r-- | Build/source/mswin32/add-info-toc.pl | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Build/source/mswin32/add-info-toc.pl b/Build/source/mswin32/add-info-toc.pl new file mode 100644 index 00000000000..4cd9899170b --- /dev/null +++ b/Build/source/mswin32/add-info-toc.pl @@ -0,0 +1,60 @@ +$dd = '/'; + +&main; + +exit 0; + +sub main { + local (@files); + @files = @ARGV; + $temp = &get_tmp_dir() . "ait.$$"; + open(OUT, ">$temp") || exit 1; + print OUT "Contents:\n\n"; + while (<>) { + $prevline = $line; + $line = $_; + if ($line =~ m/^\*+$/) { + print OUT "$prevline"; + } + elsif ($line =~ m/^=+$/) { + print OUT " $prevline"; + } + elsif ($line =~ m/^-+$/) { + print OUT " $prevline"; + } + elsif ($line =~ m/^\.+$/) { + print OUT " $prevline"; + } + } + print OUT "\n\n"; + @ARGV = @files; + while (<>) { + print OUT $_; + } + close (OUT); + open (IN, $temp); + open (OUT, ">$files[0]"); + binmode(IN); binmode(OUT); + local($/) = undef; + print OUT <IN>; + close(OUT); + close(IN); +} + +sub get_tmp_dir { + if (!($TMP)) { + local (@l) = ("TMPDIR", "TEMP", "TMP", "c${dd}tmp"); + local ($var, $dir); + foreach $var (@l) { + $dir = $ENV{$var}; + if (-d $dir) { + $TMP = $dir; + last; + } + } + } + $TMP =~ s/\\/$dd/g; + + if ($TMP =~ /$dd$/) { + } else { $TMP .= $dd } +} |