diff options
author | William Jon McCann <mccann@jhu.edu> | 2007-08-21 16:25:36 +0000 |
---|---|---|
committer | William Jon McCann <mccann@src.gnome.org> | 2007-08-21 16:25:36 +0000 |
commit | 14ef3e630caad37b8c7308ac201c99245b300187 (patch) | |
tree | 86b5026ac57004da79615d621d586dbac9afdeeb | |
parent | d826466c4231993bc40e430e3828e3cc0e3424e5 (diff) | |
download | gdm-14ef3e630caad37b8c7308ac201c99245b300187.tar.gz |
Convert termio to termios stuff.
2007-08-21 William Jon McCann <mccann@jhu.edu>
* daemon/test-session.c: (on_secret_info_query):
Convert termio to termios stuff.
svn path=/branches/mccann-gobject/; revision=5175
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | daemon/test-session.c | 26 |
2 files changed, 18 insertions, 13 deletions
@@ -1,5 +1,10 @@ 2007-08-21 William Jon McCann <mccann@jhu.edu> + * daemon/test-session.c: (on_secret_info_query): + Convert termio to termios stuff. + +2007-08-21 William Jon McCann <mccann@jhu.edu> + * acconfig.h: * acinclude.m4: * common/gdm-address.c: diff --git a/daemon/test-session.c b/daemon/test-session.c index 29fca1b8..dfc91acd 100644 --- a/daemon/test-session.c +++ b/daemon/test-session.c @@ -144,25 +144,25 @@ static void on_secret_info_query (GdmSession *session, const char *query_text) { - char answer[1024]; -#ifdef __sun - struct termios io_info; -#else - struct termio io_info; -#endif + char answer[1024]; + struct termios ts0; + struct termios ts1; + + tcgetattr (fileno (stdin), &ts0); + ts1 = ts0; + ts1.c_lflag &= ~ECHO; g_print ("%s", query_text); - ioctl (0, TCGETA, &io_info); - io_info.c_lflag &= ~ECHO; - ioctl (0, TCSETA, &io_info); + if (tcsetattr (fileno (stdin), TCSAFLUSH, &ts1) != 0) { + fprintf (stderr, "Could not set terminal attributes\n"); + exit (1); + } fgets (answer, sizeof (answer), stdin); - answer[strlen(answer) - 1] = '\0'; + answer[strlen (answer) - 1] = '\0'; - ioctl (0, TCGETA, &io_info); - io_info.c_lflag |= ECHO; - ioctl (0, TCSETA, &io_info); + tcsetattr (fileno (stdin), TCSANOW, &ts0); g_print ("\n"); |