diff -r 09c833b79ab0 conf/config/mts.c
--- a/conf/config/mts.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/conf/config/mts.c	Sat Feb 28 00:03:24 2009 +0900
@@ -33,10 +33,11 @@
 
 #define	NULLCP	((char *) 0)
 
-#ifdef __CYGWIN32__
+#if	defined(__CYGWIN32__) || defined(__GLIBC__)
 #include <errno.h>
+#else
+extern int  errno;
 #endif
-extern int  errno;
 
 static char   *tailor_value ();
 
diff -r 09c833b79ab0 config.guess
--- a/config.guess	Thu Jan 01 23:01:27 2009 +0900
+++ b/config.guess	Sat Feb 28 00:03:24 2009 +0900
@@ -640,6 +640,9 @@
 	  i?86)
 	    VENDOR=pc;
 	    ;;
+	  x86_64)
+	    VENDOR=pc;
+	    ;;
 	  *)
 	    VENDOR=unknown;
 	    ;;
diff -r 09c833b79ab0 config.sub
--- a/config.sub	Thu Jan 01 23:01:27 2009 +0900
+++ b/config.sub	Sat Feb 28 00:03:24 2009 +0900
@@ -165,13 +165,16 @@
 	i[34567]86)
 	  basic_machine=$basic_machine-pc
 	  ;;
+	x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
 	# Object if more than one company name word.
 	*-*-*)
 		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
 		exit 1
 		;;
 	# Recognize the basic CPU types with company name.
-	vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
+	vax-* | tahoe-* | i[34567]86-* | x86_64-* | i860-* | m32r-* | m68k-* | m68000-* \
 	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
 	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
 	      | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
diff -r 09c833b79ab0 h/mh.h
--- a/h/mh.h	Thu Jan 01 23:01:27 2009 +0900
+++ b/h/mh.h	Sat Feb 28 00:03:24 2009 +0900
@@ -253,7 +253,7 @@
 int     atooi ();
 char  **brkstring ();
 void	closefds ();
-char   *concat ();
+char   *concat (char *, ...);
 char   *copy ();
 char  **copyip ();
 void	cpydata ();
@@ -388,3 +388,8 @@
 char   *exthdr_encode ();
 char   *exthdr_decode ();
 #endif /* MIME_HEADERS */
+
+#if defined(linux)
+#include <stdio.h>
+#include <unistd.h>
+#endif
diff -r 09c833b79ab0 h/strings.h
--- a/h/strings.h	Thu Jan 01 23:01:27 2009 +0900
+++ b/h/strings.h	Sat Feb 28 00:03:24 2009 +0900
@@ -24,8 +24,8 @@
 #define	rindex	strrchr
 #endif /* SYS5 */
 
-#if defined(BSD42) || defined(SVR4) || defined(hpux) || defined(__osf__)
-#if !defined(SVR4) && !defined(__386BSD__) && !defined(BSD44)
+#if defined(BSD42) || defined(SVR4) || defined(hpux) || defined(__osf__) || defined(linux)
+#if !defined(SVR4) && !defined(__386BSD__) && !defined(BSD44) && !defined(linux)
 #include <strings.h>
 #else
 #include <string.h>
@@ -55,7 +55,7 @@
 char   *strncpy ();
 #endif
 
-#if !defined(SVR4) && !defined(__386BSD__) && !defined(BSD44)
+#if !defined(SVR4) && !defined(__386BSD__) && !defined(BSD44) && !defined(linux)
 char   *getenv ();
 char   *calloc (), *malloc (), *realloc ();
 #endif	/* SVR4 */
diff -r 09c833b79ab0 sbr/advertise.c
--- a/sbr/advertise.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/sbr/advertise.c	Sat Feb 28 00:03:24 2009 +0900
@@ -15,10 +15,11 @@
    output...  More importantly though, it's a sexy syscall()...
  */
 
-#ifdef __CYGWIN32__
+#if	defined(__CYGWIN32__) || defined(__GLIBC__)
 #include <errno.h>
+#else
+extern int  errno;
 #endif
-extern int  errno;
 #if !defined(BSD44) && !defined(__GNU_LIBRARY__)	/* in <stdio.h> */
 extern int  sys_nerr;
 extern char *sys_errlist[];
diff -r 09c833b79ab0 sbr/concat.c
--- a/sbr/concat.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/sbr/concat.c	Sat Feb 28 00:03:24 2009 +0900
@@ -2,34 +2,40 @@
 
 #include "../h/mh.h"
 #include <stdio.h>
-#include <varargs.h>
+#include <stdarg.h>
 
 
 /* VARARGS */
 
