summaryrefslogtreecommitdiff
path: root/Master/tlpkg
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-11-01 17:15:20 +0000
committerKarl Berry <karl@freefriends.org>2008-11-01 17:15:20 +0000
commitf3d1051cb6e1efc35786eec5bc6d5324d6924a8d (patch)
tree9d7480fbd801d75101c831a894dbc58a933dd740 /Master/tlpkg
parent13a92aec8de0a2375d829b20d2a6f0119ed2e295 (diff)
tlmgr.pl: check for perldoc being present, instead of just for windows.
TLUtils.pm (program_exists): delete, it is not used anywhere that I can see and the documentation was wrong. (which): reformat. git-svn-id: svn://tug.org/texlive/trunk@11151 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-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