comparison mcabber/src/main.c @ 28:0cd8025eebee

[/trunk] Changeset 44 by mikael * Some more fixes. * We can now build with GNU99 gcc extensions.
author mikael
date Mon, 28 Mar 2005 10:36:47 +0000
parents 77e6bd2ccde6
children 86837ff0554c
comparison
equal deleted inserted replaced
27:77e6bd2ccde6 28:0cd8025eebee
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include <unistd.h> 3 #include <unistd.h>
4 #include <string.h> 4 #include <string.h>
5 #include <signal.h> 5 #include <signal.h>
6 #include <termios.h> 6 #include <termios.h>
7 #include <getopt.h>
7 8
8 #include "utils.h" 9 #include "utils.h"
9 #include "screen.h" 10 #include "screen.h"
10 #include "buddies.h" 11 #include "buddies.h"
11 #include "parsecfg.h" 12 #include "parsecfg.h"
40 { 41 {
41 struct termios orig, new; 42 struct termios orig, new;
42 int nread; 43 int nread;
43 44
44 /* Turn echoing off and fail if we can't. */ 45 /* Turn echoing off and fail if we can't. */
45 if (tcgetattr(fileno (stdin), &orig) != 0) 46 if (tcgetattr(fileno(stdin), &orig) != 0)
46 return -1; 47 return -1;
47 new = orig; 48 new = orig;
48 new.c_lflag &= ~ECHO; 49 new.c_lflag &= ~ECHO;
49 if (tcsetattr(fileno (stdin), TCSAFLUSH, &new) != 0) 50 if (tcsetattr(fileno(stdin), TCSAFLUSH, &new) != 0)
50 return -1; 51 return -1;
51 52
52 /* Read the password. */ 53 /* Read the password. */
53 nread = getline(passstr, n, stdin); 54 nread = getline(passstr, n, stdin);
54 55
55 /* Restore terminal. */ 56 /* Restore terminal. */
56 (void) tcsetattr(fileno (stdin), TCSAFLUSH, &orig); 57 (void) tcsetattr(fileno(stdin), TCSAFLUSH, &orig);
57 58
58 return (ssize_t)nread; 59 return (ssize_t)nread;
59 } 60 }
60 61
61 void credits(void) 62 void credits(void)