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.

151 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. # podchecker -- command to invoke the podchecker function in Pod::Checker
  19. #
  20. # Copyright (c) 1998-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. podchecker - check the syntax of POD format documentation files
  29. =head1 SYNOPSIS
  30. B<podchecker> [B<-help>] [B<-man>] [B<-(no)warnings>] [I<file>S< >...]
  31. =head1 OPTIONS AND ARGUMENTS
  32. =over 8
  33. =item B<-help>
  34. Print a brief help message and exit.
  35. =item B<-man>
  36. Print the manual page and exit.
  37. =item B<-warnings> B<-nowarnings>
  38. Turn on/off printing of warnings. Repeating B<-warnings> increases the
  39. warning level, i.e. more warnings are printed. Currently increasing to
  40. level two causes flagging of unescaped "E<lt>,E<gt>" characters.
  41. =item I<file>
  42. The pathname of a POD file to syntax-check (defaults to standard input).
  43. =back
  44. =head1 DESCRIPTION
  45. B<podchecker> will read the given input files looking for POD
  46. syntax errors in the POD documentation and will print any errors
  47. it find to STDERR. At the end, it will print a status message
  48. indicating the number of errors found.
  49. Directories are ignored, an appropriate warning message is printed.
  50. B<podchecker> invokes the B<podchecker()> function exported by B<Pod::Checker>
  51. Please see L<Pod::Checker/podchecker()> for more details.
  52. =head1 RETURN VALUE
  53. B<podchecker> returns a 0 (zero) exit status if all specified
  54. POD files are ok.
  55. =head1 ERRORS
  56. B<podchecker> returns the exit status 1 if at least one of
  57. the given POD files has syntax errors.
  58. The status 2 indicates that at least one of the specified
  59. files does not contain I<any> POD commands.
  60. Status 1 overrides status 2. If you want unambigouus
  61. results, call B<podchecker> with one single argument only.
  62. =head1 SEE ALSO
  63. L<Pod::Parser> and L<Pod::Checker>
  64. =head1 AUTHORS
  65. Brad Appleton E<lt>[email protected]<gt>,
  66. Marek Rouchal E<lt>[email protected]<gt>
  67. Based on code for B<Pod::Text::pod2text(1)> written by
  68. Tom Christiansen E<lt>[email protected]<gt>
  69. =cut
  70. use Pod::Checker;
  71. use Pod::Usage;
  72. use Getopt::Long;
  73. ## Define options
  74. my %options;
  75. ## Parse options
  76. GetOptions(\%options, qw(help man warnings+ nowarnings)) || pod2usage(2);
  77. pod2usage(1) if ($options{help});
  78. pod2usage(-verbose => 2) if ($options{man});
  79. if($options{nowarnings}) {
  80. $options{warnings} = 0;
  81. }
  82. elsif(!defined $options{warnings}) {
  83. $options{warnings} = 1; # default is warnings on
  84. }
  85. ## Dont default to STDIN if connected to a terminal
  86. pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
  87. ## Invoke podchecker()
  88. my $status = 0;
  89. @ARGV = qw(-) unless(@ARGV);
  90. for (@ARGV) {
  91. if($_ eq '-') {
  92. $_ = "<&STDIN";
  93. }
  94. elsif(-d) {
  95. warn "podchecker: Warning: Ignoring directory '$_'\n";
  96. next;
  97. }
  98. my $s = podchecker($_, undef, '-warnings' => $options{warnings});
  99. if($s > 0) {
  100. # errors occurred
  101. $status = 1;
  102. }
  103. elsif($s < 0) {
  104. # no pod found
  105. $status = 2 unless($status);
  106. }
  107. }
  108. exit $status;
  109. __END__
  110. :endofperl