if (ui_loop_hook) detach = ui_loop_hook (0);
if (deprecated_ui_loop_hook) detach = deprecated_ui_loop_hook (0);
do_hardwire_readchar (struct serial *scb, int timeout){  int status, delta;  int detach = 0;  if (timeout > 0)    timeout++;  /* We have to be able to keep the GUI alive here, so we break the original     timeout into steps of 1 second, running the "keep the GUI alive" hook      each time through the loop.     Also, timeout = 0 means to poll, so we just set the delta to 0, so we     will only go through the loop once. */  delta = (timeout == 0 ? 0 : 1);  while (1)    {      /* N.B. The UI may destroy our world (for instance by calling         remote_stop,) in which case we want to get out of here as         quickly as possible.  It is not safe to touch scb, since         someone else might have freed it.  The ui_loop_hook signals that          we should exit by returning 1. */      if (ui_loop_hook)	detach = ui_loop_hook (0);      if (detach)	return SERIAL_TIMEOUT;      scb->timeout_remaining = (timeout < 0 ? timeout : timeout - delta);      status = wait_for (scb, delta);      if (status < 0)	return status;      status = read (scb->fd, scb->buf, BUFSIZ);      if (status <= 0)	{	  if (status == 0)	    {	      /* Zero characters means timeout (it could also be EOF, but	         we don't (yet at least) distinguish).  */	      if (scb->timeout_remaining > 0)		{		  timeout = scb->timeout_remaining;		  continue;		}	      else if (scb->timeout_remaining < 0)		continue;	      else		return SERIAL_TIMEOUT;	    }	  else if (errno == EINTR)	    continue;	  else	    return SERIAL_ERROR;	/* Got an error from read */	}      scb->bufcnt = status;      scb->bufcnt--;      scb->bufp = scb->buf;      return *scb->bufp++;    }}