Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool openPts(char* ptsName, int* mpty, int* spty) {
- if (openpty(mpty, spty, ptsName, NULL, NULL) == -1) {
- printf("openPts: ERROR openpty [%d] %s",
- errno, strerror(errno));
- return false;
- }
- // if (*mpty == 0 || *spty == 0) {
- // printf("openPts: ERROR openpty mpty[%d] spty[%d] [%d] %s",
- // *mpty, *spty, errno, strerror(errno));
- //
- // if (*mpty > 0) {
- // close(*mpty);
- // }
- // if (*spty > 0) {
- // close(*spty);
- // }
- // return false;
- // }
- ///////////////////////////////////////////////////////////////////
- //Set non-blocking
- if (setNonblock(*mpty) == -1) {
- printf("openPts: mpty[%d] NONBLOCK ERROR [%d] [%s]",
- *mpty, errno, strerror(errno));
- }
- if (setNonblock(*spty) == -1) {
- printf("openPts: spty[%d] NONBLOCK ERROR [%d] [%s]",
- *spty, errno, strerror(errno));
- }
- ///////////////////////////////////////////////////////////////////
- printf("openPts[%s]: fd MASTER[%d] fd SLAVE[%d]",
- ptsName, *mpty, *spty);
- return true;
- }
Add Comment
Please, Sign In to add comment