--- smsdaemon/kbhit.cpp 2008/12/18 06:47:26 195 +++ smsdaemon/kbhit.cpp 2008/12/18 06:53:29 196 @@ -32,19 +32,19 @@ void raw(void) { static char init; -/**/ + /**/ struct termios new_kbd_mode; - if(init) + if (init) return; -/* put keyboard (stdin, actually) in raw, unbuffered mode */ + /* put keyboard (stdin, actually) in raw, unbuffered mode */ tcgetattr(0, &g_old_kbd_mode); memcpy(&new_kbd_mode, &g_old_kbd_mode, sizeof(struct termios)); new_kbd_mode.c_lflag &= ~(ICANON | ECHO); new_kbd_mode.c_cc[VTIME] = 0; new_kbd_mode.c_cc[VMIN] = 1; tcsetattr(0, TCSANOW, &new_kbd_mode); -/* when we exit, go back to normal, "cooked" mode */ + /* when we exit, go back to normal, "cooked" mode */ atexit(cooked); init = 1; @@ -58,12 +58,12 @@ int status; raw(); -/* check stdin (fd 0) for activity */ + /* check stdin (fd 0) for activity */ FD_ZERO(&read_handles); FD_SET(0, &read_handles); timeout.tv_sec = timeout.tv_usec = 0; status = select(0 + 1, &read_handles, NULL, NULL, &timeout); - if(status < 0) + if (status < 0) { printf("select() failed in kbhit()\n"); exit(1); @@ -77,8 +77,8 @@ unsigned char temp; raw(); -/* stdin = fd 0 */ - if(read(0, &temp, 1) != 1) + /* stdin = fd 0 */ + if (read(0, &temp, 1) != 1) return 0; return temp; }