From: Daniel Stenberg Date: Sun, 14 Jan 2024 13:50:52 +0000 (+0100) Subject: cmdline-opts/gen.pl: error on initital blank line X-Git-Tag: curl-8_6_0~86 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aaab6cb0c4a6795dac5d8a0d89c4be4fda11a926;p=thirdparty%2Fcurl.git cmdline-opts/gen.pl: error on initital blank line After the "---" separator, there should be no blank line and this script now errors out if one is detected. Ref: #12696 Closes #12698 --- diff --git a/docs/cmdline-opts/gen.pl b/docs/cmdline-opts/gen.pl index b31a42b580..2766ca265b 100755 --- a/docs/cmdline-opts/gen.pl +++ b/docs/cmdline-opts/gen.pl @@ -219,6 +219,7 @@ sub single { my @examples; # there can be more than one my $magic; # cmdline special option my $line; + my $dline; my $multi; my $scope; my $experimental; @@ -322,6 +323,11 @@ sub single { my $tablemode = 0; while() { $line++; + $dline++; + if(($dline == 1) && ($_ =~ /^[\r\n]*\z/)) { + print STDERR "$f:$line:1:ERROR: unnecessary leading blank line\n"; + return 3; + } if(/^## (.*)/) { if(!$tablemode) { push @desc, ".RS\n"; @@ -341,6 +347,7 @@ sub single { elsif(/^\.(IP|RS|RE)/) { my ($cmd) = ($1); print STDERR "$f:$line:1:ERROR: $cmd detected, use ##-style\n"; + return 3; } push @desc, $_; }