我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用termios.INPCK。
def prepare(self): # per-readline preparations: self.__svtermstate = tcgetattr(self.input_fd) raw = self.__svtermstate.copy() raw.iflag |= termios.ICRNL raw.iflag &= ~(termios.BRKINT | termios.INPCK | termios.ISTRIP | termios.IXON) raw.oflag &= ~termios.OPOST raw.cflag &= ~(termios.CSIZE | termios.PARENB) raw.cflag |= (termios.CS8) raw.lflag &= ~(termios.ICANON | termios.ECHO | termios.IEXTEN | (termios.ISIG * 1)) raw.cc[termios.VMIN] = 1 raw.cc[termios.VTIME] = 0 tcsetattr(self.input_fd, termios.TCSADRAIN, raw) self.screen = [] self.height, self.width = self.getheightwidth() self.__buffer = [] self.__posxy = 0, 0 self.__gone_tall = 0 self.__move = self.__move_short self.__offset = 0 self.__maybe_write_code(self._smkx) try: self.old_sigwinch = signal.signal( signal.SIGWINCH, self.__sigwinch) except ValueError: pass
def prepare(self): # per-readline preparations: self.__svtermstate = tcgetattr(self.input_fd) raw = self.__svtermstate.copy() raw.iflag &=~ (termios.BRKINT | termios.INPCK | termios.ISTRIP | termios.IXON) raw.oflag &=~ (termios.OPOST) raw.cflag &=~ (termios.CSIZE|termios.PARENB) raw.cflag |= (termios.CS8) raw.lflag &=~ (termios.ICANON|termios.ECHO| termios.IEXTEN|(termios.ISIG*1)) raw.cc[termios.VMIN] = 1 raw.cc[termios.VTIME] = 0 tcsetattr(self.input_fd, termios.TCSADRAIN, raw) self.screen = [] self.height, self.width = self.getheightwidth() self.__buffer = [] self.__posxy = 0, 0 self.__gone_tall = 0 self.__move = self.__move_short self.__offset = 0 self.__maybe_write_code(self._smkx) try: self.old_sigwinch = signal.signal( signal.SIGWINCH, self.__sigwinch) except ValueError: pass