[libsoup] Skip termios stuff in tests/get if building on Windows



commit cb899dc01de595859d46f3de6026859f627d2758
Author: Dan Winship <danw gnome org>
Date:   Mon Sep 7 12:46:28 2009 -0400

    Skip termios stuff in tests/get if building on Windows
    
    Yeah, yeah, I should add a HAVE_TERMIOS_H test. Whatever.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=593845

 tests/get.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/tests/get.c b/tests/get.c
index 9bb00a5..a654ec4 100644
--- a/tests/get.c
+++ b/tests/get.c
@@ -14,7 +14,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
-#include <termios.h>
 #include <unistd.h>
 
 #ifdef HAVE_GNOME
@@ -23,6 +22,10 @@
 #include <libsoup/soup.h>
 #endif
 
+#ifdef G_OS_UNIX
+#include <termios.h>
+#endif
+
 static SoupSession *session;
 static GMainLoop *loop;
 static gboolean debug = FALSE;
@@ -80,13 +83,17 @@ authenticate (SoupSession *session, SoupMessage *msg,
 {
 	char *uri;
 	GSList *saved_users;
+#ifdef G_OS_UNIX
 	struct termios t;
 	int old_lflag;
+#endif
 	char user[80], pwbuf[80];
 	const char *password;
 
+#ifdef G_OS_UNIX
 	if (tcgetattr (STDIN_FILENO, &t) != 0)
 		return;
+#endif
 
 	uri = soup_uri_to_string (soup_message_get_uri (msg), FALSE);
 	fprintf (stderr, "Authentication required for %s:\n", uri);
@@ -120,9 +127,11 @@ authenticate (SoupSession *session, SoupMessage *msg,
 		fprintf (stderr, "  password: ");
 		fflush (stderr);
 
+#ifdef G_OS_UNIX
 		old_lflag = t.c_lflag;
 		t.c_lflag = (t.c_lflag | ICANON | ECHONL) & ~ECHO;
 		tcsetattr (STDIN_FILENO, TCSANOW, &t);
+#endif
 
 		/* For some reason, fgets can return EINTR on
 		 * Linux if ECHO is false...
@@ -131,8 +140,10 @@ authenticate (SoupSession *session, SoupMessage *msg,
 			password = fgets (pwbuf, sizeof (pwbuf), stdin);
 		while (password == NULL && errno == EINTR);
 
+#ifdef G_OS_UNIX
 		t.c_lflag = old_lflag;
 		tcsetattr (STDIN_FILENO, TCSANOW, &t);
+#endif
 
 		if (!password || pwbuf[0] == '\n')
 			return;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]