-char   *concat (va_alist)
-va_dcl
+char   *concat (char *first, ...)
 {
     register char  *cp,
                    *dp,
                    *sp;
     register unsigned   len;
-    register    va_list list;
+    va_list list;
 
     len = 1;
-    va_start (list); 
-    while (cp = va_arg (list, char *))
-	len += strlen (cp);
-    va_end (list);
+    if (first) {
+	    len += strlen (first);
+	    va_start (list, first);
+	    while (cp = va_arg (list, char *))
+		    len += strlen (cp);
+	    va_end (list);
+    }
 
     dp = sp = malloc (len);
     if (dp == NULL)
 	adios (NULLCP, "unable to allocate string storage");
 
-    va_start (list); 
-    while (cp = va_arg (list, char *))
-	sp = copy (cp, sp);
-    va_end (list);
+    *sp = '\0';
+    if (first) {
+	    sp = copy (first, sp);
+	    va_start (list, first);
+	    while (cp = va_arg (list, char *))
+		    sp = copy (cp, sp);
+	    va_end (list);
+    }
 
     return dp;
 }
diff -r 09c833b79ab0 sbr/ruserpass.c
--- a/sbr/ruserpass.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/sbr/ruserpass.c	Sat Feb 28 00:03:24 2009 +0900
@@ -25,9 +25,16 @@
 #include <ctype.h>
 #include <pwd.h>
 #include <errno.h>
+#if defined(linux)
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#endif
 
+#if !defined(linux)
 char	*malloc(), *index(), *getenv(), *getpass(), *getlogin();
 char	*strcpy();
+#endif
 static	FILE *cfile;
 
 #ifndef MAXHOSTNAMELEN
diff -r 09c833b79ab0 support/general/bootmhn.sh
--- a/support/general/bootmhn.sh	Thu Jan 01 23:01:27 2009 +0900
+++ b/support/general/bootmhn.sh	Sat Feb 28 00:03:24 2009 +0900
@@ -37,21 +37,24 @@
 fi
 
 PGM="`./bootmhn.findit xv $LIB`"
+if [ -z "$PGM" ]; then
+  PGM="`./bootmhn.findit display $LIB`"
+fi
 if [ ! -z "$PGM" ]; then
     echo "\
-mhn-show-image: %p$PGM -geometry =-0+0 '%f'" >> $TMP
-elif [ ! -z $"PBM" -a ! -z "$XWUD" ]; then
+mhn-show-image: %p$PGM -geometry -0+0 '%f'" >> $TMP
+elif [ ! -z "$PBM" -a ! -z "$XWUD" ]; then
     echo "\
-mhn-show-image/gif: %p${PBMDIR}giftoppm | ${PBMDIR}ppmtopgm | ${PBMDIR}pgmtopbm | ${PBMDIR}pbmtoxwd | $XWUD -geometry =-0+0
-mhn-show-image/x-pbm: %p${PBMDIR}pbmtoxwd | $XWUD -geometry =-0+0
-mhn-show-image/x-pgm: %p${PBMDIR}pgmtopbm | ${PBMDIR}pbmtoxwd | $XWUD -geometry =-0+0
-mhn-show-image/x-ppm: %p${PBMDIR}ppmtopgm | ${PBMDIR}pgmtopbm | ${PBMDIR}pbmtoxwd | $XWUD -geometry =-0+0
-mhn-show-image/x-xwd: %p$XWUD -geometry =-0+0" >> $TMP
+mhn-show-image/gif: %p${PBMDIR}giftoppm | ${PBMDIR}ppmtopgm | ${PBMDIR}pgmtopbm | ${PBMDIR}pbmtoxwd | $XWUD -geometry -0+0
+mhn-show-image/x-pbm: %p${PBMDIR}pbmtoxwd | $XWUD -geometry -0+0
+mhn-show-image/x-pgm: %p${PBMDIR}pgmtopbm | ${PBMDIR}pbmtoxwd | $XWUD -geometry -0+0
+mhn-show-image/x-ppm: %p${PBMDIR}ppmtopgm | ${PBMDIR}pgmtopbm | ${PBMDIR}pbmtoxwd | $XWUD -geometry -0+0
+mhn-show-image/x-xwd: %p$XWUD -geometry -0+0" >> $TMP
 
     PGM="`./bootmhn.findit djpeg $LIB`"
     if [ ! -z "$PGM" ]; then
 	echo "\
-mhn-show-image/jpeg: %p$PGM -Pg | ${PBMDIR}ppmtopgm | ${PBMDIR}pgmtopbm | ${PBMDIR}pbmtoxwd | $XWUD -geometry =-0+0" >> $TMP
+mhn-show-image/jpeg: %p$PGM -Pg | ${PBMDIR}ppmtopgm | ${PBMDIR}pgmtopbm | ${PBMDIR}pbmtoxwd | $XWUD -geometry -0+0" >> $TMP
     fi
 fi
 
