00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "ux.hpp"
00019
00020 using namespace Ux;
00021
00022 void Pty::posix_openpt(int oflag)
00023 {
00024 if ((fd = ::posix_openpt(oflag)) == -1)
00025 throw Error(errno);
00026 }
00027
00028 void Pty::grantpt(void)
00029 {
00030 if (::grantpt(fd) == -1)
00031 throw Error(errno);
00032 }
00033
00034 void Pty::unlockpt(void)
00035 {
00036 if (::unlockpt(fd) == -1)
00037 throw Error(errno);
00038 }
00039
00040 char *Pty::ptsname(void)
00041 {
00042 char *s;
00043
00044 errno = 0;
00045 if ((s = ::ptsname(fd)) == NULL) {
00046 if (errno == 0)
00047 throw Error(EINVAL);
00048 else
00049 throw Error(errno);
00050 }
00051 return s;
00052 }