guy@auspex.auspex.com (Guy Harris) (10/24/89)
"GetPty", on BSD and HP-UX systems, thinks that the only pseudo-ttys on the system are named "/dev/ttyp0" through "/dev/ttypf". In fact, since 4.2BSD, as I remember, there could be up to 64, in banks "/dev/tty[pqrs]" (the driver can support more, but BSD programs generally search only those 4 banks). If the same is true for HP-UX, here's a fix to "overhead/util/lib/getpty.c" to make "GetPty" search all 64 pseudo-ttys: *** getpty.c.dist Thu Oct 19 16:53:51 1989 --- getpty.c Thu Oct 19 17:22:44 1989 *************** *** 27,35 **** #ifdef hpux ! #define MASTER_PTY_PREFIX "/dev/ptym/ptyp" ! #define SLAVE_PTY_PREFIX "/dev/pty/ttyp" ! #define MAX_PTYS 16 #endif /* HPUX */ #ifdef AIX --- 27,35 ---- #ifdef hpux ! #define MASTER_PTY_PREFIX "/dev/ptym/pty" ! #define SLAVE_PTY_PREFIX "/dev/pty/tty" ! #define MAX_PTYS 64 #endif /* HPUX */ #ifdef AIX *************** *** 39,47 **** #endif /* AIX */ #ifndef MASTER_PTY_PREFIX ! #define MASTER_PTY_PREFIX "/dev/ptyp" ! #define SLAVE_PTY_PREFIX "/dev/ttyp" ! #define MAX_PTYS 16 #endif static char *GetPtyNumberString(num) --- 39,47 ---- #endif /* AIX */ #ifndef MASTER_PTY_PREFIX ! #define MASTER_PTY_PREFIX "/dev/pty" ! #define SLAVE_PTY_PREFIX "/dev/tty" ! #define MAX_PTYS 64 #endif static char *GetPtyNumberString(num) *************** *** 51,64 **** #ifdef AIX sprintf(ptyNum, "%d", num); ! #else ! if (num < 10) { ! sprintf(ptyNum, "%d", num); ! } ! else { ! ptyNum[0] = 'a' + num - 10; ! ptyNum[1] = '\0'; ! } #endif /* AIX */ return ptyNum; } --- 51,58 ---- #ifdef AIX sprintf(ptyNum, "%d", num); ! #else ! sprintf(ptyNum, "%c%c", 'p' + num/16, "0123456789abcdef"[num%16]); #endif /* AIX */ return ptyNum; }