[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: compiling under hurd



On Tue, Sep 04, 2001 at 05:48:03PM -0400, Roland McGrath wrote:
> GNU libc has the <pty.h> header and the openpty function on both Linux and
> Hurd.  Programs should use that.
> 

Thank you for your suggestion. I've written the following patch:

Only in jed-0.99.14/autoconf: configure
diff -u -r jed-0.99.14.old/autoconf/configure.in jed-0.99.14/autoconf/configure.in
--- jed-0.99.14.old/autoconf/configure.in	Fri Jun  1 04:23:13 2001
+++ jed-0.99.14/autoconf/configure.in	Sat Sep  8 21:06:21 2001
@@ -34,6 +34,8 @@
 AC_TYPE_PID_T
 AC_TYPE_UID_T
 
+AC_CHECK_LIB(util,openpty)
+
 AC_CHECK_FUNCS(\
 memset \
 memcpy \
@@ -49,6 +51,7 @@
 symlink \
 gethostname \
 tcgetpgrp \
+openpty \
 )
 
 JD_SET_OBJ_SRC_DIR
diff -u -r jed-0.99.14.old/src/Makefile.in jed-0.99.14/src/Makefile.in
--- jed-0.99.14.old/src/Makefile.in	Sat Sep  8 21:21:35 2001
+++ jed-0.99.14/src/Makefile.in	Sat Sep  8 21:08:54 2001
@@ -92,7 +92,7 @@
 MIN_SLANG_VERSION = 10311
 MAX_SLANG_VERSION =
 XLIB = $(X_XTRA_LIBS) $(XLIBDIR) -lX11 $(TERMCAP_LIB)
-MISCLIBS = $(MOUSELIB) $(TERMCAP_LIB) $(X_XTRA_LIBS)
+MISCLIBS = $(MOUSELIB) $(TERMCAP_LIB) $(X_XTRA_LIBS) @LIBS@
 
 ALL_CFLAGS = $(CFLAGS) -Dunix -DJED $(MOUSEFLAGS) $(SLANG_INC)
 COMPILE_CMD = \
@@ -150,7 +150,7 @@
 $(OBJDIR)/xjed : $(OBJS) $(OBJDIR)/xterm.o $(OBJDIR)/vterm.o
 	cd $(OBJDIR); \
 	$(CC) $(OFILES) xterm.o vterm.o -o xjed $(LDFLAGS) \
-	   $(SLANG_LIB) -lslang  $(XLIB) -lm $(XRENDERFONTLIBS)
+	   $(SLANG_LIB) -lslang  $(XLIB) -lm $(XRENDERFONTLIBS) @LIBS@
 #
 rgrep: $(OBJDIR)/rgrep
 	@echo rgrep created in $(OBJDIR)
diff -u -r jed-0.99.14.old/src/config.hin jed-0.99.14/src/config.hin
--- jed-0.99.14.old/src/config.hin	Fri Jun  1 04:23:13 2001
+++ jed-0.99.14/src/config.hin	Sat Sep  8 20:23:05 2001
@@ -45,6 +45,7 @@
 #undef HAVE_TCSETATTR
 #undef HAVE_CFGETOSPEED
 #undef HAVE_TCGETPGRP
+#undef HAVE_OPENPTY
 
 #undef HAVE_GLOB_H
 
diff -u -r jed-0.99.14.old/src/pty.c jed-0.99.14/src/pty.c
--- jed-0.99.14.old/src/pty.c	Fri Jun  1 04:23:13 2001
+++ jed-0.99.14/src/pty.c	Sat Sep  8 21:17:38 2001
@@ -71,6 +71,27 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#  ifdef HAVE_OPENPTY
+
+static int pty_open_master_pty (int *master, char *slave_tty_name)
+{
+    int slave;
+    int ret;
+    
+    if (-1 != openpty(master, &slave, NULL, NULL, NULL))
+    {
+	strcpy(slave_tty_name,ttyname(slave));
+	close(slave);
+	return 0;
+    }
+    else
+    {
+	return -1;
+    }
+}
+
+#  else
+
 static int pty_open_master_pty (int *master, char *slave_tty_name)
 {
    char *a, *b;
@@ -110,6 +131,8 @@
      }
    return -1;
 }
+
+#endif
 
 static int pty_open_slave_pty (char *slave_name, int *slave)
 {

This is the simplest patch i can think at the moment, and it works. It's
enough, or I can do better?

Thanks in advance.

-- 
Saluti / Regards

Diego Roversi | diegor at maganet.net
              | diegor at tiscalinet.it 



Reply to: