Index | Thread | Search

From:
YASUOKA Masahiko <yasuoka@openbsd.org>
Subject:
games/enigma prepare for stdio opaque
To:
tb@openbsd.org, ports@openbsd.org
Date:
Tue, 15 Jul 2025 17:27:29 +0900

Download raw body.

Thread
games/enigma also substitutes a FILE object for std{out,err}.  This
will be impossible after the stdio opaque diff.

The diff disables the block which substitutes a FILE object for
std{out,err}.  The block is not needed for OpenBSD, so the diff must
not break anything.

ok?

Index: games/enigma/patches/patch-src_main_cc
===================================================================
RCS file: games/enigma/patches/patch-src_main_cc
diff -N games/enigma/patches/patch-src_main_cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ games/enigma/patches/patch-src_main_cc	15 Jul 2025 08:18:05 -0000
@@ -0,0 +1,29 @@
+Index: src/main.cc
+--- src/main.cc.orig
++++ src/main.cc
+@@ -313,21 +313,25 @@ void Application::init(int argc, char **argv)
+     if (ap.redirect) {
+         FILE *newfp;
+         newfp = std::freopen((userStdPath + "/Output.log").c_str(), "w", stdout);
++#if 0	/* can't substitute a FILE object for stdout if FILE is an opaque. */
+         if ( newfp == NULL ) {  // This happens on NT
+             newfp = fopen((userStdPath + "/Output.log").c_str(), "w");
+             if (newfp) {  // in case stdout is a macro
+                 *stdout = *newfp;
+             }
+         }
++#endif
+         setvbuf(stdout, NULL, _IOLBF, BUFSIZ);   // Line buffered
+ 
+         newfp = std::freopen((userStdPath + "/Error.log").c_str(), "w", stderr);
++#if 0	/* can't substitute a FILE object for stdout if FILE is an opaque. */
+         if ( newfp == NULL ) {  // This happens on NT
+             newfp = fopen((userStdPath + "/Error.log").c_str(), "w");
+             if (newfp) {  // in case stderr is a macro
+                 *stderr = *newfp;
+             }
+         }
++#endif
+         setbuf(stderr, NULL);   // No buffering
+     }
+