bug-bash
[Top][All Lists]
Advanced

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

bash and sco unix 3.2v4 and 3.2v5


From: William Bader
Subject: bash and sco unix 3.2v4 and 3.2v5
Date: Fri, 12 Oct 2001 23:43:27 EDT

I built bash-2.05a-beta1 with the changes below under RH Linux 7.1,
SCO ODT 2.0 + gcc-2.7.2.1 (ODT 2.0 is a bundle based on SCO Unix 3.2v4.0),
and SCO OpenServer 3.2v5.0.5 + SCO cc.

The mailstat.c change is for SCO ODT 2.0.
Its stat does not have a st_blocks field.
I looks like nothing in bash uses that field,
so I removed the references to it in mailstat.
Is that something that ./configure could check?

The alloca.c change is for SCO OpenServer v5.
Bash-2.05a changed an "int" into a "size_t", but using size_t requires
including <sys/types.h>.  I think that no one noticed this because
Linux builds use gcc (which contains a built-in alloca) and do not
require compiling alloca.c.

The rltty.c change to use TCSANOW instead of TCSADRAIN makes the bash
prompt display faster when on a SCO unix system or telnetting through one.
Without this change, if I hit <return> fast a few times in a row,
the newlines echo and then I get a sequence of bash prompts.
With the change, bash can keep up.

The readline.c change make ^R work so that what ever I have already
typed becomes the initial search string.

The link.sh script is for Xenix cross builds under SCO.
I haven't tested it recently because our Xenix systems no longer run.

William Bader
http://williambader.com

--- bash-2.05a-beta1/lib/sh/mailstat.c- Tue Sep  4 11:53:40 2001
+++ bash-2.05a-beta1/lib/sh/mailstat.c  Fri Oct 12 18:14:06 2001
@@ -33,6 +33,10 @@
 
 #include <maxpath.h>
 
+#ifdef M_UNIX
+#define        BLOCKS_MISSING 1
+#endif
+
 /*
  *     Stat a file. If it's a maildir, check all messages
  *     in the maildir and present the grand total as a file.
@@ -81,7 +85,9 @@
   st_ret = *st;
   st_ret.st_nlink = 1;
   st_ret.st_size  = 0;
+#ifndef BLOCKS_MISSING
   st_ret.st_blocks  = 0;
+#endif
   st_ret.st_mode  &= ~S_IFDIR;
   st_ret.st_mode  |= S_IFREG;
 
@@ -130,7 +136,9 @@
          if (stat(file, &st_tmp) != 0)
            continue;
          st_ret.st_size += st_tmp.st_size;
+#ifndef BLOCKS_MISSING
          st_ret.st_blocks++;
+#endif
          if (st_tmp.st_atime != st_tmp.st_mtime && st_tmp.st_atime > atime)
            atime = st_tmp.st_atime;
          if (st_tmp.st_mtime > mtime)
--- bash-2.05a-beta1/lib/malloc/alloca.c-       Tue Sep 18 13:13:26 2001
+++ bash-2.05a-beta1/lib/malloc/alloca.c        Fri Oct 12 20:37:08 2001
@@ -23,6 +23,7 @@
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
+#include "bashtypes.h" /* get sys/types.h to define size_t */
 #endif
 
 /* If compiling with GCC 2, this file's not needed.  */
--- bash-2.05a-beta1/lib/readline/rltty.c-      Wed Sep 19 15:29:50 2001
+++ bash-2.05a-beta1/lib/readline/rltty.c       Thu Oct 11 20:25:51 2001
@@ -378,7 +378,7 @@
 #  define TIOTYPE struct termios
 #  define DRAIN_OUTPUT(fd)     tcdrain (fd)
 #  define GETATTR(tty, tiop)   (tcgetattr (tty, tiop))
-#  ifdef M_UNIX
+#  if defined(M_UNIX) || defined(sun) || defined(__linux__)
 #    define SETATTR(tty, tiop) (tcsetattr (tty, TCSANOW, tiop))
 #  else
 #    define SETATTR(tty, tiop) (tcsetattr (tty, TCSADRAIN, tiop))
--- bash-2.05a-beta1/lib/readline/isearch.c-    Mon Sep 10 07:54:49 2001
+++ bash-2.05a-beta1/lib/readline/isearch.c     Fri Oct 12 17:21:51 2001
@@ -182,6 +182,10 @@
      been set, we use that value, otherwise we use ESC and C-J. */
   char *isearch_terminators;
 
+#if 1  /* 26Jan93 - wb - make ^R in middle of line start with current text */
+  int pre_search = 0;
+#endif
+
   RL_SETSTATE(RL_STATE_ISEARCH);
   orig_point = rl_point;
   last_found_line = orig_line = where_history ();
@@ -223,8 +227,15 @@
 
   /* Initialize search parameters. */
   search_string = (char *)xmalloc (search_string_size = 128);