diff -r 09c833b79ab0 uip/ftpsbr.c
--- a/uip/ftpsbr.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/uip/ftpsbr.c	Sat Feb 28 00:03:24 2009 +0900
@@ -66,10 +66,11 @@
 
 /*  */
 
-#ifdef __CYGWIN32__
+#if	defined(__CYGWIN32__) || defined(__GLIBC__)
 #include <errno.h>
+#else
+extern	int	errno;
 #endif
-extern	int	errno;
 #if !defined(BSD44) && !defined(__GNU_LIBRARY__)
 extern	int	sys_nerr;
 extern	char   *sys_errlist[];
diff -r 09c833b79ab0 uip/msh.c
--- a/uip/msh.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/uip/msh.c	Sat Feb 28 00:03:24 2009 +0900
@@ -1564,6 +1564,10 @@
     return NULLCP;
 }
 
+#if (RL_VERSION_MAJOR >= 5)
+#define completion_matches rl_completion_matches
+#endif
+
 char **
 msh_completion(text, start, end)
 char *text;
diff -r 09c833b79ab0 uip/picksbr.c
--- a/uip/picksbr.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/uip/picksbr.c	Sat Feb 28 00:03:24 2009 +0900
@@ -154,7 +154,7 @@
 static void	PRaction();
 static int	gcompile(), advance(), cclass(), tcompile();
 
-static struct	nexus *parse (), *exp1 (), *exp2 (), *exp3 (), *newnexus ();
+static struct	nexus *parse (), *exp_1 (), *exp_2 (), *exp_3 (), *newnexus ();
 
 static int	ORaction (), ANDaction (), NOTaction (), GREPaction (),
 		TWSaction ();
@@ -203,7 +203,7 @@
     register struct nexus  *n,
                            *o;
 
