plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

OpenBSD.c (286B)


      1 #define getpts not_using_this_getpts
      2 #include "bsdpty.c"
      3 #undef getpts
      4 
      5 #include <util.h>
      6 
      7 int
      8 getpts(int fd[], char *slave)
      9 {
     10 	if(openpty(&fd[1], &fd[0], NULL, NULL, NULL) >= 0){
     11 		fchmod(fd[1], 0620);
     12 		strcpy(slave, ttyname(fd[0]));
     13 		return 0;
     14 	}
     15 	sysfatal("no ptys");
     16 	return 0;
     17 }