[vlc-commits] control: cli: fix 'quit' does not quit on OS/2

KO Myung-Hun git at videolan.org
Fri Jan 29 14:54:38 UTC 2021


vlc | branch: master | KO Myung-Hun <komh78 at gmail.com> | Wed Jan 20 10:49:00 2021 +0100| [6a5e26b477f90589d2c57d4bb38928e52280c044] | committer: Steve Lhomme

control: cli: fix 'quit' does not quit on OS/2

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6a5e26b477f90589d2c57d4bb38928e52280c044
---

 modules/control/cli/cli.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/modules/control/cli/cli.c b/modules/control/cli/cli.c
index 2fa1e7b90d..b134e471bf 100644
--- a/modules/control/cli/cli.c
+++ b/modules/control/cli/cli.c
@@ -416,6 +416,27 @@ void msg_print(intf_thread_t *intf, const char *fmt, ...)
     va_end(ap);
 }
 
+#ifdef __OS2__
+static char *os2_fgets(char *buffer, int n, FILE *stream)
+{
+    if( stream == stdin )
+    {
+        /* stdin ? Then wait for a stroke before entering into fgets() for
+         * cancellation. */
+        KBDKEYINFO key;
+
+        while( KbdPeek( &key, 0 ) || !( key.fbStatus & 0x40 ))
+            vlc_tick_sleep( INTF_IDLE_SLEEP );
+    }
+
+    vlc_testcancel();
+
+    return fgets(buffer, n, stream);
+}
+
+#define fgets(buffer, n, stream) os2_fgets(buffer, n, stream)
+#endif
+
 static void *cli_client_thread(void *data)
 {
     struct cli_client *cl = data;



More information about the vlc-commits mailing list