mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-04 22:51:42 +02:00
zsh-workers/10243
This commit is contained in:
parent
7e2d72fff4
commit
3a69ea87be
2 changed files with 24 additions and 22 deletions
|
@ -6,7 +6,8 @@ _wanted groups || return 1
|
|||
|
||||
if ! zstyle -a ":completion:${curcontext}:" groups groups; then
|
||||
(( $+_cache_groups )) ||
|
||||
if (( ${+commands[ypcat]} )) && tmp=$(ypcat group.byname); then
|
||||
if (( ${+commands[ypcat]} )) &&
|
||||
tmp=$(_call groups ypcat group.byname); then
|
||||
: ${(A)_cache_groups:=${${(f)tmp}%%:*}} # If you use YP
|
||||
else
|
||||
: ${(A)_cache_groups:=${${(s: :)$(</etc/group)}%%:*}}
|
||||
|
|
|
@ -165,7 +165,7 @@ get_pty(int *master, int *slave)
|
|||
|
||||
#else /* ! __osf__ */
|
||||
|
||||
#if __SVR4
|
||||
#if defined(__SVR4) || defined(sinix)
|
||||
|
||||
#include <sys/stropts.h>
|
||||
|
||||
|
@ -174,11 +174,12 @@ get_pty(int *master, int *slave)
|
|||
{
|
||||
int mfd, sfd;
|
||||
char *name;
|
||||
int ret;
|
||||
|
||||
if ((mfd = open("/dev/ptmx", O_RDWR)) < 0)
|
||||
return 1;
|
||||
|
||||
if (!(name = ptsname(mfd)) || grantpt(mfd) || unlockpt(mfd)) {
|
||||
if (grantpt(mfd) || unlockpt(mfd) || !(name = ptsname(mfd))) {
|
||||
close(mfd);
|
||||
return 1;
|
||||
}
|
||||
|
@ -186,31 +187,31 @@ get_pty(int *master, int *slave)
|
|||
close(mfd);
|
||||
return 1;
|
||||
}
|
||||
if ((ret = ioctl(sfd, I_FIND, "ptem")) != 1)
|
||||
if (ret == -1 || ioctl(sfd, I_PUSH, "ptem") == -1) {
|
||||
close(mfd);
|
||||
close(sfd);
|
||||
return 1;
|
||||
}
|
||||
if ((ret = ioctl(sfd, I_FIND, "ldterm")) != 1)
|
||||
if (ret == -1 || ioctl(sfd, I_PUSH, "ldterm") == -1) {
|
||||
close(mfd);
|
||||
close(sfd);
|
||||
return 1;
|
||||
}
|
||||
if ((ret = ioctl(sfd, I_FIND, "ttcompat")) != 1)
|
||||
if (ret == -1 || ioctl(sfd, I_PUSH, "ttcompat") == -1) {
|
||||
close(mfd);
|
||||
close(sfd);
|
||||
return 1;
|
||||
}
|
||||
if ((ret = ioctl(sfd, I_FIND, "ptem")) != 1)
|
||||
if (ret == -1 || ioctl(sfd, I_PUSH, "ptem") == -1) {
|
||||
close(mfd);
|
||||
close(sfd);
|
||||
return 1;
|
||||
}
|
||||
if ((ret = ioctl(sfd, I_FIND, "ldterm")) != 1)
|
||||
if (ret == -1 || ioctl(sfd, I_PUSH, "ldterm") == -1) {
|
||||
close(mfd);
|
||||
close(sfd);
|
||||
return 1;
|
||||
}
|
||||
if ((ret = ioctl(sfd, I_FIND, "ttcompat")) != 1)
|
||||
if (ret == -1 || ioctl(sfd, I_PUSH, "ttcompat") == -1) {
|
||||
close(mfd);
|
||||
close(sfd);
|
||||
return 1;
|
||||
}
|
||||
*master = mfd;
|
||||
*slave = sfd;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* ! (defined(__SVR4) || defined(sinix)) */
|
||||
#else /* ! (defined(__SVR4) || defind(sinix)) */
|
||||
|
||||
static int
|
||||
get_pty(int *master, int *slave)
|
||||
|
|
Loading…
Reference in a new issue