split-man
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #!/usr/bin/perl
  2. #
  3. #      split-man: create man pages from kernel-doc -man output
  4. #
  5. # Author: Tim Waugh <twaugh@redhat.com>
  6. # Modified by: Christoph Hellwig <hch@infradead.org>
  7. #
  8. use strict;
  9. die "$0: where do I put the results?n" unless ($#ARGV >= 0);
  10. die "$0: can't create $ARGV[0]: $!n" unless mkdir $ARGV[0], 0777;
  11. my $state = 0;
  12. while (<STDIN>) {
  13. s/&amp;(w+)/\fB1\fP/g; # fix smgl uglinesses
  14. if (/^.TH "[^"]*" 9 "([^"]*)"/) {
  15. close OUT unless ($state++ == 0);
  16. my $fn = "$ARGV[0]/$1.9";
  17. if (open OUT, ">$fn") {
  18. print STDERR "creating $fnn";
  19. } else {
  20. die "can't open $fn: $!n";
  21. }
  22. print OUT $_;
  23. } elsif ($state != 0) {
  24. print OUT $_;
  25. }
  26. }
  27. close OUT;