tests: expand 'apps' tool
[platform/upstream/glib.git] / gio / tests / gtlsconsoleinteraction.c
index 717a83c..b3dcd69 100644 (file)
@@ -13,9 +13,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Stef Walter <stefw@collabora.co.uk>
  */
 #include "config.h"
 
 #include <glib.h>
+#include <glib/gprintf.h>
 #include <string.h>
 
 #ifdef G_OS_WIN32
-#include <glib/gprintf.h>
 #include <conio.h>
 #endif
 
 
 G_DEFINE_TYPE (GTlsConsoleInteraction, g_tls_console_interaction, G_TYPE_TLS_INTERACTION);
 
-#ifdef G_OS_WIN32
+#if defined(G_OS_WIN32) || defined(__BIONIC__)
 /* win32 doesn't have getpass() */
+#include <stdio.h>
+#ifndef BUFSIZ
+#define BUFSIZ 8192
+#endif
 static gchar *
 getpass (const gchar *prompt)
 {
@@ -53,7 +55,11 @@ getpass (const gchar *prompt)
 
   for (i = 0; i < BUFSIZ - 1; ++i)
     {
+#ifdef __BIONIC__
+      buf[i] = getc (stdin);
+#else
       buf[i] = _getch ();
+#endif
       if (buf[i] == '\r')
         break;
     }