Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Re: Build Failures on SunOS-4.1 and 5.5



On Thu, 12 Apr 2001, Bart Schaefer wrote:
> Ignoring my patch in 13962, which was the right fix for my local variant
> of Vin's symptoms but not for the actual bug report, here's the complete
> change:

Even with these changes, I can no longer build zsh under Solaris 2.6
(x86).  The biggest problem is that you can't include term.h without
first including curses.h (since term.h needs the SGTTY macro defined).
So, I moved the include of curses.h into Sys/system.h, and had to put
it before the inclusion of termios.h (or else the sgtty structure
would not get completely defined).  THEN, term.h defines several
lower-case macros that interfere with variable names in zsh, so I had
to undef "tab", "lines", and "columns".  And if that weren't enough, I
had to change the name of the "move" function pointer in files.c
because curses.h defined a move() macro (though I suppose I could have
undef'ed that too). Finally, just to get rid of a superfluous warning,
I decided to make the supplemental function gethostbyname2() not be
defined "static" since Solaris actually defines the prototype for this
function but then doesn't seem to include it in a library anywhere.

I haven't checked this in yet.  Comments?

..wayne..
Index: Src/system.h
@@ -286,6 +286,9 @@
 # include <sys/filio.h>
 #endif
 
+#ifdef HAVE_CURSES_H
+# include <curses.h>
+#endif
 #ifdef HAVE_TERMIOS_H
 # ifdef __sco
    /* termios.h includes sys/termio.h instead of sys/termios.h; *
@@ -315,6 +318,15 @@
 #else
 # ifdef HAVE_TERM_H
 #  include <term.h>
+# endif
+# ifdef tab
+#  undef tab
+# endif
+# ifdef columns
+#  undef columns
+# endif
+# ifdef lines
+#  undef lines
 # endif
 #endif
 
Index: Src/Modules/files.c
@@ -185,7 +185,7 @@
 static int
 bin_ln(char *nam, char **args, char *ops, int func)
 {
-    MoveFunc move;
+    MoveFunc movefunc;
     int flags, err = 0;
     char **a, *ptr, *rp, *buf;
     struct stat st;
@@ -193,18 +193,18 @@
 
 
     if(func == BIN_MV) {
-	move = (MoveFunc) rename;
+	movefunc = (MoveFunc) rename;
 	flags = ops['f'] ? 0 : MV_ASKNW;
 	flags |= MV_ATOMIC;
     } else {
 	flags = ops['f'] ? MV_FORCE : 0;
 #ifdef HAVE_LSTAT
 	if(ops['s'])
-	    move = (MoveFunc) symlink;
+	    movefunc = (MoveFunc) symlink;
 	else
 #endif
 	{
-	    move = (MoveFunc) link;
+	    movefunc = (MoveFunc) link;
 	    if(!ops['d'])
 		flags |= MV_NODIRS;
 	}
@@ -228,7 +228,7 @@
 	else
 	    args[1] = args[0];
     }
-    return domove(nam, move, args[0], args[1], flags);
+    return domove(nam, movefunc, args[0], args[1], flags);
  havedir:
     buf = ztrdup(*a);
     *a = NULL;
@@ -244,7 +244,7 @@
 
 	buf[blen] = 0;
 	buf = appstr(buf, ptr);
-	err |= domove(nam, move, *args, buf, flags);
+	err |= domove(nam, movefunc, *args, buf, flags);
     }
     zsfree(buf);
     return err;
@@ -252,7 +252,7 @@
 
 /**/
 static int
-domove(char *nam, MoveFunc move, char *p, char *q, int flags)
+domove(char *nam, MoveFunc movefunc, char *p, char *q, int flags)
 {
     struct stat st;
     char *pbuf, *qbuf;
@@ -302,7 +302,7 @@
 	if(doit && !(flags & MV_ATOMIC))
 	    unlink(qbuf);
     }
-    if(move(pbuf, qbuf)) {
+    if(movefunc(pbuf, qbuf)) {
 	zwarnnam(nam, "%s: %e", p, errno);
 	zsfree(pbuf);
 	return 1;
Index: Src/Modules/terminfo.c
@@ -34,9 +34,6 @@
 
 /**/
 #ifdef HAVE_TIGETSTR
-# ifdef HAVE_CURSES_H
-#  include <curses.h>
-# endif
 
 static Param terminfo_pm;
 
Index: Src/Modules/zftp.c
@@ -220,7 +220,7 @@
 # ifndef HAVE_GETHOSTBYNAME2
 
 /**/
-static struct hostent *
+struct hostent *
 gethostbyname2(char const *name, int af)
 {
 	if(af != AF_INET) {


Messages sorted by: Reverse Date, Date, Thread, Author