rem: set_mode (struct mode_info *info, int reversed, struct termios *mode)
add: set_mode (struct mode_info *info, bool reversed, struct termios *mode)
context: set_mode (struct mode_info *info, int reversed, struct termios *mode){  tcflag_t *bitsp;  if (reversed && (info->flags & REV) == 0)    return 0;  bitsp = mode_type_flag (info->type, mode);  if (bitsp == NULL)    {      /* Combination mode. */      if (STREQ (info->name, "evenp") || STREQ (info->name, "parity"))	{	  if (reversed)	    mode->c_cflag = (mode->c_cflag & ~PARENB & ~CSIZE) | CS8;	  else	    mode->c_cflag = (mode->c_cflag & ~PARODD & ~CSIZE) | PARENB | CS7;	}      else if (STREQ (info->name, "oddp"))	{	  if (reversed)	    mode->c_cflag = (mode->c_cflag & ~PARENB & ~CSIZE) | CS8;	  else	    mode->c_cflag = (mode->c_cflag & ~CSIZE) | CS7 | PARODD | PARENB;	}      else if (STREQ (info->name, "nl"))	{	  if (reversed)	    {	      mode->c_iflag = (mode->c_iflag | ICRNL) & ~INLCR & ~IGNCR;	      mode->c_oflag = (mode->c_oflag#ifdef ONLCR			       | ONLCR#endif		)#ifdef OCRNL		& ~OCRNL#endif#ifdef ONLRET		& ~ONLRET#endif		;	    }	  else	    {	      mode->c_iflag = mode->c_iflag & ~ICRNL;#ifdef ONLCR	      mode->c_oflag = mode->c_oflag & ~ONLCR;#endif	    }	}      else if (STREQ (info->name, "ek"))	{	  mode->c_cc[VERASE] = CERASE;	  mode->c_cc[VKILL] = CKILL;	}      else if (STREQ (info->name, "sane"))	sane_mode (mode);      else if (STREQ (info->name, "cbreak"))	{	  if (reversed)	    mode->c_lflag |= ICANON;	  else	    mode->c_lflag &= ~ICANON;	}      else if (STREQ (info->name, "pass8"))	{	  if (reversed)	    {	      mode->c_cflag = (mode->c_cflag & ~CSIZE) | CS7 | PARENB;	      mode->c_iflag |= ISTRIP;	    }	  else	    {	      mode->c_cflag = (mode->c_cflag & ~PARENB & ~CSIZE) | CS8;	      mode->c_iflag &= ~ISTRIP;	    }	}      else if (STREQ (info->name, "litout"))	{	  if (reversed)	    {	      mode->c_cflag = (mode->c_cflag & ~CSIZE) | CS7 | PARENB;	      mode->c_iflag |= ISTRIP;	      mode->c_oflag |= OPOST;	    }	  else	    {	      mode->c_cflag = (mode->c_cflag & ~PARENB & ~CSIZE) | CS8;	      mode->c_iflag &= ~ISTRIP;	      mode->c_oflag &= ~OPOST;	    }	}      else if (STREQ (info->name, "raw") || STREQ (info->name, "cooked"))	{	  if ((info->name[0] == 'r' && reversed)	      || (info->name[0] == 'c' && !reversed))	    {	      /* Cooked mode. */	      mode->c_iflag |= BRKINT | IGNPAR | ISTRIP | ICRNL | IXON;	      mode->c_oflag |= OPOST;	      mode->c_lflag |= ISIG | ICANON;#if VMIN == VEOF	      mode->c_cc[VEOF] = CEOF;#endif#if VTIME == VEOL	      mode->c_cc[VEOL] = CEOL;#endif	    }	  else	    {	      /* Raw mode. */	      mode->c_iflag = 0;	      mode->c_oflag &= ~OPOST;	      mode->c_lflag &= ~(ISIG | ICANON#ifdef XCASE				 | XCASE#endif		);	      mode->c_cc[VMIN] = 1;	      mode->c_cc[VTIME] = 0;	    }	}#ifdef IXANY      else if (STREQ (info->name, "decctlq"))	{	  if (reversed)	    mode->c_iflag |= IXANY;	  else	    mode->c_iflag &= ~IXANY;	}#endif#ifdef TABDLY      else if (STREQ (info->name, "tabs"))	{	  if (reversed)	    mode->c_oflag = (mode->c_oflag & ~TABDLY) | TAB3;	  else	    mode->c_oflag = (mode->c_oflag & ~TABDLY) | TAB0;	}#else# ifdef OXTABS      else if (STREQ (info->name, "tabs"))	{	  if (reversed)	    mode->c_oflag = mode->c_oflag | OXTABS;	  else	    mode->c_oflag = mode->c_oflag & ~OXTABS;	}# endif#endif#if defined(XCASE) && defined(IUCLC) && defined(OLCUC)      else if (STREQ (info->name, "lcase")	       || STREQ (info->name, "LCASE"))	{	  if (reversed)	    {	      mode->c_lflag &= ~XCASE;	      mode->c_iflag &= ~IUCLC;	      mode->c_oflag &= ~OLCUC;	    }	  else	    {	      mode->c_lflag |= XCASE;	      mode->c_iflag |= IUCLC;	      mode->c_oflag |= OLCUC;	    }	}#endif      else if (STREQ (info->name, "crt"))	mode->c_lflag |= ECHOE#ifdef ECHOCTL	  | ECHOCTL#endif#ifdef ECHOKE	  | ECHOKE#endif	  ;      else if (STREQ (info->name, "dec"))	{	  mode->c_cc[VINTR] = 3;	/* ^C */	  mode->c_cc[VERASE] = 127;	/* DEL */	  mode->c_cc[VKILL] = 21;	/* ^U */	  mode->c_lflag |= ECHOE#ifdef ECHOCTL	    | ECHOCTL#endif#ifdef ECHOKE	    | ECHOKE#endif	    ;#ifdef IXANY	  mode->c_iflag &= ~IXANY;#endif	}    }  else if (reversed)    *bitsp = *bitsp & ~info->mask & ~info->bits;  else    *bitsp = (*bitsp & ~info->mask) | info->bits;  return 1;}