+ if(pollfd.revents & POLLNVAL) {
+ g_warning("Polling fd tells it is not open");
+ num_hup++;
+ }
+
+ if(pollfd.revents & POLLHUP) {
+
+ g_info("Polling FD : hung up.");
+ num_hup++;
+
+ }
+
+ if(pollfd.revents & (POLLIN | POLLPRI)) {
+ int count;
+ count = read (fdpty, buf, 256);
+ if(count > 0) {
+ unsigned int i;
+ buf[count] = '\0';
+ g_printf("%s", buf);
+ for(i=0; i<count; i++) {
+ switch(read_state) {
+ case GET_LINE:
+ if(buf[i] == '\n') {
+ read_state = GET_SEMI;
+ g_debug("Tracecontrol input line skip\n");
+ }
+ break;
+ case GET_SEMI:
+ if(buf[i] == ':') {
+ g_debug("Tracecontrol input : marker found\n");
+ read_state = GET_SPACE;
+ }
+ break;
+ case GET_SPACE:
+ if(buf[i] == ' ') {
+ g_debug("Tracecontrol input space marker found\n");
+ goto write_password;
+ }
+ break;
+ }
+ }
+ } else if(count == -1) {
+ perror("Error in read");
+ goto wait_child;
+ }
+
+ }
+