Skip to content

Commit

Permalink
fix for building with QNX
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Dec 11, 2023
1 parent 80d5dee commit adb3da4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
30 changes: 23 additions & 7 deletions apps/wolfssh/wolfssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,26 @@ static void modes_clear(void)
{
WOLFSSH_TERMIOS term = oldTerm;

term.c_lflag &= ~(ICANON | ISIG | IEXTEN | ECHO | ECHOE | ECHOK
| ECHONL | ECHOPRT | NOFLSH | TOSTOP | FLUSHO
| PENDIN | EXTPROC);
term.c_lflag &= ~(ICANON | ISIG | IEXTEN | ECHO | ECHOE
| ECHOK | ECHONL | NOFLSH | TOSTOP);

term.c_iflag &= ~(ISTRIP | INLCR | ICRNL | IGNCR | IXON | IXOFF
| IXANY | IGNBRK | INPCK | PARMRK);
/* check macros set for some BSD dependent and missing on
* QNX flags */
#ifdef ECHOPRT
term.c_lflag &= ~(ECHOPRT);
#endif
#ifdef FLUSHO
term.c_lflag &= ~(FLUSHO);
#endif
#ifdef PENDIN
term.c_lflag &= ~(PENDIN);
#endif
#ifdef EXTPROC
term.c_lflag &= ~(EXTPROC);
#endif

term.c_iflag &= ~(ISTRIP | INLCR | ICRNL | IGNCR | IXON
| IXOFF | IXANY | IGNBRK | INPCK | PARMRK);
#ifdef IUCLC
term.c_iflag &= ~IUCLC;
#endif
Expand All @@ -178,8 +192,10 @@ static void modes_clear(void)
term.c_oflag &= ~OLCUC;
#endif

term.c_cflag &= ~(CSTOPB | PARENB | PARODD | CLOCAL | CRTSCTS);

term.c_cflag &= ~(CSTOPB | PARENB | PARODD | CLOCAL);
#ifdef CRTSCTS
term.c_cflag &= ~(CRTSCTS);
#endif
tcsetattr(STDIN_FILENO, TCSANOW, &term);
}

Expand Down
24 changes: 20 additions & 4 deletions examples/client/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,22 @@ int ClientSetEcho(int type)
newTerm.c_lflag &= ~ECHO;
if (type == 2) {
newTerm.c_lflag &= ~(ICANON | ISIG | IEXTEN | ECHO | ECHOE
| ECHOK | ECHONL | ECHOPRT | NOFLSH | TOSTOP | FLUSHO
| PENDIN | EXTPROC);
| ECHOK | ECHONL | NOFLSH | TOSTOP);

/* check macros set for some BSD dependent and not missing on
* QNX flags */
#ifdef ECHOPRT
newTerm.c_lflag &= ~(ECHOPRT);
#endif
#ifdef FLUSHO
newTerm.c_lflag &= ~(FLUSHO);
#endif
#ifdef PENDIN
newTerm.c_lflag &= ~(PENDIN);
#endif
#ifdef EXTPROC
newTerm.c_lflag &= ~(EXTPROC);
#endif

newTerm.c_iflag &= ~(ISTRIP | INLCR | ICRNL | IGNCR | IXON
| IXOFF | IXANY | IGNBRK | INPCK | PARMRK);
Expand All @@ -571,8 +585,10 @@ int ClientSetEcho(int type)
newTerm.c_oflag &= ~OLCUC;
#endif

newTerm.c_cflag &= ~(CSTOPB | PARENB | PARODD | CLOCAL
| CRTSCTS);
newTerm.c_cflag &= ~(CSTOPB | PARENB | PARODD | CLOCAL);
#ifdef CRTSCTS
newTerm.c_cflag &= ~(CRTSCTS);
#endif
}
else {
newTerm.c_lflag |= (ICANON | ECHONL);
Expand Down

0 comments on commit adb3da4

Please sign in to comment.