优化代码

TempBranch
Matthew 7 months ago
parent 4bad6887f3
commit 3bdd0ce344

@ -51,16 +51,16 @@ static void set_parity (struct termios *opt, char parity)
{ {
switch (parity) switch (parity)
{ {
case'N':/* 无校验 */ case 'N':/* 无校验 */
case 'n': case 'n':
opt->c_cflag &= ~PARENB; opt->c_cflag &= ~PARENB;
break; break;
case'E':/*偶校验*/ case 'E':/*偶校验*/
case 'e': case 'e':
opt->c_cflag |= PARENB; opt->c_cflag |= PARENB;
opt->c_cflag &= ~PARODD; opt->c_cflag &= ~PARODD;
break; break;
case'O':/* 奇校验 */ case 'O':/* 奇校验 */
case 'o': case 'o':
opt->c_cflag |= PARENB; opt->c_cflag |= PARENB;
opt->c_cflag |= ~PARODD; opt->c_cflag |= ~PARODD;

Loading…
Cancel
Save