diff options
author | rsc <devnull@localhost> | 2003-11-25 03:06:00 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-11-25 03:06:00 +0000 |
commit | e642beb5221e7dd00ff2b0e36b261f6722631116 (patch) | |
tree | 0b50f6e376209bd6f110173f8ab9e2c1f5baa691 /src/cmd | |
parent | 3ad24e4036fef2cbc71c421f5808bc02a0738a04 (diff) | |
download | plan9port-e642beb5221e7dd00ff2b0e36b261f6722631116.tar.gz plan9port-e642beb5221e7dd00ff2b0e36b261f6722631116.tar.bz2 plan9port-e642beb5221e7dd00ff2b0e36b261f6722631116.zip |
add sunos
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/9term/SunOS.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/cmd/9term/SunOS.c b/src/cmd/9term/SunOS.c new file mode 100644 index 00000000..6a37ab33 --- /dev/null +++ b/src/cmd/9term/SunOS.c @@ -0,0 +1,30 @@ +#include "9term.h" + +int +getchildwd(int pid, char *wdir, int bufn) +{ + char path[256]; + char cwd[256]; + + if(getcwd(cwd, sizeof cwd) < 0) + return -1; + snprint(path, sizeof path, "/proc/%d/cwd", pid); + if(chdir(path) < 0) + return -1; + if(getcwd(wdir, bufn) < 0) + return -1; + chdir(cwd); + return 0; +} + +int +getpts(int fd[], char *slave) +{ + fd[1] = open("/dev/ptmx", ORDWR); + if ((grantpt(fd[1]) < 0) || (unlockpt(fd[1]) < 0)) + return -1; + fchmod(fd[1], 0622); + strcpy(slave, ptsname(fd[1])); + fd[0] = open(slave, OREAD); + return 0; +} |