ecore_ipc_client_example: win32 doesn't provide getline().
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Mon, 27 Mar 2017 15:45:30 +0000 (12:45 -0300)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Wed, 29 Mar 2017 15:44:19 +0000 (12:44 -0300)
src/examples/ecore/ecore_ipc_client_example.c

index c3f3708..8951264 100644 (file)
@@ -57,8 +57,20 @@ static Eina_Bool
 _on_stdin(void *data EINA_UNUSED, Ecore_Fd_Handler *fdh EINA_UNUSED)
 {
    char *line = NULL;
+#ifdef _WIN32
+   char lbuf[4096] = "";
+   ssize_t r;
+   if (fgets(lbuf, sizeof(lbuf), stdin) == NULL)
+     r = -1;
+   else
+     {
+        line = strdup(lbuf);
+        r = strlen(line);
+     }
+#else
    size_t len = 0;
    ssize_t r = getline(&line, &len, stdin);
+#endif
 
    if (r < 0)
      {