mirror of
https://github.com/curl/curl.git
synced 2026-01-26 15:03:21 +00:00
- add 'use warnings' and 'use strict' where missing from Perl scripts. - fix 'Use of uninitialized value'. - fix missing declarations. - test1140.pl: fix 'Possible precedence issue with control flow operator'. - fix other misc issues. Most actual errors found during this PR were fixed and merged via separate PRs. Likely there are remaining warnings not found and fixed in this PR. Closes #17877
45 lines
784 B
Perl
Executable File
45 lines
784 B
Perl
Executable File
#!/usr/bin/env perl
|
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
|
#
|
|
# SPDX-License-Identifier: curl
|
|
#
|
|
# Given: a libcurl curldown man page
|
|
# Outputs: the same file, minus the header
|
|
#
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
my $f = $ARGV[0] || '';
|
|
|
|
open(F, "<$f") or die;
|
|
|
|
my @out;
|
|
my $line = 0;
|
|
my $hideheader = 0;
|
|
|
|
while(<F>) {
|
|
if($hideheader) {
|
|
if(/^---/) {
|
|
# end if hiding
|
|
$hideheader = 0;
|
|
}
|
|
push @out, "\n"; # replace with blank
|
|
next;
|
|
}
|
|
elsif(!$line++ && /^---/) {
|
|
# starts with a header, strip off the header
|
|
$hideheader = 1;
|
|
push @out, "\n"; # replace with blank
|
|
next;
|
|
}
|
|
push @out, $_;
|
|
}
|
|
close(F);
|
|
|
|
open(O, ">$f") or die;
|
|
for my $l (@out) {
|
|
print O $l;
|
|
}
|
|
close(O);
|