+#if 1  /* 26Jan93 - wb - presearch */
+  strncpy(search_string, &rl_line_buffer[0], 127);
+  search_string[127] = '\0';
+  search_string_index = strlen(search_string);
+  if (direction < 0 && rl_point > 0) { pre_search = 1; rl_point = 0; }
+#else
   *search_string = '\0';
   search_string_index = 0;
+#endif
   prev_line_found = (char *)0;         /* XXX */
 
   /* Normalize DIRECTION into 1 or -1. */
@@ -241,6 +252,9 @@
     {
       rl_command_func_t *f = (rl_command_func_t *)NULL;
 
+#if 1  /* 26Jan93 - wb - presearch */
+      if (pre_search) { c = -1; pre_search = 0; } else {
+#endif
       /* Read a key and decide how to proceed. */
       RL_SETSTATE(RL_STATE_MOREINPUT);
       c = rl_read_key ();
@@ -287,6 +301,9 @@
          rl_execute_next (c);
          break;
        }
+#if 1  /* 26Jan93 - wb - presearch */
+      }
+#endif
 
       switch (c)
        {
--- bash-2.05a-beta1/lib/readline/readline.c-   Thu Sep 27 11:37:34 2001
+++ bash-2.05a-beta1/lib/readline/readline.c    Thu Oct 11 20:25:51 2001
@@ -1775,6 +1775,11 @@
   if (!count)
     return 0;
 
+#if 1  /* 16Feb93 - wb - allow transpose on first char */
+  if (!rl_point && rl_end >= 2)
+    rl_point++;
+#endif
+
   if (!rl_point || rl_end < 2)
     {
       rl_ding ();
--- bash-2.05a-beta1/link.sh-   Thu Oct 11 20:25:51 2001
+++ bash-2.05a-beta1/link.sh    Thu Oct 11 20:25:51 2001
@@ -0,0 +1,84 @@
+:
+# link bash for Xenix under SCO Unix
+#
+# For xenix 2.2:
+#      CC="cc -xenix -lx" ./configure
+#      edit config.h:
+#              comment out the define for HAVE_DIRENT_H
+#              enable the define for HAVE_SYS_NDIR_H to 1
+#      make
+#      CC="cc -xenix -lx" ./link.sh
+#
+# For xenix 2.3:
+#      CC="cc -x2.3" ./configure
+#      make CFLAGS=-O
+#      CC="cc -x2.3" ./link.sh
+
+# set -x
+
+rm -f bash
+
+if [ -z "$CC" ]
+then
+       if [ -f /unix -a ! -f /xenix ]
+       then
+               CC="cc -xenix"
+       else
+               CC=gcc
+       fi
+fi
+
+try_dir=no
+try_23=no
+try_x=yes
+
+case "$CC" in
+*-ldir*) try_dir=yes ;;
+esac
+
+case "$CC" in
+*-lx*) try_23=no ; try_x=yes ;;
+esac
+
+case "$CC" in
+*-x2.3*|*-l2.3*) try_23=yes ; try_dir=yes ;;
+esac
+
+libs=
+try="socket"
+if [ $try_dir = yes ] ; then try="$try dir" ; fi
+if [ $try_23 = yes ] ; then try="$try 2.3" ; fi
+if [ $try_x = yes ] ; then try="$try x" ; fi
+for name in $try
+do
+       if [ -r "/lib/386/Slib${name}.a" ] ; then libs="$libs -l$name" ; fi
+done
+
+objs=
+
+for name in shell.o eval.o y.tab.o \
+general.o make_cmd.o print_cmd.o dispose_cmd.o execute_cmd.o variables.o \
+copy_cmd.o error.o expr.o flags.o nojobs.o subst.o hashcmd.o hashlib.o \
+mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o test.o \
+version.o alias.o array.o braces.o bracecomp.o bashhist.o bashline.o \
+getcwd.o siglist.o vprint.o oslib.o list.o stringlib.o locale.o \
+findcmd.o redir.o xmalloc.o
+do
+       if [ -f "$name" ]
+       then
+               objs="$objs $name"
+       else
+               echo "$0: $name not found"
+       fi
+done
+
+set -x
+
+$CC -o bash $objs \
+builtins/libbuiltins.a \
+lib/readline/libreadline.a lib/readline/libhistory.a \
+-ltermcap lib/glob/libglob.a lib/tilde/libtilde.a lib/malloc/libmalloc.a \
+lib/sh/libsh.a \
+$libs
+
+ls -l bash
--- bash-2.05a-beta1/shell.c-   Thu Sep 27 15:44:12 2001
+++ bash-2.05a-beta1/shell.c    Thu Oct 11 20:25:51 2001
@@ -72,7 +72,11 @@
 #endif
 
 #if !defined (HAVE_GETPW_DECLS)
+#if defined(M_UNIX) && defined(_PWD_H)
+  /* pwd.h has extern struct passwd *getpwnam(const char *); */
+#else
 extern struct passwd *getpwuid ();
+#endif
 #endif /* !HAVE_GETPW_DECLS */
 
 #if !defined (errno)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]