#/usr/bin/perl
'di';
'ig00';
#
# $Header$
#
# $Log$

# Usage: wrapinst [files]

-d ($manl = '/usr/man/manl')                # (man "ell")
   || -d ($manl = '/usr/local/man/man1')   # (man "one")
   || -d ($manl = '/usr/man/man1')         # (man "one")
   || die "Can't find man directory.\n";

chop($pwd = `pwd`);
foreach $file (@ARGV) {
   $longfile = ($file =~ m#^/#) ? $file : "$pwd/$file";
   open(FILE,$longfile)
       || (warn("Can't open $file: $!\n"), next);
   <FILE>;
   $_ = <FILE>;
   close FILE;
   if ($_ ne "'di';\n") {
       warn "$file not its own manpage\n";
       next;
   }
   symlink($longfile, "$manl/$file.l") ||
       warn "$file: can't make symlink: $!\n";
}
###############################################################

   # These next few lines are legal in both Perl and nroff.

00;                   # finish .ig

'di           \" finish diversion--previous line must be blank
nr nl 0-1    \" fake up transition to first page again
nr % 0         \" start at page 1
'; __END__ ##### From here on it's a standard manual page #####

TH WRAPINST 1 "December 25, 1990"
AT 3
SH NAME
wrapinst \- installs manual pages produced by running wrapman
SH SYNOPSIS
B wrapinst [files]
SH DESCRIPTION
I Wrapman
attempts to make a symbolic link in /usr/man/manl or some
equivalent directory for each specified file that happens
to have been processed by the wrapman program (which turns
a Perl script into its own manual page).
SH ENVIRONMENT
No environment variables are used.
SH FILES
None.
SH AUTHOR
Larry Wall
SH "SEE ALSO"
wrapman(l)
SH DIAGNOSTICS
Complains if it can't make the symbolic links.
SH BUGS
It would be nice if we didn't have to run this at all.