cdall 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env perl
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  10. #
  11. # This software is licensed as described in the file COPYING, which
  12. # you should have received as part of this distribution. The terms
  13. # are also available at https://curl.se/docs/copyright.html.
  14. #
  15. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  16. # copies of the Software, and permit persons to whom the Software is
  17. # furnished to do so, under the terms of the COPYING file.
  18. #
  19. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  20. # KIND, either express or implied.
  21. #
  22. # SPDX-License-Identifier: curl
  23. #
  24. ###########################################################################
  25. # provide all dir names to scan on the cmdline
  26. sub convert {
  27. my ($dir)=@_;
  28. opendir(my $dh, $dir) || die "could not open $dir";
  29. my @cd = grep { /\.md\z/ && -f "$dir/$_" } readdir($dh);
  30. closedir $dh;
  31. for my $cd (@cd) {
  32. my $nroff = "$cd";
  33. $nroff =~ s/\.md\z/.3/;
  34. print "$dir/$cd = $dir/$nroff\n";
  35. system("./scripts/cd2nroff -d $dir $dir/$cd");
  36. }
  37. }
  38. for my $d (sort @ARGV) {
  39. convert($d);
  40. }