-    if ((n = exp1 ()) == NULL || (cp = nxtarg ()) == NULL)
+    if ((n = exp_1 ()) == NULL || (cp = nxtarg ()) == NULL)
 	return n;
 
     if (*cp != '-') {
@@ -240,12 +240,12 @@
 
 /*  */
 
-static struct nexus *exp1 () {
+static struct nexus *exp_1 () {
     register char  *cp;
     register struct nexus  *n,
                            *o;
 
-    if ((n = exp2 ()) == NULL || (cp = nxtarg ()) == NULL)
+    if ((n = exp_2 ()) == NULL || (cp = nxtarg ()) == NULL)
 	return n;
 
     if (*cp != '-') {
@@ -268,7 +268,7 @@
 	case PRAND: 
 	    o = newnexus (ANDaction);
 	    o -> n_L_child = n;
-	    if (o -> n_R_child = exp1 ())
+	    if (o -> n_R_child = exp_1 ())
 		return o;
 	    padvise (NULLCP, "missing conjunctive");
 	    return NULL;
@@ -282,7 +282,7 @@
 
 /*  */
 
-static struct nexus *exp2 () {
+static struct nexus *exp_2 () {
     register char  *cp;
     register struct nexus  *n;
 
@@ -291,7 +291,7 @@
 
     if (*cp != '-') {
 	prvarg ();
-	return exp3 ();
+	return exp_3 ();
     }
 
     if (*++cp == '-')
@@ -308,7 +308,7 @@
 
 	case PRNOT: 
 	    n = newnexus (NOTaction);
-	    if (n -> n_L_child = exp3 ())
+	    if (n -> n_L_child = exp_3 ())
 		return n;
 	    padvise (NULLCP, "missing negation");
 	    return NULL;
@@ -316,13 +316,13 @@
 header: ;
 	default: 
 	    prvarg ();
-	    return exp3 ();
+	    return exp_3 ();
     }
 }
 
 /*  */
 
-static struct nexus *exp3 () {
+static struct nexus *exp_3 () {
     int     i;
     register char  *cp,
                    *dp;
@@ -445,7 +445,7 @@
 		padvise (NULLCP, "missing argument to %s", argp[-2]);
 		return NULL;
 	    }
-	    return exp3 ();
+	    return exp_3 ();
 
 	case PRAFTR: 
 	case PRBEFR: 
diff -r 09c833b79ab0 uip/popsbr.c
--- a/uip/popsbr.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/uip/popsbr.c	Sat Feb 28 00:03:24 2009 +0900
@@ -27,10 +27,11 @@
 #define	TRM	"."
 #define	TRMLEN	(sizeof TRM - 1)
 
-#ifdef __CYGWIN32__
+#if	defined(__CYGWIN32__) || defined(__GLIBC__)
 #include <errno.h>
+#else
+extern int  errno;
 #endif
-extern int  errno;
 #if !defined(BSD44) && !defined(__GNU_LIBRARY__)
 extern int  sys_nerr;
 extern char *sys_errlist[];
diff -r 09c833b79ab0 uip/replsbr.c
--- a/uip/replsbr.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/uip/replsbr.c	Sat Feb 28 00:03:24 2009 +0900
@@ -195,11 +195,12 @@
 			}
 		    } while (cptr = cptr->c_next);
 
-		while (state == FLDPLUS)
+		while (state == FLDPLUS) {
 		    state = m_getfld (state, name, tmpbuf, SBUFSIZ, inb);
 #ifdef JAPAN
 	            (void) ml_conv(tmpbuf);
 #endif /* JAPAN */
+		}
 		break;
 
 	    case LENERR: 
diff -r 09c833b79ab0 uip/trmsbr.c
--- a/uip/trmsbr.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/uip/trmsbr.c	Sat Feb 28 00:03:24 2009 +0900
@@ -26,6 +26,9 @@
 #define	TXTSIZ	BUFSIZ
 #endif
 
+#if defined(linux)
+#include	<termcap.h>
+#else
 #ifndef	SYS5
 extern char PC;
 extern short    ospeed;
@@ -33,6 +36,7 @@
 char	PC;
 short	ospeed;
 #endif	/* SYS5 */
+#endif
 
 int     tgetent (), tgetnum ();
 char   *tgetstr ();
diff -r 09c833b79ab0 uip/vmh.c
--- a/uip/vmh.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/uip/vmh.c	Sat Feb 28 00:03:24 2009 +0900
@@ -116,6 +116,16 @@
 
 #define	XYZ			/* XXX */
 
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 5)
+struct ldat
+{
+	NCURSES_CH_T	*text;
+	NCURSES_SIZE_T	firstchar;
+	NCURSES_SIZE_T	lastchar;
+	NCURSES_SIZE_T	oldindex;
+};
+#endif
+
 /*  */
 
 static struct swit switches[] = {
@@ -1393,6 +1403,20 @@
     }
 #endif /* __NetBSD__ */
 #else /* __NCURSES_H */
+#ifdef __linux__
+    {
+	int i, cur;
+	if ((lp -> l_buf = (char *) malloc(getmaxx(w) + 1)) == NULL)
+	    adios (NULLCP, "unable to allocate storage");
+	cur = getcurx(w);
+	for (i = 0; i < getmaxx(w); i++) {
+	    wmove(w, getcury(w), i);
+	    lp -> l_buf[i] = winch(w); /* 8bit ?? */
+	}
+	lp -> l_buf[getmaxx(w)] = '\0';
+	wmove(w, getcury(w), cur);
+    }
+#else /* __linux__ */
     {
 	int i;
 	if ((lp -> l_buf = (char *) malloc(w -> _maxx + 2)) == NULL)
@@ -1401,6 +1425,7 @@
 	    lp -> l_buf[i] = (char) w -> _line[w -> _cury].text[i];
 	lp -> l_buf[w -> _maxx + 1] = '\0';
     }
+#endif /* __linux__ */ 
 #endif /* __NCURSES_H */
     for (cp = lp -> l_buf + strlen (lp -> l_buf) - 1; cp >= lp -> l_buf; cp--)
 	if (isspace (*cp))
diff -r 09c833b79ab0 uip/vmhsbr.c
--- a/uip/vmhsbr.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/uip/vmhsbr.c	Sat Feb 28 00:03:24 2009 +0900
@@ -24,10 +24,11 @@
 static	int PEERrfd = NOTOK;
 static	int PEERwfd = NOTOK;
 
-#ifdef __CYGWIN32__
+#if	defined(__CYGWIN32__) || defined(__GLIBC__)
 #include <errno.h>
+#else
+extern int  errno;
 #endif
-extern int  errno;
 #if !defined(BSD44) && !defined(__GNU_LIBRARY__)
 extern int  sys_nerr;
 extern char *sys_errlist[];
diff -r 09c833b79ab0 zotnet/tws/date.c
--- a/zotnet/tws/date.c	Thu Jan 01 23:01:27 2009 +0900
+++ b/zotnet/tws/date.c	Sat Feb 28 00:03:24 2009 +0900
@@ -2,6 +2,9 @@
 
 #include "tws.h"
 #include <stdio.h>
+#if defined(linux)
+#include <stdlib.h>
+#endif
 
 
 /* ARGSUSED */
