Mercurial > hg > octave-nkf
comparison libqterminal/unix/kpty.cpp @ 15670:d79d1a3130c8
Fix for building on MacOS.
author | Jacob Dawid <jacob.dawid@googlemail.com> |
---|---|
date | Sat, 02 Jun 2012 16:33:49 +0200 |
parents | f2b81e8a4ab5 |
children | a182972304fa |
comparison
equal
deleted
inserted
replaced
15669:a8ff19a82906 | 15670:d79d1a3130c8 |
---|---|
59 #include <stdio.h> | 59 #include <stdio.h> |
60 #include <string.h> | 60 #include <string.h> |
61 #include <unistd.h> | 61 #include <unistd.h> |
62 #include <grp.h> | 62 #include <grp.h> |
63 | 63 |
64 #if defined(HAVE_PTY_H) | 64 #ifdef Q_OS_MAC |
65 # include <pty.h> | |
66 #endif | |
67 | |
68 #ifdef HAVE_LIBUTIL_H | |
69 # include <libutil.h> | |
70 #elif defined(HAVE_UTIL_H) | |
71 # include <util.h> | 65 # include <util.h> |
66 #else | |
67 # if defined(HAVE_PTY_H) | |
68 # include <pty.h> | |
69 # endif | |
70 # ifdef HAVE_LIBUTIL_H | |
71 # include <libutil.h> | |
72 # elif defined(HAVE_UTIL_H) | |
73 # include <util.h> | |
74 # endif | |
72 #endif | 75 #endif |
73 | 76 |
74 /* | 77 /* |
75 #ifdef HAVE_UTEMPTER | 78 #ifdef HAVE_UTEMPTER |
76 extern "C" { | 79 extern "C" { |
303 struct group* p = getgrnam(TTY_GROUP); | 306 struct group* p = getgrnam(TTY_GROUP); |
304 if (!p) | 307 if (!p) |
305 p = getgrnam("wheel"); | 308 p = getgrnam("wheel"); |
306 gid_t gid = p ? p->gr_gid : getgid (); | 309 gid_t gid = p ? p->gr_gid : getgid (); |
307 | 310 |
308 if (!chown(d->ttyName.data(), getuid(), gid)) { | 311 if (!chown(d->ttyName.data(), getuid(), gid)) { |
309 chmod(d->ttyName.data(), S_IRUSR|S_IWUSR|S_IWGRP); | 312 chmod(d->ttyName.data(), S_IRUSR|S_IWUSR|S_IWGRP); |
310 } | 313 } |
311 } | 314 } |
312 goto gotpty; | 315 goto gotpty; |
313 } | 316 } |
314 ::close(d->masterFd); | 317 ::close(d->masterFd); |
315 d->masterFd = -1; | 318 d->masterFd = -1; |
316 } | 319 } |
317 } | 320 } |
318 } | 321 } |
319 | 322 |
320 qWarning() << "Can't open a pseudo teletype"; | 323 qWarning() << "Can't open a pseudo teletype"; |
321 return false; | 324 return false; |
322 | 325 |