Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37704261
en ru br
Репозитории ALT
S:8.2.1-alt1
5.1: 5.2.13-alt1
4.1: 5.2.11-alt1
4.0: 5.1.4-alt3
3.0: 4.3-alt7
www.altlinux.org/Changes

Группа :: Система/Библиотеки
Пакет: readline

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: readline-8.2.1-alt1.patch
Скачать


 Makefile.in                | 26 +++++++++++++-------------
 bind.c                     |  7 +++----
 complete.c                 | 15 +++++++--------
 display.c                  | 37 +++++++++++++++++++++++++------------
 examples/Makefile.in       |  8 ++++----
 examples/fileman.c         | 35 +++++++++++++++++++++++++++--------
 examples/hist_erasedups.c  |  4 ++--
 examples/histexamp.c       |  2 ++
 examples/rl-callbacktest.c |  2 +-
 examples/rl-timeout.c      |  2 --
 examples/rl.c              |  4 ++++
 examples/rlcat.c           |  5 ++---
 examples/rlfe/Makefile.in  |  4 ++--
 funmap.c                   |  3 ++-
 histexpand.c               |  5 ++---
 histfile.c                 | 20 +++++++++++++++-----
 history.c                  |  5 ++---
 history.h                  |  1 +
 histsearch.c               |  2 +-
 input.c                    | 12 ++++++++----
 isearch.c                  | 10 +++++-----
 kill.c                     | 13 ++++++++-----
 mbutil.c                   |  3 ++-
 misc.c                     |  8 ++++----
 nls.c                      | 34 +++++++++++-----------------------
 parens.c                   |  6 +++---
 parse-colors.c             |  3 +++
 parse-colors.h             |  3 ---
 readline.c                 | 14 +++++++++-----
 readline.h                 |  1 +
 search.c                   |  3 ---
 shell.c                    | 21 ++++++++++++++++-----
 shlib/Makefile.in          | 16 +++++++++++-----
 signals.c                  |  3 +--
 support/shobj-conf         |  2 +-
 text.c                     |  9 +++++++--
 tilde.c                    |  2 +-
 undo.c                     |  7 ++++---
 vi_mode.c                  | 14 ++++----------
 39 files changed, 214 insertions(+), 157 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 2120daa..2a39447 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -81,8 +81,6 @@ CPPFLAGS = @CPPFLAGS@
 DEFS = @DEFS@ @CROSS_COMPILE@
 LOCAL_DEFS = @LOCAL_DEFS@
 
-TERMCAP_LIB = @TERMCAP_LIB@
-
 # For libraries which include headers from other libraries.
 INCLUDES = -I. -I$(srcdir)
 
