File: os2.pin

package info (click to toggle)
latex2html 2015-debian1-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 7,652 kB
  • ctags: 3,386
  • sloc: perl: 30,941; makefile: 429; sh: 155
file content (75 lines) | stat: -rwxr-xr-x 1,769 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#- --*-Perl-*--
#-
#- This is a wrapper for the Perl scripts. Allows execution of
#- the same script on different platforms. Mainly used for
#- TeXlive.
#-
#- When running TeXlive, "perl" must be available in the PATH
#-
#if @TEXLIVE@
extproc perl -S -w
#else
extproc @PERL@ -S -w
#fi

# The above line starts up perl on OS2,
# below we find usual perl code

# print "I am $0\n";

package main;
require 5.00305;
use strict;
use vars qw($LATEX2HTMLDIR $SCRIPT $TEXLIVEROOT);

# Set LATEX2HTMLDIR

my $tool = $0;
$tool =~ s:^.*[\\/]::; # strip path
$tool =~ s:[.][^\\/.]*$::; # strip extension

BEGIN {
    unless($LATEX2HTMLDIR = $ENV{'LATEX2HTMLDIR'}) {
#if @texlive@
        my $root = try($0) || ( -s $0 ?
        do {
            use Cwd;
            my $path = join('\\',cwd(),$0);
            1 while($path =~ s|[/\\]\.?[/\\]|\\|g); # simplify
            try($path);
        } :
        do {
            my $path = '';
            foreach(split(/;/, $ENV{PATH} || '')) {
                $path = "$_\\$0";
                last if(-s $path);
                $path = '';
            }
            try($path);
        }) || die "Cannot determine TeXlive root path\n";

        $TEXLIVEROOT = $root;
        $LATEX2HTMLDIR = $ENV{'LATEX2HTMLDIR'} = "$root\\latex2html";
#else
        $LATEX2HTMLDIR = $ENV{'LATEX2HTMLDIR'} = '@LATEX2HTMLDIR@';
#fi
    }
    sub try {
        my ($path) = @_;
        $path =~ m:^(.*)[/\\]bin[/\\][^/\\]*[/\\]([^/\\]*)(\.bat|\.cmd|)$:i ?
            $1 : '';
    }
}

if(-d $LATEX2HTMLDIR) {
    push(@INC,$LATEX2HTMLDIR);
} else {
    die qq{Fatal: Directory "$LATEX2HTMLDIR" does not exist.\n};
}

# now start the main script!
$SCRIPT = "$LATEX2HTMLDIR\\$tool.pl";

require $SCRIPT
    || die "Fatal: Cannot load script $SCRIPT\n";