diff -urp tde51v/config.c linux64/config.c
--- tde51v/config.c	2006-02-19 15:08:42 +1000
+++ linux64/config.c	2019-01-02 22:03:17 +1000
@@ -88,6 +88,8 @@ static const char *process_menu( char *,
 static const char *new_menu_item( MENU_STR *, char *, char * );
 static void free_menu( MENU_STR * );
 
+static char User_str[] = "User";
+
 
 /*
  * Name:    tdecfgfile
@@ -203,7 +205,7 @@ int  i, j;
    }
 
    if (user_idx == -1)
-      process_menu( NULL, "User" );
+      process_menu( NULL, User_str );
    if (user_menu && user_menu->minor_cnt == 0)
       new_user_menu( NULL, (char*)config32, FALSE );  /* <Empty> */
 
@@ -890,7 +892,7 @@ const char *errmsg = NULL;
             case UserMenu :
                mode_no = OK;
                if (user_idx == -1)
-                  process_menu( NULL, "User" );
+                  process_menu( NULL, User_str );
                errmsg = new_user_menu( residue, key, FALSE );
                break;
 
@@ -1861,8 +1863,10 @@ static int exists = FALSE;
          if (shl) {
             user_menu->minor[cnt-1] = user_menu->minor[cnt-2];
             i = cnt - 2;
-         } else for (i = cnt - 1; i >= cnt - 3; --i)
-            user_menu->minor[i] = user_menu->minor[i-1];
+         } else {
+            for (i = cnt; --i >= cnt - 3;)
+               user_menu->minor[i] = user_menu->minor[i-1];
+         }
       }
    }
    if (i) {
@@ -1985,7 +1989,7 @@ static int  erred = FALSE;
             if (menu[i].major_name == NULL)
                return( main4 );
             cmenu = &menu[i].menu;
-            if (token == "User" ||
+            if (strcmp( token, "User" ) == 0  ||
                 (parse_token( line, token ), stricmp( token, "User" )) == 0) {
                user_idx = i;
                user_menu = &menu[user_idx].menu;
diff -urp tde51v/makefile linux64/makefile
--- tde51v/makefile	2005-09-20 15:18:22 +1000
+++ linux64/makefile	2019-01-02 22:03:49 +1000
@@ -19,9 +19,9 @@
 #
 
 # Define the system for which to compile.
-OS = djgpp
+#OS = djgpp
 #OS = win32
-#OS = unix
+OS = unix
 
 # Location to place the executable/binary file.
 ifeq ($(OS),djgpp)
@@ -56,7 +56,7 @@ endif
 
 CFLAGS	= -Wall -g
 CFLAGS += -O2 -finline-functions
-CFLAGS += -mtune=pentiumpro -fomit-frame-pointer
+#CFLAGS += -mtune=pentiumpro -fomit-frame-pointer
 CFLAGS += -DNDEBUG
 
 ifeq ($(OS),unix)
diff -urp tde51v/memory.c linux64/memory.c
--- tde51v/memory.c	2005-08-10 10:49:38 +1000
+++ linux64/memory.c	2019-01-02 22:03:17 +1000
@@ -63,7 +63,7 @@ static int  *group = NULL;
 #define MAX_SPACE (1 + MAX_SIZE + 1)
 
 #define WORD( p )  *(unsigned short*)(p)
-#define DWORD( p ) *(unsigned long*)(p)
+#define DWORD( p ) *(unsigned int*)(p)
 
 #define FREE( p )  (*(p) & (MAX_CHAR + 1))
 #define SIZE(p)  (*(p) == -1 ? WORD((p)+1+2*SUS) : ((*(p)&MAX_CHAR)+MIN_SPACE))
diff -urp tde51v/pull.c linux64/pull.c
--- tde51v/pull.c	2005-09-22 12:32:30 +1000
+++ linux64/pull.c	2019-01-02 22:03:15 +1000
@@ -832,14 +832,6 @@ int  pos;
 int  seps;
 int  inner[10];
 int  j;
-static const char *fc, *fc2;
-static int  frame = -1;
-
-   if (frame != g_display.frame_style) {
-      frame = g_display.frame_style;
-      fc = graphic_char[frame];
-      fc2 = (frame < 3) ? fc : graphic_char[2];
-   }
 
    cnt   = menu->minor_cnt;
    pos   = 0;                          /* Position into windowletters */
diff -urp tde51v/regx.c linux64/regx.c
--- tde51v/regx.c	2005-10-18 16:07:16 +1000
+++ linux64/regx.c	2019-01-02 22:03:18 +1000
@@ -628,31 +628,31 @@ int  rc;
                   break;
                return( ERROR );
             case WHITESPACE :
-               if (c != EOF  &&  !bj_isspace( c ) == nfa_pointer->c[state])
+               if (c != EOF  &&  (!bj_isspace( c )) == nfa_pointer->c[state])
                   break;
                return( ERROR );
             case ALPHA :
-               if (c != EOF  &&  !bj_isalpha( c ) == nfa_pointer->c[state])
+               if (c != EOF  &&  (!bj_isalpha( c )) == nfa_pointer->c[state])
                   break;
                return( ERROR );
             case UPPER :
-               if (c != EOF  &&  !bj_isupper( c ) == nfa_pointer->c[state])
+               if (c != EOF  &&  (!bj_isupper( c )) == nfa_pointer->c[state])
                   break;
                return( ERROR );
             case LOWER :
-               if (c != EOF  &&  !bj_islower( c ) == nfa_pointer->c[state])
+               if (c != EOF  &&  (!bj_islower( c )) == nfa_pointer->c[state])
                   break;
                return( ERROR );
             case ALPHANUM :
-               if (c != EOF  &&  !bj_isalnum( c ) == nfa_pointer->c[state])
+               if (c != EOF  &&  (!bj_isalnum( c )) == nfa_pointer->c[state])
                   break;
                return( ERROR );
             case DECIMAL :
-               if (c != EOF  &&  !bj_isdigit( c ) == nfa_pointer->c[state])
+               if (c != EOF  &&  (!bj_isdigit( c )) == nfa_pointer->c[state])
                   break;
                return( ERROR );
             case HEX :
-               if (c != EOF  &&  !bj_isxdigit( c ) == nfa_pointer->c[state])
+               if (c != EOF  &&  (!bj_isxdigit( c )) == nfa_pointer->c[state])
                   break;
                return( ERROR );
             case BOL :
@@ -1101,7 +1101,7 @@ int  bq = ERROR;
                   }
                   if (c2) {
                      for (c = 0; c <= 255; c++)
-                        if (!(bj_ctype[c] & c2) == c1)
+                        if ((!(bj_ctype[c] & c2)) == c1)
                            class_bits[c/8] |= bit[c%8];
                   } else {
                      c2 = c1;
diff -urp tde51v/undo.c linux64/undo.c
--- tde51v/undo.c	2003-11-17 10:47:26 +1000
+++ linux64/undo.c	2019-01-02 22:15:09 +1000
@@ -261,7 +261,7 @@ char c;
       undo->op    = op;
       undo->dirty = (int)window->ll->type & DIRTY;
       undo->mod   = file->modified;
-      undo->text  = (text_ptr)(int)ch;
+      undo->text  = (text_ptr)(long)ch;
    } else {
       if (undo->len == 1) {
          c = (char)(long)undo->text;
diff -urp tde51v/unix/console.c linux64/unix/console.c
--- tde51v/unix/console.c	2007-04-01 11:20:16 +1000
+++ linux64/unix/console.c	2019-01-02 22:03:15 +1000
@@ -64,8 +64,10 @@
 #include "tdefunc.h"
 #include "keys.h"
 #include <sys/ioctl.h>
+#if defined( __linux__ )
 #include <linux/kd.h>
 #include <sys/io.h>
+#endif
 
 
 #if defined( PC_CHARS )
@@ -78,7 +80,9 @@
 int  stdoutput;                 /* the redirected stdout */
 int  xterm;                     /* running in an xterm? */
 
+#if defined( __linux__ )
 static int  port_access;        /* is VGA IO allowed? */
+#endif
 
 
 static void set_colors( int );
@@ -114,6 +118,7 @@ char *term;
    page( 1 );
    video_config( cfg );
 
+#if defined( __linux__ )
    if (!xterm && cfg->color) {
       if (ioperm( 0x3c0, 0x1b, TRUE ) == 0) {
          port_access = TRUE;
@@ -122,6 +127,7 @@ char *term;
          outb( 0x04, 0x3c0 );   /* 9-bit chars, blink mode off */
       }
    }
+#endif
 }
 
 
@@ -526,11 +532,15 @@ int  waitkey( int enh_keyboard )
  */
 int  capslock_active( void )
 {
+#if defined( __linux__ )
 int  kbled;
 
    if (ioctl( 0, KDGKBLED, &kbled ) == -1)
       kbled = 0;
    return( kbled & LED_CAP );
+#else
+   return( 0 );
+#endif
 }
 
 
@@ -852,11 +862,13 @@ void set_cursor_size( int csize )
  */
 void set_overscan_color( int color )
 {
+#if defined( __linux__ )
    if (port_access) {
       inb( 0x3da );             /* switch flip-flop to index mode */
       outb( 0x31, 0x3c0 );      /* display enable, register 0x11 */
       outb( color, 0x3c0 );     /* overscan color */
    }
+#endif
 }
 
 
@@ -909,12 +921,10 @@ void restore_screen_line( int col, int l
  */
 void save_area( chtype *buffer, int wid, int len, int row, int col )
 {
-int  i;
-
    adjust_area( &wid, &len, &row, &col, NULL );
 
    len--;
-   for (i = 0; len >= 0; len--) {
+   for (; len >= 0; len--) {
       mvinchnstr( row+len, col, buffer, wid );
       buffer += wid;
    }
@@ -937,12 +947,10 @@ int  i;
  */
 void restore_area( chtype *buffer, int wid, int len, int row, int col )
 {
-int  i;
-
    adjust_area( &wid, &len, &row, &col, NULL );
 
    len--;
-   for (i = 0; len >= 0; len--) {
+   for (; len >= 0; len--) {
       mvaddchnstr( row+len, col, buffer, wid );
       buffer += wid;
    }
diff -urp tde51v/utils.c linux64/utils.c
--- tde51v/utils.c	2005-10-18 15:58:42 +1000
+++ linux64/utils.c	2019-01-02 22:27:47 +1000
@@ -1895,7 +1895,7 @@ ftime_t ftime;
       fh1  = dup( 1 );                  /* standard output */
       fh2  = dup( 2 );                  /* standard error */
       name = tmpnam( NULL );            /* unique temporary filename */
-      fh   = creat( name, 0200 );       /* S_IWUSR - don't make read-only */
+      fh   = creat( name, 0600 );       /* S_IWUSR | S_IRUSR */
       dup2( fh, 1 );
       dup2( fh, 2 );
    }
diff -urp tde51v/window.c linux64/window.c
--- tde51v/window.c	2007-05-01 16:04:58 +1000
+++ linux64/window.c	2019-01-02 22:03:18 +1000
@@ -812,6 +812,7 @@ int  i, j, rem;
    /*
     * find all the visible windows that share edges with this window
     */
+   vis_win[0] = NULL;
    top = g_display.mode_line;
    bot = 0;
    for (win = g_status.window_list; win != NULL; win = win->next) {
@@ -909,6 +910,7 @@ int  i, j, rem;
    /*
     * find all the visible windows that share edges with this window
     */
+   vis_win[0] = NULL;
    lft = g_display.ncols;
    ryt = 0;
    for (win = g_status.window_list; win != NULL; win = win->next) {
