Add getpt().  Although it's a GNU extension, it's useful for portability,
and people should be encouraged to use it.  Besides, it's a whopping 30
bytes.

diff --git a/include/stdlib.h b/include/stdlib.h
index 38dd162..af97eea 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -83,12 +83,14 @@
 
 /* Basic PTY functions.  These only work if devpts is mounted! */
 
+__extern int unlockpt(int);
+__extern char *ptsname(int);
+__extern int getpt(void);
+
 static __inline__ int grantpt(int __fd)
 {
   (void)__fd;
   return 0;			/* devpts does this all for us! */
 }
-__extern int unlockpt(int);
-__extern char *ptsname(int);
 
 #endif /* _STDLIB_H */
diff --git a/klibc/Makefile b/klibc/Makefile
index cede5fa..2ddd753 100644
--- a/klibc/Makefile
+++ b/klibc/Makefile
@@ -35,7 +35,7 @@
 	  seteuid.o setegid.o setresuid.o setresgid.o \
 	  getenv.o setenv.o putenv.o __put_env.o unsetenv.o \
 	  getopt.o readdir.o \
-	  syslog.o closelog.o pty.o isatty.o reboot.o \
+	  syslog.o closelog.o pty.o getpt.o isatty.o reboot.o \
 	  time.o utime.o fdatasync.o llseek.o select.o nice.o getpriority.o \
 	  qsort.o lrand48.o srand48.o seed48.o \
 	  inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \
diff --git a/klibc/getpt.c b/klibc/getpt.c
new file mode 100644
index 0000000..a059030
--- /dev/null
+++ b/klibc/getpt.c
@@ -0,0 +1,17 @@
+/*
+ * getpt.c
+ *
+ * GNU extension to the standard Unix98 pty suite
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <termios.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+int getpt(void)
+{
+  return open("/dev/ptmx", O_RDWR|O_NOCTTY);
+}
diff --git a/klibc/include/stdlib.h b/klibc/include/stdlib.h
index 38dd162..af97eea 100644
--- a/klibc/include/stdlib.h
+++ b/klibc/include/stdlib.h
@@ -83,12 +83,14 @@
 
 /* Basic PTY functions.  These only work if devpts is mounted! */
 
+__extern int unlockpt(int);
+__extern char *ptsname(int);
+__extern int getpt(void);
+
 static __inline__ int grantpt(int __fd)
 {
   (void)__fd;
   return 0;			/* devpts does this all for us! */
 }
-__extern int unlockpt(int);
-__extern char *ptsname(int);
 
 #endif /* _STDLIB_H */
diff --git a/klibc/pty.c b/klibc/pty.c
index 5907ca2..2fe01ab 100644
--- a/klibc/pty.c
+++ b/klibc/pty.c
@@ -1,7 +1,7 @@
 /*
  * pty.c
  *
- * Basic Unix98 PTY functionality; assumes devpts
+ * Basic Unix98 PTY functionality; assumes devpts mounted on /dev/pts
  */
 
 #include <stdio.h>