@@ -181,15 +179,18 @@ libhistory.a: $(HISTOBJ) xmalloc.o xfree.o
 	$(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o xfree.o
 	-test -n "$(RANLIB)" && $(RANLIB) $@
 
+map: $(INSTALLED_HEADERS) rlprivate.h rlmbutil.h
+	{ printf '{\n global:\n' && \
+	  sed -n '/^extern[[:space:]]\+\(\/\*[^*]*\*\/[[:space:]]*\)\?\([[:alnum:]_].*\)/ {s//\2/; s/[[:space:]]*\(PARAMS\|__attribute__\)(.*//; s/([^_].*//; s/\/\*.*//; s/[][)(*,;]//g; s/\<\(const\|volatile\)[[:space:]]\+//g; s/^[[:alnum:]_]\+[[:space:]]\+//; s/^\(char\|int\|long\)[[:space:]]\+//; s/[[:space:]]\+$$//; s/[[:space:]]\+/;&/g; s/.\+/  &;/; p}' $+ && \
+	  printf '  sh_*;\n local: *;\n};\n'; \
+	} > $@-t && mv $@-t $@
+
 # Since tilde.c is shared between readline and bash, make sure we compile
 # it with the right flags when it's built as part of readline
 tilde.o:	tilde.c
 	rm -f $@
 	$(CC) $(CCFLAGS) -DREADLINE_LIBRARY -c $(srcdir)/tilde.c
 
-readline: $(OBJECTS) readline.h rldefs.h chardefs.h ./libreadline.a
-	$(CC) $(CCFLAGS) -DREADLINE_LIBRARY -o $@ $(top_srcdir)/examples/rl.c ./libreadline.a ${TERMCAP_LIB}
-
 lint:	force
 	$(MAKE) $(MFLAGS) CCFLAGS='$(GCC_LINT_CFLAGS)' static
 
@@ -214,17 +215,17 @@ stamp-h: config.status $(srcdir)/config.h.in
 #	cd $(srcdir) && autoconf	## Comment-me-out in distribution
 
 
-shared:	force
+shared:	map force
 	-test -d shlib || mkdir shlib
-	( cd shlib ; ${MAKE} ${MFLAGS} all )
+	${MAKE} -C shlib ${MFLAGS} all
 
 documentation: force
 	-test -d doc || mkdir doc
-	-( cd doc && $(MAKE) $(MFLAGS) )
+	${MAKE} -C doc ${MFLAGS} info
 
-examples: force
+examples: shared
 	-test -d examples || mkdir examples
-	-(cd examples && ${MAKE} ${MFLAGS} all )
+	LD_LIBRARY_PATH="`pwd`/shlib" ${MAKE} -C examples ${MFLAGS} all
 
 force:
 
@@ -276,9 +277,8 @@ install-shared: installdirs install-headers shared install-doc install-pc
 uninstall-shared: maybe-uninstall-headers maybe-uninstall-pc
 	-( cd shlib; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
 
-install-examples: installdirs install-headers
-	-( cd examples ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
-	
+install-examples: installdirs install-headers shared
+
 uninstall-examples: maybe-uninstall-headers
 	-( cd examples; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
 
diff --git a/bind.c b/bind.c
index 971116a..d1fc8b6 100644
--- a/bind.c
+++ b/bind.c
@@ -1319,7 +1319,7 @@ parser_if (char *args)
 #endif /* VI_MODE */
   else if (_rl_strnicmp (args, "version", 7) == 0)
     {
-      int rlversion, versionarg, op, previ, major, minor, opresult;
+      int rlversion, versionarg, op, previ, major, minor, opresult = 0;
 
       _rl_parsing_conditionalized_out = 1;
       rlversion = RL_VERSION_MAJOR*10 + RL_VERSION_MINOR;
@@ -1578,7 +1578,7 @@ _rl_skip_to_delim (char *string, int start, int delim)
 {
   int i, c, passc;
 
-  for (i = start,passc = 0; c = string[i]; i++)
+  for (i = start,passc = 0; (c = string[i]); i++)
     {
       if (passc)
 	{
@@ -1672,7 +1672,6 @@ rl_parse_and_bind (char *string)
   if (_rl_stricmp (string, "set") == 0)
     {
       char *var, *value, *e;
-      int s;
 
       var = string + i;
       /* Make VAR point to start of variable name. */
@@ -2802,7 +2801,7 @@ rl_function_dumper (int print_readably)
 
   fprintf (rl_outstream, "\n");
 
-  for (i = 0; name = names[i]; i++)
+  for (i = 0; (name = names[i]); i++)
     {
       rl_command_func_t *function;
       char **invokers;
diff --git a/complete.c b/complete.c
index e5d224e..a07b997 100644
--- a/complete.c
+++ b/complete.c
@@ -933,7 +933,7 @@ fnprint (const char *to_print, int prefix_bytes, const char *real_pathname)
 static int
 print_filename (char *to_print, char *full_pathname, int prefix_bytes)
 {
-  int printed_len, extension_char, slen, tlen;
+  int printed_len = 0, extension_char, slen, tlen;
   char *s, c, *new_full_pathname, *dn;
 
   extension_char = 0;
@@ -1148,7 +1148,7 @@ _rl_find_completion_word (int *fp, int *dp)
       /* We didn't find an unclosed quoted substring upon which to do
          completion, so use the word break characters to find the
          substring on which to complete. */
-      while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
+      while ((rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY)))
 	{
 	  scan = rl_line_buffer[rl_point];
 
@@ -1320,7 +1320,6 @@ compute_lcd_of_matches (char **match_list, int matches, const char *text)
   int lx;
   char *dtext;		/* dequoted TEXT, if needed */
 #if defined (HANDLE_MULTIBYTE)
-  int v;
   size_t v1, v2;
   mbstate_t ps1, ps2;
   WCHAR_T wc1, wc2;
@@ -2004,7 +2003,7 @@ rl_complete_internal (int what_to_do)
   int start, end, delimiter, found_quote, i, nontrivial_lcd;
   char *text, *saved_line_buffer;
   char quote_char;
-  int tlen, mlen, saved_last_completion_failed;
+  int tlen = 0, mlen, saved_last_completion_failed;
 
   RL_SETSTATE(RL_STATE_COMPLETING);
 
@@ -2216,7 +2215,7 @@ rl_completion_matches (const char *text, rl_compentry_func_t *entry_function)
   match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
   match_list[1] = (char *)NULL;
 
-  while (string = (*entry_function) (text, matches))
+  while ((string = (*entry_function) (text, matches)))
     {
       if (RL_SIG_RECEIVED ())
 	{
@@ -2288,7 +2287,7 @@ rl_username_completion_function (const char *text, int state)
     }
 
 #if defined (HAVE_GETPWENT)
-  while (entry = getpwent ())
+  while ((entry = getpwent ()))
     {
       /* Null usernames should result in all users as possible completions. */
       if (namelen == 0 || (STREQN (username, entry->pw_name, namelen)))
@@ -2460,7 +2459,7 @@ rl_filename_completion_function (const char *text, int state)
   static char *dirname = (char *)NULL;
   static char *users_dirname = (char *)NULL;
   static int filename_len;
-  char *temp, *dentry, *convfn;
+  char *temp, *dentry = NULL, *convfn = NULL;
   int dirlen, dentlen, convlen;
   int tilde_dirname;
   struct dirent *entry;
@@ -2825,7 +2824,7 @@ rl_menu_complete (int count, int ignore)
   static int full_completion = 0;	/* set to 1 if menu completion should reinitialize on next call */
   static int orig_start, orig_end;
   static char quote_char;
-  static int delimiter, cstate;
+  static int delimiter;
 
   /* The first time through, we generate the list of matches and set things
      up to insert them. */
diff --git a/display.c b/display.c
index c1135ec..4477bd0 100644
--- a/display.c
+++ b/display.c
@@ -70,7 +70,9 @@ static void norm_face (char *, int);
 static void update_line (char *, char *, char *, char *, int, int, int, int);
 static void space_to_eol (int);
 static void delete_chars (int);
+#if 0
 static void insert_some_chars (char *, int, int);
+#endif
 static void open_some_spaces (int);
 static void cr (void);
 static void redraw_prompt (char *);
@@ -355,7 +357,10 @@ static char *
 expand_prompt (char *pmt, int flags, int *lp, int *lip, int *niflp, int *vlp)
 {
   char *r, *ret, *p, *igstart, *nprompt, *ms;
-  int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars;
+  int l, rl, last, ignoring, ninvis, invfl, invflset, physchars;
+#if defined (HANDLE_MULTIBYTE)
+  int ind, pind;
+#endif
   int mlen, newlines, newlines_guess, bound, can_add_invis;
   int mb_cur_max;
 
@@ -764,7 +769,7 @@ rl_redisplay (void)
 {
   int in, out, c, linenum, cursor_linenum;
   int inv_botlin, lb_botlin, lb_linenum, o_cpos;
-  int newlines, lpos, temp, n0, num, prompt_lines_estimate;
+  int newlines, lpos, temp;
   char *prompt_this_line;
   char cur_face;
   int hl_begin, hl_end;
@@ -772,7 +777,7 @@ rl_redisplay (void)
 #if defined (HANDLE_MULTIBYTE)
   WCHAR_T wc;
   size_t wc_bytes;
-  int wc_width;
+  int wc_width = 0;
   mbstate_t ps;
   int _rl_wrapped_multicolumn = 0;
 #endif
@@ -957,7 +962,6 @@ rl_redisplay (void)
 
 #if defined (HANDLE_MULTIBYTE)
   memset (line_state_invisible->wrapped_line, 0, line_state_invisible->wbsize * sizeof (int));
-  num = 0;
 #endif
 
   /* prompt_invis_chars_first_line is the number of invisible characters (bytes)
@@ -965,9 +969,6 @@ rl_redisplay (void)
      wrap_offset - prompt_invis_chars_first_line is usually the number of
      invis chars on the second (or, more generally, last) line. */
 
-  /* This is zero-based, used to set the newlines */
-  prompt_lines_estimate = lpos / _rl_screenwidth;
-
   /* what if lpos is already >= _rl_screenwidth before we start drawing the
      contents of the command line? */
   if (lpos >= _rl_screenwidth)
@@ -1652,7 +1653,10 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l
 {
   char *ofd, *ols, *oe, *nfd, *nls, *ne;
   char *ofdf, *nfdf, *olsf, *nlsf;
-  int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
+  int temp, lendiff, wsatend, od, nd;
+#if defined (HANDLE_MULTIBYTE)
+  int o_cpos;
+#endif
   int current_invis_chars;
   int col_lendiff, col_temp;
   int bytes_to_insert;
@@ -1783,8 +1787,7 @@ update_line (char *old, char *old_face, char *new, char *new_face, int current_l
 	     _rl_output_some_chars below. */
 	  if (newwidth > 0)
 	    {
-	      int count, i, j;
-	      char *optr;
+	      int i, j;
 
 	      puts_face (new, new_face, newbytes);
 	      _rl_last_c_pos = newwidth;
@@ -2219,7 +2222,9 @@ dumb_update:
 	}
     }
 
+#if defined (HANDLE_MULTIBYTE)
   o_cpos = _rl_last_c_pos;
+#endif
 
   /* When this function returns, _rl_last_c_pos is correct, and an absolute
      cursor position in multibyte mode, but a buffer index when not in a
@@ -2243,8 +2248,12 @@ dumb_update:
   lendiff = (nls - nfd) - (ols - ofd);
   if (mb_cur_max > 1 && rl_byte_oriented == 0)
     {
-      int newchars, newwidth, newind;
-      int oldchars, oldwidth, oldind;
+      int newchars, newwidth;
+      int oldchars, oldwidth;
+#if defined (HANDLE_MULTIBYTE)
+      int newind;
+      int oldind;
+#endif
 
       newchars = nls - new;
       oldchars = ols - old;
@@ -2719,8 +2728,10 @@ _rl_move_cursor_relative (int new, const char *data, const char *dataf)
   register int i;
   int woff;			/* number of invisible chars on current line */
   int cpos, dpos;		/* current and desired cursor positions */
+#if defined (HANDLE_MULTIBYTE)
   int adjust;
   int in_invisline;
+#endif
   int mb_cur_max = MB_CUR_MAX;
 
   woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
@@ -3235,12 +3246,14 @@ _rl_clear_screen (int clrscr)
 }
 
 /* Insert COUNT characters from STRING to the output stream at column COL. */
+#if 0
 static void
 insert_some_chars (char *string, int count, int col)
 {
   open_some_spaces (col);
   _rl_output_some_chars (string, count);
 }
+#endif
 
 /* Insert COL spaces, keeping the cursor at the same position.  We follow the
    ncurses documentation and use either im/ei with explicit spaces, or IC/ic
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 291c6b7..42b6270 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -55,15 +55,15 @@ INCLUDES = -I$(srcdir) -I$(top_srcdir) -I..
 
 CCFLAGS  = $(ASAN_CFLAGS) $(DEFS) $(LOCAL_CFLAGS) $(INCLUDES) $(CPPFLAGS) \
 	$(CFLAGS)
-LDFLAGS = -g -L.. @LDFLAGS@ $(ASAN_LDFLAGS)
+LDFLAGS = -L../shlib @LDFLAGS@ $(ASAN_LDFLAGS)
 
 ASAN_XCFLAGS = -fsanitize=address -fno-omit-frame-pointer
 ASAN_XLDFLAGS = -fsanitize=address
 
-READLINE_LIB = ../libreadline.a
-HISTORY_LIB = ../libhistory.a
+READLINE_LIB = ../shlib/libreadline.so
+HISTORY_LIB = ../shlib/libhistory.so
 
-TERMCAP_LIB = @TERMCAP_LIB@
+TERMCAP_LIB =
 
 .c.o:
 	${RM} $@
diff --git a/examples/fileman.c b/examples/fileman.c
index 2a8b097..152ee59 100644
--- a/examples/fileman.c
+++ b/examples/fileman.c
@@ -61,13 +61,32 @@
 #  include <readline/history.h>
 #endif
 
-extern char *xmalloc PARAMS((size_t));
+#include "xmalloc.h"
+
+static void
+memory_error_and_abort (const char *fname)
+{
+  fprintf (stderr, "%s: out of virtual memory\n", fname);
+  exit (2);
+}
+
+/* Return a pointer to free()able block of memory large enough
+   to hold BYTES number of bytes.  If the memory cannot be allocated,
+   print an error message and abort. */
+PTR_T
+xmalloc (size_t bytes)
+{
+  PTR_T temp = malloc (bytes);
+  if (temp == 0)
+    memory_error_and_abort ("xmalloc");
+  return (temp);
+}
 
 void initialize_readline PARAMS((void));
-void too_dangerous PARAMS((char *));
+void too_dangerous PARAMS((const char *));
 
 int execute_line PARAMS((char *));
-int valid_argument PARAMS((char *, char *));
+int valid_argument PARAMS((const char *, const char *));
 
 /* The names of functions that actually do the manipulation. */
 int com_list PARAMS((char *));
@@ -302,7 +321,7 @@ command_generator (text, state)
     }
 
   /* Return the next name which partially matches from the command list. */
-  while (name = commands[list_index].name)
+  while ((name = commands[list_index].name))
     {
       list_index++;
 
@@ -377,9 +396,9 @@ com_stat (arg)
 
   printf ("Statistics for `%s':\n", arg);
 
-  printf ("%s has %d link%s, and is %lu byte%s in length.\n",
+  printf ("%s has %lu link%s, and is %lu byte%s in length.\n",
 	  arg,
-          finfo.st_nlink,
+          (unsigned long)finfo.st_nlink,
           (finfo.st_nlink == 1) ? "" : "s",
           (unsigned long)finfo.st_size,
           (finfo.st_size == 1) ? "" : "s");
@@ -483,7 +502,7 @@ com_quit (arg)
 /* Function which tells you that you can't do this. */
 void
 too_dangerous (caller)
-     char *caller;
+     const char *caller;
 {
   fprintf (stderr,
            "%s: Too dangerous for me to distribute.  Write it yourself.\n",
@@ -494,7 +513,7 @@ too_dangerous (caller)
    an error message and return zero. */
 int
 valid_argument (caller, arg)
-     char *caller, *arg;
+     const char *caller, *arg;
 {
   if (!arg || !*arg)
     {
diff --git a/examples/hist_erasedups.c b/examples/hist_erasedups.c
index f820eba..69d12e6 100644
--- a/examples/hist_erasedups.c
+++ b/examples/hist_erasedups.c
@@ -96,11 +96,11 @@ main (argc, argv)
 int
 hist_erasedups ()
 {
-  int r, n;
+  int r = 0, n;
   HIST_ENTRY *h, *temp;
 
   using_history ();
-  while (h = previous_history ())
+  while ((h = previous_history ()))
     {
       r = where_history ();
       for (n = 0; n < r; n++)
diff --git a/examples/histexamp.c b/examples/histexamp.c
index 309d769..54d1c22 100644
--- a/examples/histexamp.c
+++ b/examples/histexamp.c
@@ -20,6 +20,7 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
 
 #ifdef READLINE_LIBRARY
 #  include "history.h"
@@ -125,4 +126,5 @@ main (argc, argv)
 	    }
 	}
     }
+    return 0;
 }
diff --git a/examples/rl-callbacktest.c b/examples/rl-callbacktest.c
index 7febacd..9c0f78d 100644
--- a/examples/rl-callbacktest.c
+++ b/examples/rl-callbacktest.c
@@ -26,7 +26,7 @@
 extern int errno;
 
 static void cb_linehandler (char *);
-static void signandler (int);
+static void sighandler (int);
 
 int running, sigwinch_received;
 const char *prompt = "rltest$ ";
diff --git a/examples/rl-timeout.c b/examples/rl-timeout.c
index b8a24ba..65f9ed7 100644
--- a/examples/rl-timeout.c
+++ b/examples/rl-timeout.c
@@ -191,8 +191,6 @@ cb_timeouthandler ()
 void
 rltest_timeout_callback2 ()
 {
-  int r;
-
   rl_set_timeout (timeout_secs, timeout_usecs);
   rl_timeout_event_hook = cb_timeouthandler;
   rl_callback_handler_install (prompt, cb_linehandler);
diff --git a/examples/rl.c b/examples/rl.c
index 39e5b8e..e3a3580 100644
--- a/examples/rl.c
+++ b/examples/rl.c
@@ -42,6 +42,10 @@ extern void exit();
 #  include <locale.h>
 #endif
 
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+
 #if defined (READLINE_LIBRARY)
 #  include "posixstat.h"
 #  include "readline.h"
diff --git a/examples/rlcat.c b/examples/rlcat.c
index f1b0362..e76d606 100644
--- a/examples/rlcat.c
+++ b/examples/rlcat.c
@@ -123,7 +123,7 @@ main (argc, argv)
     return stdcat(argc, argv);
 
   rl_variable_bind ("editing-mode", Vflag ? "vi" : "emacs");
-  while (temp = readline (""))
+  while ((temp = readline ("")))
     {
       if (*temp)
         add_history (temp);
@@ -159,8 +159,7 @@ stdcat (argc, argv)
      int argc;
      char **argv;
 {
-  int  i, fd, r;
-  char *s;
+  int  i, r;
   FILE *fp;
 
   if (argc == 0)
diff --git a/examples/rlfe/Makefile.in b/examples/rlfe/Makefile.in
index 7d6fd53..3533f9b 100644
--- a/examples/rlfe/Makefile.in
+++ b/examples/rlfe/Makefile.in
@@ -24,8 +24,8 @@ CC = @CC@
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CPPFLAGS@
 #LDFLAGS = -L$(READLINE_DIR)
-LDFLAGS = @LDFLAGS@
-LIBS = -lreadline -lhistory @LIBS@
+LDFLAGS = @LDFLAGS@ -L../../shlib
+LIBS = -lreadline
 
 CPP=@CPP@
 CPP_DEPEND=$(CC) -MM
diff --git a/funmap.c b/funmap.c
index 8b1cb40..9d0a467 100644
--- a/funmap.c
+++ b/funmap.c
@@ -268,6 +268,7 @@ rl_funmap_names (void)
       result[result_index + 1] = (char *)NULL;
     }
 
-  qsort (result, result_index, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
+  if (result)
+    qsort (result, result_index, sizeof (char *), (QSFUNC *)_rl_qsort_string_compare);
   return (result);
 }
diff --git a/histexpand.c b/histexpand.c
index 8ab6809..91b8fae 100644
--- a/histexpand.c
+++ b/histexpand.c
@@ -210,7 +210,7 @@ get_history_event (const char *string, int *caller_index, int delimiting_quote)
     }
 
   /* Only a closing `?' or a newline delimit a substring search string. */
-  for (local_index = i; c = string[i]; i++)
+  for (local_index = i; (c = string[i]); i++)
     {
 #if defined (HANDLE_MULTIBYTE)
       if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
@@ -679,7 +679,7 @@ history_expand_internal (char *string, int start, int qc, int *end_index_ptr, ch
 	case 's':
 	  {
 	    char *new_event;
-	    int delimiter, failed, si, l_temp, ws, we;
+	    int delimiter, failed, si, l_temp, we;
 
 	    if (c == 's')
 	      {
@@ -778,7 +778,6 @@ history_expand_internal (char *string, int start, int qc, int *end_index_ptr, ch
 		  {
 		    for (; temp[si] && fielddelim (temp[si]); si++)
 		      ;
-		    ws = si;
 		    we = history_tokenize_word (temp, si);
 		  }
 
diff --git a/histfile.c b/histfile.c
index 3bfec55..41745dc 100644
--- a/histfile.c
+++ b/histfile.c
@@ -139,9 +139,13 @@ int history_lines_written_to_file = 0;
    for more extensive tests. */
 #define HIST_TIMESTAMP_START(s)		(*(s) == history_comment_char && isdigit ((unsigned char)(s)[1]) )
 
+#if 0
 static char *history_backupfile (const char *);
+#endif
 static char *history_tempfile (const char *);
+#if 0
 static int histfile_backup (const char *, const char *);
+#endif
 static int histfile_restore (const char *, const char *);
 static int history_rename (const char *, const char *);
 
@@ -183,6 +187,7 @@ history_filename (const char *filename)
   return (return_val);
 }
 
+#if 0
 static char *
 history_backupfile (const char *filename)
 {
@@ -190,7 +195,6 @@ history_backupfile (const char *filename)
   char *ret, linkbuf[PATH_MAX+1];
   size_t len;
   ssize_t n;
-  struct stat fs;
 
   fn = filename;  
 #if defined (HAVE_READLINK)
@@ -210,6 +214,7 @@ history_backupfile (const char *filename)
   ret[len+1] = '\0';
   return ret;
 }
+#endif
   
 static char *
 history_tempfile (const char *filename)
@@ -218,7 +223,6 @@ history_tempfile (const char *filename)
   char *ret, linkbuf[PATH_MAX+1];
   size_t len;
   ssize_t n;
-  struct stat fs;
   int pid;
 
   fn = filename;  
@@ -469,6 +473,7 @@ history_rename (const char *old, const char *new)
 
 /* Save FILENAME to BACK, handling case where FILENAME is a symlink
    (e.g., ~/.bash_history -> .histfiles/.bash_history.$HOSTNAME) */
+#if 0
 static int
 histfile_backup (const char *filename, const char *back)
 {
@@ -485,6 +490,7 @@ histfile_backup (const char *filename, const char *back)
 #endif
   return (history_rename (filename, back));
 }
+#endif
 
 /* Restore ORIG from BACKUP handling case where ORIG is a symlink
    (e.g., ~/.bash_history -> .histfiles/.bash_history.$HOSTNAME) */
@@ -518,7 +524,7 @@ int
 history_truncate_file (const char *fname, int lines)
 {
   char *buffer, *filename, *tempname, *bp, *bp1;		/* bp1 == bp+1 */
-  int file, chars_read, rv, orig_lines, exists, r;
+  int file, chars_read, rv, orig_lines = 0, exists, r;
   struct stat finfo, nfinfo;
   size_t file_size;
 
@@ -662,7 +668,11 @@ history_truncate_file (const char *fname, int lines)
      with a shared history file, we don't want to leave the history file
      owned by root. */
   if (rv == 0 && exists && SHOULD_CHOWN (finfo, nfinfo))
-    r = chown (filename, finfo.st_uid, finfo.st_gid);
+    {
+      r = chown (filename, finfo.st_uid, finfo.st_gid);
+      if (r)
+        rv = errno;
+    }
 #endif
 
   xfree (filename);
@@ -680,7 +690,7 @@ history_do_write (const char *filename, int nelements, int overwrite)
   register int i;
   char *output, *tempname, *histname;
   int file, mode, rv, exists;
-  struct stat finfo, nfinfo;
+  struct stat finfo;
 #ifdef HISTORY_USE_MMAP
   size_t cursize;
 
diff --git a/history.c b/history.c
index 81d4c16..7c62542 100644
--- a/history.c
+++ b/history.c
@@ -283,8 +283,6 @@ add_history (const char *string)
 
   if (history_stifled && (history_length == history_max_entries))
     {
-      register int i;
-
       /* If the history is stifled, and history_length is zero,
 	 and it equals history_max_entries, we don't save items. */
       if (history_length == 0)
@@ -486,10 +484,11 @@ HIST_ENTRY *
 remove_history (int which)
 {
   HIST_ENTRY *return_value;
-  register int i;
 #if 1
   int nentries;
   HIST_ENTRY **start, **end;
+#else
+  register int i;
 #endif
 
   if (which < 0 || which >= history_length || history_length ==  0 || the_history == 0)
diff --git a/history.h b/history.h
index 5208f9a..ed4e4f7 100644
--- a/history.h
+++ b/history.h
@@ -32,6 +32,7 @@ extern "C" {
 #  include "rlstdc.h"
 #  include "rltypedefs.h"
 #else
+#  include <stdio.h>
 #  include <readline/rlstdc.h>
 #  include <readline/rltypedefs.h>
 #endif
diff --git a/histsearch.c b/histsearch.c
index b62c06b..4501281 100644
--- a/histsearch.c
+++ b/histsearch.c
@@ -209,7 +209,7 @@ _hs_history_patsearch (const char *string, int direction, int flags)
   ret = len - 1;
   /* fnmatch is required to reject a pattern that ends with an unescaped
      backslash */
-  if (unescaped_backslash = (string[ret] == '\\'))
+  if ((unescaped_backslash = (string[ret] == '\\')))
     {
       while (ret > 0 && string[--ret] == '\\')
 	unescaped_backslash = 1 - unescaped_backslash;
diff --git a/input.c b/input.c
index 6f038d4..b38831b 100644
--- a/input.c
+++ b/input.c
@@ -413,7 +413,10 @@ _rl_input_available (void)
 int
 _rl_nchars_available ()
 {
-  int chars_avail, fd, result;
+  int chars_avail;
+#if defined (FIONREAD)
+  int fd, result;
+#endif
   
   chars_avail = 0;
      
@@ -761,7 +764,7 @@ rl_read_key (void)
   else
     {
       /* If input is coming from a macro, then use that. */
-      if (c = _rl_next_macro_key ())
+      if ((c = _rl_next_macro_key ()))
 	return ((unsigned char)c);
 
       /* If the user has an event function, then call it periodically. */
@@ -806,8 +809,10 @@ rl_getc (FILE *stream)
   unsigned char c;
   int fd;
 #if defined (HAVE_PSELECT)
-  sigset_t empty_set;
   fd_set readfds;
+#  if !defined (HANDLE_SIGNALS)
+  sigset_t empty_set;
+#  endif
 #endif
 
   fd = fileno (stream);
@@ -877,7 +882,6 @@ rl_getc (FILE *stream)
 
 /* fprintf(stderr, "rl_getc: result = %d errno = %d\n", result, errno); */
 
-handle_error:
       /* If the error that we received was EINTR, then try again,
 	 this is simply an interrupted system call to read ().  We allow
 	 the read to be interrupted if we caught SIGHUP, SIGTERM, or any
diff --git a/isearch.c b/isearch.c
index c2d4d23..af6aa0b 100644
--- a/isearch.c
+++ b/isearch.c
@@ -340,7 +340,7 @@ _rl_search_getchar (_rl_search_cxt *cxt)
 int
 _rl_isearch_dispatch (_rl_search_cxt *cxt, int c)
 {
-  int n, wstart, wlen, limit, cval, incr;
+  int n, wstart, wlen, limit, cval;
   char *paste;
   size_t pastelen;
   int j;
@@ -845,7 +845,7 @@ static int
 rl_search_history (int direction, int invoking_key)
 {
   _rl_search_cxt *cxt;		/* local for now, but saved globally */
-  int c, r;
+  int r;
 
   RL_SETSTATE(RL_STATE_ISEARCH);
   cxt = _rl_isearch_init (direction);
@@ -860,7 +860,7 @@ rl_search_history (int direction, int invoking_key)
   r = -1;
   for (;;)
     {
-      c = _rl_search_getchar (cxt);
+      _rl_search_getchar (cxt);
       /* We might want to handle EOF here (c == 0) */
       r = _rl_isearch_dispatch (cxt, cxt->lastc);
       if (r <= 0)
@@ -882,9 +882,9 @@ rl_search_history (int direction, int invoking_key)
 int
 _rl_isearch_callback (_rl_search_cxt *cxt)
 {
-  int c, r;
+  int r;
 
-  c = _rl_search_getchar (cxt);
+  _rl_search_getchar (cxt);
   /* We might want to handle EOF here */
   r = _rl_isearch_dispatch (cxt, cxt->lastc);
 
diff --git a/kill.c b/kill.c
index 4cf933b..239ab3d 100644
--- a/kill.c
+++ b/kill.c
@@ -559,7 +559,10 @@ rl_yank_pop (int count, int key)
 int
 rl_vi_yank_pop (int count, int key)
 {
-  int l, n, origpoint;
+  int l, n;
+#if 0
+  int origpoint;
+#endif
 
   if (((rl_last_func != rl_vi_yank_pop) && (rl_last_func != rl_vi_put)) ||
       !rl_kill_ring)
@@ -756,8 +759,8 @@ _rl_bracketed_text (size_t *lenp)
 int
 rl_bracketed_paste_begin (int count, int key)
 {
-  int retval, c;
-  size_t len, cap;
+  int retval;
+  size_t len;
   char *buf;
 
   buf = _rl_bracketed_text (&len);
@@ -774,7 +777,7 @@ int
 _rl_read_bracketed_paste_prefix (int c)
 {
   char pbuf[BRACK_PASTE_SLEN+1], *pbpref;
-  int key, ind, j;
+  int key = 0, ind;
 
   pbpref = BRACK_PASTE_PREF;		/* XXX - debugging */
   if (c != pbpref[0])
@@ -846,7 +849,7 @@ _rl_bracketed_read_key ()
 int
 _rl_bracketed_read_mbstring (char *mb, int mlen)
 {
-  int c, r;
+  int c;
 
   c = _rl_bracketed_read_key ();
   if (c < 0)
diff --git a/mbutil.c b/mbutil.c
index 47e9100..4374ba2 100644
--- a/mbutil.c
+++ b/mbutil.c
@@ -83,6 +83,7 @@ int _rl_utf8locale = 0;
 
 /* Return the length in bytes of the possibly-multibyte character beginning
    at S. Encoding is UTF-8. */
+#if 0
 static int
 _rl_utf8_mblen (const char *s, size_t n)
 {
@@ -146,6 +147,7 @@ _rl_utf8_mblen (const char *s, size_t n)
   /* invalid or incomplete multibyte character */
   return -1;
 }
+#endif
 
 static int
 _rl_find_next_mbchar_internal (char *string, int seed, int count, int find_non_zero)
@@ -244,7 +246,6 @@ _rl_test_nonzero (char *string, int ind, int len)
 static int
 _rl_find_prev_utf8char (char *string, int seed, int find_non_zero)
 {
-  char *s;
   unsigned char b;
   int save, prev;
   size_t len;
diff --git a/misc.c b/misc.c
index 4bca9c5..fba27a5 100644
--- a/misc.c
+++ b/misc.c
@@ -237,6 +237,8 @@ rl_digit_argument (int ignore, int key)
       rl_execute_next (key);
       return (rl_digit_loop ());
     }
+
+  return 0;
 }
 
 /* C-u, universal argument.  Multiply the current argument by 4.
@@ -382,8 +384,6 @@ rl_maybe_save_line (void)
 int
 _rl_free_saved_history_line (void)
 {
-  UNDO_LIST *orig;
-
   if (_rl_saved_line_for_history)
     {
       if (rl_undo_list && rl_undo_list == (UNDO_LIST *)_rl_saved_line_for_history->data)
@@ -457,7 +457,7 @@ _rl_revert_previous_lines (void)
   entry = (hpos == history_length) ? previous_history () : current_history ();
   while (entry)
     {
-      if (ul = (UNDO_LIST *)entry->data)
+      if ((ul = (UNDO_LIST *)entry->data))
 	{
 	  if (ul == saved_undo_list)
 	    saved_undo_list = 0;
@@ -517,7 +517,7 @@ rl_clear_history (void)
   for (i = 0; i < history_length; i++)
     {
       hent = hlist[i];
-      if (ul = (UNDO_LIST *)hent->data)
+      if ((ul = (UNDO_LIST *)hent->data))
 	{
 	  if (ul == saved_undo_list)
 	    saved_undo_list = 0;
diff --git a/nls.c b/nls.c
index 8c027d6..e243c72 100644
--- a/nls.c
+++ b/nls.c
@@ -83,9 +83,10 @@ static char *legal_lang_values[] =
 };
 
 static char *normalize_codeset (char *);
-#endif /* !HAVE_SETLOCALE */
 
+#if !HAVE_LANGINFO_CODESET
 static char *find_codeset (char *, size_t *);
+#endif
 
 static char *_rl_get_locale_var (const char *);
 
@@ -102,12 +103,15 @@ _rl_get_locale_var (const char *v)
 
   return lspec;
 }
+#endif /* !HAVE_SETLOCALE */
 
 static int
 utf8locale (char *lspec)
 {
   char *cp;
+#if !HAVE_LANGINFO_CODESET
   size_t len;
+#endif
 
 #if HAVE_LANGINFO_CODESET
   cp = nl_langinfo (CODESET);
@@ -126,28 +130,10 @@ utf8locale (char *lspec)
 char *
 _rl_init_locale (void)
 {
-  char *ret, *lspec;
-
-  /* Set the LC_CTYPE locale category from environment variables. */
-  lspec = _rl_get_locale_var ("LC_CTYPE");
-  /* Since _rl_get_locale_var queries the right environment variables,
-     we query the current locale settings with setlocale(), and, if
-     that doesn't return anything, we set lspec to the empty string to
-     force the subsequent call to setlocale() to define the `native'
-     environment. */
-#if defined (HAVE_SETLOCALE)
-  if (lspec == 0 || *lspec == 0)
-    lspec = setlocale (LC_CTYPE, (char *)NULL);
-  if (lspec == 0)
-    lspec = "";
-  ret = setlocale (LC_CTYPE, lspec);	/* ok, since it does not change locale */
-  if (ret == 0 || *ret == 0)
-    ret = setlocale (LC_CTYPE, (char *)NULL);
-  if (ret == 0 || *ret == 0)
-    ret = RL_DEFAULT_LOCALE;
-#else
-  ret = (lspec == 0 || *lspec == 0) ? RL_DEFAULT_LOCALE : lspec;
-#endif
+  char *ret;
+
+  /* Query the LC_CTYPE locale category from the program's current locale. */
+  ret = setlocale (LC_CTYPE, NULL);
 
   _rl_utf8locale = (ret && *ret) ? utf8locale (ret) : 0;
 
@@ -282,6 +268,7 @@ normalize_codeset (char *codeset)
 #endif /* !HAVE_SETLOCALE */
 
 /* Isolate codeset portion of locale specification. */
+#if !HAVE_LANGINFO_CODESET
 static char *
 find_codeset (char *name, size_t *lenp)
 {
@@ -330,6 +317,7 @@ find_codeset (char *name, size_t *lenp)
 
   return result;
 }
+#endif
 
 void
 _rl_reset_locale (void)
diff --git a/parens.c b/parens.c
index 57ce704..7acee68 100644
--- a/parens.c
+++ b/parens.c
@@ -115,7 +115,7 @@ rl_insert_close (int count, int invoking_key)
   else
     {
 #if defined (HAVE_SELECT)
-      int orig_point, match_point, ready;
+      int orig_point, match_point;
       struct timeval timer;
       fd_set readfds;
 
@@ -136,9 +136,9 @@ rl_insert_close (int count, int invoking_key)
       rl_point = match_point;
       (*rl_redisplay_function) ();
 #  if defined (RL_TIMEOUT_USE_SELECT)
-      ready = _rl_timeout_select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer, NULL);
+      _rl_timeout_select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer, NULL);
 #  else
-      ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
+      select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
 #  endif
       rl_point = orig_point;
 #else /* !HAVE_SELECT */
diff --git a/parse-colors.c b/parse-colors.c
index 05ec9bc..08322d7 100644
--- a/parse-colors.c
+++ b/parse-colors.c
@@ -55,6 +55,9 @@
 #include "colors.h"
 #include "parse-colors.h"
 
+/* Buffer for color sequences */
+static char *color_buf;
+
 #if defined (COLOR_SUPPORT)
 
 static bool get_funky_string (char **dest, const char **src, bool equals_end, size_t *output_count);
diff --git a/parse-colors.h b/parse-colors.h
index aef86f7..3e1cee2 100644
--- a/parse-colors.h
+++ b/parse-colors.h
@@ -40,7 +40,4 @@ static const char *const indicator_name[]=
     "ow", "tw", "ca", "mh", "cl", NULL
   };
 
-/* Buffer for color sequences */
-static char *color_buf;
-
 #endif /* !_PARSE_COLORS_H_ */
diff --git a/readline.c b/readline.c
index 9d42a8d..5bef885 100644
--- a/readline.c
+++ b/readline.c
@@ -96,7 +96,6 @@ static void bind_arrow_keys (void);
 static void bind_bracketed_paste_prefix (void);
 
 static void readline_default_bindings (void);
-static void reset_default_bindings (void);
 
 static int _rl_subseq_result (int, Keymap, int, int);
 static int _rl_subseq_getchar (int);
@@ -564,8 +563,11 @@ readline_internal_char (void)
 readline_internal_charloop (void)
 #endif
 {
-  static int lastc, eof_found;
-  int c, code, lk, r;
+  static int lastc;
+#if !defined (READLINE_CALLBACKS)
+  static int eof_found;
+#endif
+  int c, code, lk;
 
   lastc = EOF;
 
@@ -672,7 +674,7 @@ readline_internal_charloop (void)
 	}
 
       lastc = c;
-      r = _rl_dispatch ((unsigned char)c, _rl_keymap);
+      _rl_dispatch ((unsigned char)c, _rl_keymap);
       RL_CHECK_SIGNALS ();
 
       if (_rl_command_to_execute)
@@ -686,7 +688,7 @@ readline_internal_charloop (void)
 
 	  rl_dispatching = 1;
 	  RL_SETSTATE(RL_STATE_DISPATCHING);
-	  r = (*(_rl_command_to_execute->func)) (_rl_command_to_execute->count, _rl_command_to_execute->key);
+	  (*(_rl_command_to_execute->func)) (_rl_command_to_execute->count, _rl_command_to_execute->key);
 	  _rl_command_to_execute = 0;
 	  RL_UNSETSTATE(RL_STATE_DISPATCHING);
 	  rl_dispatching = 0;
@@ -1337,6 +1339,7 @@ readline_default_bindings (void)
     rl_tty_set_default_bindings (_rl_keymap);
 }
 
+#if 0 /* unused */
 /* Reset the default bindings for the terminal special characters we're
    interested in back to rl_insert and read the new ones. */
 static void
@@ -1348,6 +1351,7 @@ reset_default_bindings (void)
       rl_tty_set_default_bindings (_rl_keymap);
     }
 }
+#endif /* unused */
 
 /* Bind some common arrow key sequences in MAP. */
 static void
diff --git a/readline.h b/readline.h
index cac269f..2456fab 100644
--- a/readline.h
+++ b/readline.h
@@ -32,6 +32,7 @@ extern "C" {
 #  include "keymaps.h"
 #  include "tilde.h"
 #else
+#  include <stdio.h>
 #  include <readline/rlstdc.h>
 #  include <readline/rltypedefs.h>
 #  include <readline/keymaps.h>
diff --git a/search.c b/search.c
index eea2301..47bade5 100644
--- a/search.c
+++ b/search.c
@@ -530,10 +530,7 @@ rl_history_search_internal (int count, int dir)
 {
   HIST_ENTRY *temp;
   int ret, oldpos, newcol;
-  int had_saved_line;
-  char *t;
 
-  had_saved_line = _rl_saved_line_for_history != 0;
   rl_maybe_save_line ();
   temp = (HIST_ENTRY *)NULL;
 
diff --git a/shell.c b/shell.c
index 36c9148..8287406 100644
--- a/shell.c
+++ b/shell.c
@@ -92,7 +92,7 @@ extern struct passwd *getpwuid (uid_t);
 
 /* Does shell-like quoting using single quotes. */
 char *
-sh_single_quote (char *string)
+_sh_single_quote (char *string)
 {
   register int c;
   char *result, *r, *s;
@@ -121,12 +121,17 @@ sh_single_quote (char *string)
 
 /* Set the environment variables LINES and COLUMNS to lines and cols,
    respectively. */
+#if defined (HAVE_SETENV)
 static char setenv_buf[INT_STRLEN_BOUND (int) + 1];
+#else
+#  if defined (HAVE_PUTENV)
 static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1];	/* sizeof("LINES=") == 6 */
 static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1];	/* sizeof("COLUMNS=") == 8 */
+#  endif /* HAVE_PUTENV */
+#endif /* !HAVE_SETENV */
 
 void
-sh_set_lines_and_columns (int lines, int cols)
+_sh_set_lines_and_columns (int lines, int cols)
 {
 #if defined (HAVE_SETENV)
   sprintf (setenv_buf, "%d", lines);
@@ -146,13 +151,13 @@ sh_set_lines_and_columns (int lines, int cols)
 }
 
 char *
-sh_get_env_value (const char *varname)
+_sh_get_env_value (const char *varname)
 {
   return ((char *)getenv (varname));
 }
 
 char *
-sh_get_home_dir (void)
+_sh_get_home_dir (void)
 {
   static char *home_dir = (char *)NULL;
   struct passwd *entry;
@@ -185,7 +190,7 @@ sh_get_home_dir (void)
 #endif
 
 int
-sh_unset_nodelay_mode (int fd)
+_sh_unset_nodelay_mode (int fd)
 {
 #if defined (HAVE_FCNTL)
   int flags, bflags;
@@ -212,3 +217,9 @@ sh_unset_nodelay_mode (int fd)
 
   return 0;
 }
+
+#pragma weak sh_single_quote = _sh_single_quote
+#pragma weak sh_set_lines_and_columns = _sh_set_lines_and_columns
+#pragma weak sh_get_env_value = _sh_get_env_value
+#pragma weak sh_get_home_dir = _sh_get_home_dir
+#pragma weak sh_unset_nodelay_mode = _sh_unset_nodelay_mode
diff --git a/shlib/Makefile.in b/shlib/Makefile.in
index d138524..0c04a69 100644
--- a/shlib/Makefile.in
+++ b/shlib/Makefile.in
@@ -71,6 +71,8 @@ LDFLAGS = @LDFLAGS@ @LOCAL_LDFLAGS@ @CFLAGS@
 DEFS = @DEFS@ @CROSS_COMPILE@
 LOCAL_DEFS = @LOCAL_DEFS@
 
+TERMCAP_LIB = @TERMCAP_LIB@
+
 #
 # These values are generated for configure by ${topdir}/support/shobj-conf.
 # If your system is not supported by that script, but includes facilities for
@@ -148,7 +150,7 @@ HSOURCES = $(topdir)/readline.h $(topdir)/rldefs.h $(topdir)/chardefs.h \
            $(topdir)/colors.h $(topdir)/parse-colors.h
 
 SHARED_HISTOBJ = history.so histexpand.so histfile.so histsearch.so shell.so \
-		 mbutil.so
+		 mbutil.so xmalloc.so xfree.so
 SHARED_TILDEOBJ = tilde.so
 SHARED_COLORSOBJ = colors.so parse-colors.so
 SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \
@@ -156,7 +158,7 @@ SHARED_OBJ = readline.so vi_mode.so funmap.so keymaps.so parens.so search.so \
 	  util.so kill.so undo.so macro.so input.so callback.so terminal.so \
 	  text.so nls.so misc.so \
 	  $(SHARED_HISTOBJ) $(SHARED_TILDEOBJ) $(SHARED_COLORSOBJ) \
-	  xmalloc.so xfree.so compat.so
+	  compat.so
 
 ##########################################################################
 
@@ -174,11 +176,15 @@ unsupported:
 
 $(SHARED_READLINE):	$(SHARED_OBJ)
 	$(RM) $@
-	$(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_OBJ) $(SHLIB_LIBS)
+	$(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_OBJ) ${TERMCAP_LIB} $(SHLIB_LIBS)
+	ln -sf $@ `basename $@ $(SHLIB_MINOR)`
+	ln -sf $@ `basename $@ .$(SHLIB_MAJOR)$(SHLIB_MINOR)`
 
-$(SHARED_HISTORY):	$(SHARED_HISTOBJ) xmalloc.so xfree.so
+$(SHARED_HISTORY):	$(SHARED_HISTOBJ)
 	$(RM) $@
-	$(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_HISTOBJ) xmalloc.so xfree.so $(SHLIB_LIBS)
+	$(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_HISTOBJ) $(SHLIB_LIBS)
+	ln -sf $@ `basename $@ $(SHLIB_MINOR)`
+	ln -sf $@ `basename $@ .$(SHLIB_MAJOR)$(SHLIB_MINOR)`
 
 # Since tilde.c is shared between readline and bash, make sure we compile 
 # it with the right flags when it's built as part of readline
diff --git a/signals.c b/signals.c
index 9df365e..3ecc6b8 100644
--- a/signals.c
+++ b/signals.c
@@ -411,7 +411,7 @@ rl_set_signals (void)
   SigHandler *oh;
 #if defined (HAVE_POSIX_SIGNALS)
   static int sigmask_set = 0;
-  static sigset_t bset, oset;
+  static sigset_t bset;
 #endif
 
 #if defined (HAVE_POSIX_SIGNALS)
@@ -622,7 +622,6 @@ rl_check_signals (void)
 /* **************************************************************** */
 
 #if defined (HAVE_POSIX_SIGNALS)
-static sigset_t sigint_set, sigint_oset;
 static sigset_t sigwinch_set, sigwinch_oset;
 #else /* !HAVE_POSIX_SIGNALS */
 #  if defined (HAVE_BSD_SIGNALS)
diff --git a/support/shobj-conf b/support/shobj-conf
index cd7634d..6fa455d 100644
--- a/support/shobj-conf
+++ b/support/shobj-conf
@@ -128,7 +128,7 @@ linux*-*|gnu*-*|k*bsd*-gnu-*|midnightbsd*|freebsd*|dragonfly*)
 	SHOBJ_LD='${CC}'
 	SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
 
-	SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
+	SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`,--no-undefined,--version-script,../map'
 	SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
 	;;
 
diff --git a/text.c b/text.c
index 91c3f33..b4deb15 100644
--- a/text.c
+++ b/text.c
@@ -97,7 +97,7 @@ rl_insert_text (const char *string)
   for (i = rl_end; i >= rl_point; i--)
     rl_line_buffer[i + l] = rl_line_buffer[i];
 
-  strncpy (rl_line_buffer + rl_point, string, l);
+  memcpy (rl_line_buffer + rl_point, string, l);
 
   /* Remember how to undo this if we aren't undoing something. */
   if (_rl_doing_an_undo == 0)
@@ -1608,7 +1608,10 @@ rl_transpose_chars (int count, int key)
 #else
   char dummy[2];
 #endif
-  int char_length, prev_point;
+  int char_length;
+#if defined (HANDLE_MULTIBYTE)
+  int prev_point;
+#endif
 
   if (count == 0)
     return 0;
@@ -1627,7 +1630,9 @@ rl_transpose_chars (int count, int key)
       count = 1;
     }
 
+#if defined (HANDLE_MULTIBYTE)
   prev_point = rl_point;
+#endif
   rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_NONZERO);
 
 #if defined (HANDLE_MULTIBYTE)
diff --git a/tilde.c b/tilde.c
index d678a31..62c5aed 100644
--- a/tilde.c
+++ b/tilde.c
@@ -192,7 +192,7 @@ tilde_expand (const char *string)
   int result_size, result_index;
 
   result_index = result_size = 0;
-  if (result = strchr (string, '~'))
+  if ((result = strchr (string, '~')))
     result = (char *)xmalloc (result_size = (strlen (string) + 16));
   else
     result = (char *)xmalloc (result_size = (strlen (string) + 1));
diff --git a/undo.c b/undo.c
index e4c457d..68088f3 100644
--- a/undo.c
+++ b/undo.c
@@ -116,7 +116,7 @@ _rl_free_undo_list (UNDO_LIST *ul)
 void
 rl_free_undo_list (void)
 {
-  UNDO_LIST *release, *orig_list;
+  UNDO_LIST *orig_list;
 
   orig_list = rl_undo_list;
   _rl_free_undo_list (rl_undo_list);
@@ -137,7 +137,7 @@ _rl_copy_undo_entry (UNDO_LIST *entry)
 UNDO_LIST *
 _rl_copy_undo_list (UNDO_LIST *head)
 {
-  UNDO_LIST *list, *new, *roving, *c;
+  UNDO_LIST *list, *new, *roving = NULL, *c;
 
   if (head == 0)
     return head;
@@ -157,7 +157,8 @@ _rl_copy_undo_list (UNDO_LIST *head)
       list = list->next;
     }
 
-  roving->next = 0;
+  if (roving)
+    roving->next = 0;
   return new;
 }
 
diff --git a/vi_mode.c b/vi_mode.c
index 3a033ba..ec65d53 100644
--- a/vi_mode.c
+++ b/vi_mode.c
@@ -101,7 +101,6 @@ static int vi_replace_count;
 /* If non-zero, we have text inserted after a c[motion] command that put
    us implicitly into insert mode.  Some people want this text to be
    attached to the command so that it is `redoable' with `.'. */
-static int vi_continued_command;
 static char *vi_insert_buffer;
 static int vi_insert_buffer_size;
 
@@ -619,8 +618,6 @@ rl_vi_eWord (int count, int ignore)
 int
 rl_vi_fword (int count, int ignore)
 {
-  int opoint;
-
   while (count-- && rl_point < (rl_end - 1))
     {
       /* Move to white space (really non-identifer). */
@@ -636,11 +633,9 @@ rl_vi_fword (int count, int ignore)
 	    _rl_vi_advance_point ();
 	}
 
-      opoint = rl_point;
-
       /* Move past whitespace. */
       while (whitespace (rl_line_buffer[rl_point]) && rl_point < rl_end)
-	opoint = _rl_vi_advance_point ();
+	_rl_vi_advance_point ();
     }
   return (0);
 }
@@ -1340,7 +1335,6 @@ _rl_vi_domove_callback (_rl_vimotion_cxt *m)
 int
 rl_vi_domove (int x, int *ignore)
 {
-  int r;
   _rl_vimotion_cxt *m;
 
   m = _rl_vimvcxt;
@@ -2045,7 +2039,7 @@ _rl_vi_callback_change_char (_rl_callback_generic_arg *data)
 
 #if defined (HANDLE_MULTIBYTE)
   if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
-    strncpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
+    memcpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
   else
 #endif
     _rl_vi_last_replacement[0] = c;
@@ -2066,7 +2060,7 @@ rl_vi_change_char (int count, int key)
 
   if (_rl_vi_redoing)
     {
-      strncpy (mb, _rl_vi_last_replacement, MB_LEN_MAX);
+      memcpy (mb, _rl_vi_last_replacement, MB_LEN_MAX);
       c = (unsigned char)_rl_vi_last_replacement[0];	/* XXX */
       mb[MB_LEN_MAX] = '\0';
     }
@@ -2085,7 +2079,7 @@ rl_vi_change_char (int count, int key)
 	return -1;
 #ifdef HANDLE_MULTIBYTE
       if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
-	strncpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
+	memcpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
       else
 #endif
 	_rl_vi_last_replacement[0] = c;
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin