# In this section, perl variables will be expanded during extraction.
# You can use $Config{...} to use Configure variables.
+my $versiononly = $Config{versiononly} ? $Config{version} : '';
+
print OUT <<"!GROK!THIS!";
$Config{startperl}
eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
push \@pagers, \$pager if -x \$pager;
(my \$bindir = <<'/../') =~ s/\\s*\\z//;
-$Config{scriptdir}
+$Config{scriptdirexp}
+/../
+
+(my \$pod2man = <<'/../') =~ s/\\s*\\z//;
+pod2man$versiononly
/../
!GROK!THIS!
my $id = eval { getpwnam("nobody") };
$id = eval { getpwnam("nouser") } unless defined $id;
$id = -2 unless defined $id;
+ #
+ # According to Stevens' APUE and various
+ # (BSD, Solaris, HP-UX) man pages setting
+ # the real uid first and effective uid second
+ # is the way to go if one wants to drop privileges,
+ # because if one changes into an effective uid of
+ # non-zero, one cannot change the real uid any more.
+ #
+ # Actually, it gets even messier. There is
+ # a third uid, called the saved uid, and as
+ # long as that is zero, one can get back to
+ # uid of zero. Setting the real-effective *twice*
+ # helps in *most* systems (FreeBSD and Solaris)
+ # but apparently in HP-UX even this doesn't help:
+ # the saved uid stays zero (apparently the only way
+ # in HP-UX to change saved uid is to call setuid()
+ # when the effective uid is zero).
+ #
eval {
- $> = $id; # must do this one first!
- $< = $id;
+ $< = $id; # real uid
+ $> = $id; # effective uid
+ $< = $id; # real uid
+ $> = $id; # effective uid
};
last if !$@ && $< && $>;
}
for ($i=0; $i<@dirs; $i++) {
$dir = $dirs[$i];
($dir = VMS::Filespec::unixpath($dir)) =~ s!/\z!! if $Is_VMS;
- if ( ( $ret = check_file $dir,"$s.pod")
+ if ( (! $opt_m && ( $ret = check_file $dir,"$s.pod"))
or ( $ret = check_file $dir,"$s.pm")
or ( $ret = check_file $dir,$s)
or ( $Is_VMS and
print STDERR "Loosely found as @files\n" if $opt_v;
}
else {
- print STDERR "No documentation found for \"$_\".\n";
+ print STDERR "No " .
+ ($opt_m ? "module" : "documentation") . " found for \"$_\".\n";
if (@global_found) {
print STDERR "However, try\n";
for my $dir (@global_found) {
$found = 1;
push @pod, "=head1 Found in $ARGV\n\n" unless $found_in{$ARGV}++;
}
- elsif (/^=head2/) {
+ elsif (/^=head[12]/) {
$found = 0;
}
next unless $found;
Pod::Text->new()->parse_from_file($file, $tmpfd);
}
elsif (not $opt_u) {
- my $cmd = catfile($bindir, 'pod2man') . " --lax $file | $opt_n -man";
+ my $cmd = catfile($bindir, $pod2man) . " --lax $file | $opt_n -man";
$cmd .= " | col -x" if $^O =~ /hpux/;
my $rslt = `$cmd`;
$rslt = filter_nroff($rslt) if $filter;