SDL: fnsince.pl: Don't print out the version numbers if updating the wiki.

From 179a04f85a723e79c1b63af92a756c49c7cf6926 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 26 Oct 2021 21:01:05 -0400
Subject: [PATCH] fnsince.pl: Don't print out the version numbers if updating
 the wiki.

---
 build-scripts/fnsince.pl | 95 ++++++++++++++++++++--------------------
 1 file changed, 48 insertions(+), 47 deletions(-)

diff --git a/build-scripts/fnsince.pl b/build-scripts/fnsince.pl
index 02574628ae..5c5632f9ad 100755
--- a/build-scripts/fnsince.pl
+++ b/build-scripts/fnsince.pl
@@ -101,63 +101,64 @@
 $funcs{'SDL_WinRTGetFSPathUTF8'} = '2.0.3';
 $funcs{'SDL_WinRTRunApp'} = '2.0.3';
 
-foreach my $release (@releases) {
-    foreach my $fn (sort keys %funcs) {
-        print("$fn: $funcs{$fn}\n") if $funcs{$fn} eq $release;
+if (not defined $wikipath) {
+    foreach my $release (@releases) {
+        foreach my $fn (sort keys %funcs) {
+            print("$fn: $funcs{$fn}\n") if $funcs{$fn} eq $release;
+        }
     }
-}
+} else {
+    if (defined $wikipath) {
+        chdir($wikipath);
+        foreach my $fn (keys %funcs) {
+            my $revision = $funcs{$fn};
+            $revision = 'git HEAD (in development, not in an official release yet)' if $revision eq 'HEAD';
+            my $fname = "$fn.mediawiki";
+            if ( ! -f $fname ) {
+                #print STDERR "No such file: $fname\n";
+                next;
+            }
 
-if (defined $wikipath) {
-    chdir($wikipath);
-    foreach my $fn (keys %funcs) {
-        my $revision = $funcs{$fn};
-        $revision = 'git HEAD (in development, not in an official release yet)' if $revision eq 'HEAD';
-        my $fname = "$fn.mediawiki";
-        if ( ! -f $fname ) {
-            #print STDERR "No such file: $fname\n";
-            next;
-        }
+            my @lines = ();
+            open(FH, '<', $fname) or die("Can't open $fname for read: $!\n");
+            my $added = 0;
+            while (<FH>) {
+                chomp;
+                if ((/\A\-\-\-\-/) && (!$added)) {
+                    push @lines, "== Version ==";
+                    push @lines, "";
+                    push @lines, "This function is available since SDL $revision.";
+                    push @lines, "";
+                    $added = 1;
+                }
+                push @lines, $_;
+                next if not /\A\=\=\s+Version\s+\=\=/;
+                $added = 1;
+                push @lines, "";
+                push @lines, "This function is available since SDL $revision.";
+                push @lines, "";
+                while (<FH>) {
+                    chomp;
+                    next if not (/\A\=\=\s+/ || /\A\-\-\-\-/);
+                    push @lines, $_;
+                    last;
+                }
+            }
+            close(FH);
 
-        my @lines = ();
-        open(FH, '<', $fname) or die("Can't open $fname for read: $!\n");
-        my $added = 0;
-        while (<FH>) {
-            chomp;
-            if ((/\A\-\-\-\-/) && (!$added)) {
+            if (!$added) {
                 push @lines, "== Version ==";
                 push @lines, "";
                 push @lines, "This function is available since SDL $revision.";
                 push @lines, "";
-                $added = 1;
-            }
-            push @lines, $_;
-            next if not /\A\=\=\s+Version\s+\=\=/;
-            $added = 1;
-            push @lines, "";
-            push @lines, "This function is available since SDL $revision.";
-            push @lines, "";
-            while (<FH>) {
-                chomp;
-                next if not (/\A\=\=\s+/ || /\A\-\-\-\-/);
-                push @lines, $_;
-                last;
             }
-        }
-        close(FH);
-
-        if (!$added) {
-            push @lines, "== Version ==";
-            push @lines, "";
-            push @lines, "This function is available since SDL $revision.";
-            push @lines, "";
-        }
 
-        open(FH, '>', $fname) or die("Can't open $fname for write: $!\n");
-        foreach (@lines) {
-            print FH "$_\n";
+            open(FH, '>', $fname) or die("Can't open $fname for write: $!\n");
+            foreach (@lines) {
+                print FH "$_\n";
+            }
+            close(FH);
         }
-        close(FH);
     }
 }
 
-