FreeBSD-10 Currentには/dev/ptmxがないので、

M-x shell とか alpaca.elが動かなくなって困っていた。

 ________________________________________________
|Warning: no access to tty (Bad file descriptor).
|Thus no job control in this shell.
|stty: stdin isn't a terminal
|stty: stdin isn't a terminal
|% ■
|----*shell* (Shell:run)-------------------------

openpt()をつかうパッチがeditors/emacs/files/patch-src_s_freebsd.hにあったのでeditores/emacs23に移植した。

なんでemacs23は放置されてるんだろう。セキュリティフィックスしか入らないのかなぁ。

/usr/ports/editors/emacs23/files/patch-src_s_freebsd.h

--- src/s/freebsd.h.orig	2012-01-12 19:27:54.000000000 +0900
+++ src/s/freebsd.h	2012-11-08 14:35:14.318909716 +0900
@@ -169,6 +169,20 @@
 
 #define POSIX_SIGNALS		1
 
+#define PTY_ITERATION	for (i = 0; i < 1; i++)
+#define PTY_NAME_SPRINTF	/* none */
+#define PTY_TTY_NAME_SPRINTF	/* none */
+#define PTY_OPEN						\
+  do								\
+    {								\
+      int slave;						\
+      if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1)	\
+	fd = -1;						\
+      else							\
+	emacs_close (slave);					\
+    }								\
+  while (0)
+
 /* The `combreloc' setting became the default, and it seems to be
    incompatible with unexec.  Symptom is an immediate SEGV in
    XtInitializeWidget when starting Emacs under X11.  */