home *** CD-ROM | disk | FTP | other *** search
/ ftp.cse.unsw.edu.au / 2014.06.ftp.cse.unsw.edu.au.tar / ftp.cse.unsw.edu.au / pub / doc / languages / perl / nutshell / ch6 / wrapinst < prev    next >
Encoding:
Text File  |  1992-10-18  |  1.7 KB  |  66 lines

  1. #!/usr/bin/perl
  2. 'di';
  3. 'ig00';
  4. #
  5. # $Header$
  6. #
  7. # $Log$
  8.  
  9. # Usage: wrapinst [files]
  10.  
  11. -d ($manl = '/usr/man/manl')                # (man "ell")
  12.     || -d ($manl = '/usr/local/man/man1')   # (man "one")
  13.     || -d ($manl = '/usr/man/man1')         # (man "one")
  14.     || die "Can't find man directory.\n";
  15.  
  16. chop($pwd = `pwd`);
  17. foreach $file (@ARGV) {
  18.     $longfile = ($file =~ m#^/#) ? $file : "$pwd/$file";
  19.     open(FILE,$longfile)
  20.     || (warn("Can't open $file: $!\n"), next);
  21.     <FILE>;
  22.     $_ = <FILE>;
  23.     close FILE;
  24.     if ($_ ne "'di';\n") {
  25.     warn "$file not its own manpage\n";
  26.     next;
  27.     }
  28.     symlink($longfile, "$manl/$file.l") ||
  29.     warn "$file: can't make symlink: $!\n";
  30. }
  31. ###############################################################
  32.  
  33.     # These next few lines are legal in both Perl and nroff.
  34.  
  35. .00;                   # finish .ig
  36.  
  37. 'di           \" finish diversion--previous line must be blank
  38. .nr nl 0-1    \" fake up transition to first page again
  39. .nr % 0         \" start at page 1
  40. '; __END__ ##### From here on it's a standard manual page #####
  41.  
  42. .TH WRAPINST 1 "December 25, 1990"
  43. .AT 3
  44. .SH NAME
  45. wrapinst \- installs manual pages produced by running wrapman
  46. .SH SYNOPSIS
  47. .B wrapinst [files]
  48. .SH DESCRIPTION
  49. .I Wrapman
  50. attempts to make a symbolic link in /usr/man/manl or some
  51. equivalent directory for each specified file that happens
  52. to have been processed by the wrapman program (which turns
  53. a Perl script into its own manual page).
  54. .SH ENVIRONMENT
  55. No environment variables are used.
  56. .SH FILES
  57. None.
  58. .SH AUTHOR
  59. Larry Wall
  60. .SH "SEE ALSO"
  61. wrapman(l)
  62. .SH DIAGNOSTICS
  63. Complains if it can't make the symbolic links.
  64. .SH BUGS
  65. It would be nice if we didn't have to run this at all.
  66.