summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLUtils.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm59
1 files changed, 23 insertions, 36 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index e4ac72ff563..b908b946c0b 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -29,7 +29,6 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure
TeXLive::TLUtils::getenv($string);
TeXLive::TLUtils::which($string);
- TeXLive::TLUtils::program_exists($program);
TeXLive::TLUtils::get_system_tmpdir;
=head2 File Utilities
@@ -82,7 +81,6 @@ BEGIN {
&unix
&getenv
&which
- &program_exists
&get_system_tmpdir
&dirname
&basename
@@ -311,42 +309,31 @@ environment variable, an extension might aleady be present.
=cut
sub which {
- my $prog=shift;
- my @PATH;
- my $PATH=getenv('PATH');
- if (&win32) {
- my @PATHEXT=split ';', getenv('PATHEXT');
- push @PATHEXT, ''; # if argument contains an extension
- @PATH=split ';', $PATH;
- for my $dir (@PATH) {
- for my $ext (@PATHEXT) {
- if (-f "$dir/$prog$ext") {
- return "$dir/$prog$ext";
- }
- }
- }
- } else {
- @PATH=split ':', $PATH;
- for my $dir (@PATH) {
- if (-x "$dir/$prog") {
- return "$dir/$prog";
- }
- }
- }
- return 0;
-}
-
-=pod
-
-=item C<program_exists($program)>
+ my ($prog) = @_;
+ my @PATH;
+ my $PATH = getenv('PATH');
-Return C<1> if C<$program> is in C<PATH> and C<0> otherwise.
-
-=cut
+ if (&win32) {
+ my @PATHEXT = split (';', getenv('PATHEXT'));
+ push (@PATHEXT, ''); # in case argument contains an extension
+ @PATH = split (';', $PATH);
+ for my $dir (@PATH) {
+ for my $ext (@PATHEXT) {
+ if (-f "$dir/$prog$ext") {
+ return "$dir/$prog$ext";
+ }
+ }
+ }
-sub program_exists {
- my $program=shift;
- return (&which ("$program"))? 0:1;
+ } else { # not windows
+ @PATH = split (':', $PATH);
+ for my $dir (@PATH) {
+ if (-x "$dir/$prog") {
+ return "$dir/$prog";
+ }
+ }
+ }
+ return 0;
}
=pod