Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
3.8 KiB

  1. @rem = '--*-Perl-*--
  2. @echo off
  3. if "%OS%" == "Windows_NT" goto WinNT
  4. perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
  5. goto endofperl
  6. :WinNT
  7. perl -x -S %0 %*
  8. if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
  9. if %errorlevel% == 9009 echo You do not have Perl in your PATH.
  10. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
  11. goto endofperl
  12. @rem ';
  13. #!perl
  14. #line 15
  15. eval 'exec perl -S $0 "$@"'
  16. if 0;
  17. #############################################################################
  18. # pod2usage -- command to print usage messages from embedded pod docs
  19. #
  20. # Copyright (c) 1996-2000 by Bradford Appleton. All rights reserved.
  21. # This file is part of "PodParser". PodParser is free software;
  22. # you can redistribute it and/or modify it under the same terms
  23. # as Perl itself.
  24. #############################################################################
  25. use strict;
  26. use diagnostics;
  27. =head1 NAME
  28. pod2usage - print usage messages from embedded pod docs in files
  29. =head1 SYNOPSIS
  30. =over 12
  31. =item B<pod2usage>
  32. [B<-help>]
  33. [B<-man>]
  34. [B<-exit>S< >I<exitval>]
  35. [B<-output>S< >I<outfile>]
  36. [B<-verbose> I<level>]
  37. [B<-pathlist> I<dirlist>]
  38. I<file>
  39. =back
  40. =head1 OPTIONS AND ARGUMENTS
  41. =over 8
  42. =item B<-help>
  43. Print a brief help message and exit.
  44. =item B<-man>
  45. Print this command's manual page and exit.
  46. =item B<-exit> I<exitval>
  47. The exit status value to return.
  48. =item B<-output> I<outfile>
  49. The output file to print to. If the special names "-" or ">&1" or ">&STDOUT"
  50. are used then standard output is used. If ">&2" or ">&STDERR" is used then
  51. standard error is used.
  52. =item B<-verbose> I<level>
  53. The desired level of verbosity to use:
  54. 1 : print SYNOPSIS only
  55. 2 : print SYNOPSIS sections and any OPTIONS/ARGUMENTS sections
  56. 3 : print the entire manpage (similar to running pod2text)
  57. =item B<-pathlist> I<dirlist>
  58. Specifies one or more directories to search for the input file if it
  59. was not supplied with an absolute path. Each directory path in the given
  60. list should be separated by a ':' on Unix (';' on MSWin32 and DOS).
  61. =item I<file>
  62. The pathname of a file containing pod documentation to be output in
  63. usage mesage format (defaults to standard input).
  64. =back
  65. =head1 DESCRIPTION
  66. B<pod2usage> will read the given input file looking for pod
  67. documentation and will print the corresponding usage message.
  68. If no input file is specifed than standard input is read.
  69. B<pod2usage> invokes the B<pod2usage()> function in the B<Pod::Usage>
  70. module. Please see L<Pod::Usage/pod2usage()>.
  71. =head1 SEE ALSO
  72. L<Pod::Usage>, L<pod2text(1)>
  73. =head1 AUTHOR
  74. Brad Appleton E<lt>[email protected]<gt>
  75. Based on code for B<pod2text(1)> written by
  76. Tom Christiansen E<lt>[email protected]<gt>
  77. =cut
  78. use Pod::Usage;
  79. use Getopt::Long;
  80. ## Define options
  81. my %options = ();
  82. my @opt_specs = (
  83. "help",
  84. "man",
  85. "exit=i",
  86. "output=s",
  87. "pathlist=s",
  88. "verbose=i",
  89. );
  90. ## Parse options
  91. GetOptions(\%options, @opt_specs) || pod2usage(2);
  92. pod2usage(1) if ($options{help});
  93. pod2usage(VERBOSE => 2) if ($options{man});
  94. ## Dont default to STDIN if connected to a terminal
  95. pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
  96. @ARGV = ("-") unless (@ARGV > 0);
  97. if (@ARGV > 1) {
  98. print STDERR "pod2usage: Too many filenames given\n\n";
  99. pod2usage(2);
  100. }
  101. my %usage = ();
  102. $usage{-input} = shift(@ARGV);
  103. $usage{-exitval} = $options{"exit"} if (defined $options{"exit"});
  104. $usage{-output} = $options{"output"} if (defined $options{"output"});
  105. $usage{-verbose} = $options{"verbose"} if (defined $options{"verbose"});
  106. $usage{-pathlist} = $options{"pathlist"} if (defined $options{"pathlist"});
  107. pod2usage(\%usage);
  108. __END__
  109. :endofperl