summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2003-05-10 21:40:01 +0000
committerBob Beck <beck@cvs.openbsd.org>2003-05-10 21:40:01 +0000
commite5ec5dcb85d7417669bf035105a45f538f146525 (patch)
treeaf34ea162aad1e34381c11da590e8a12b6d75a9c /gnu
parent6f41679e5b646ab8a07115715935afb174abffae (diff)
Back out libreadline changes, this breaks static build (I.E. vax).
changes are nontrivial to fix. Will return when static build works.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/lib/libreadline/bind.c21
-rw-r--r--gnu/lib/libreadline/complete.c47
-rw-r--r--gnu/lib/libreadline/display.c14
-rw-r--r--gnu/lib/libreadline/histexpand.c24
-rw-r--r--gnu/lib/libreadline/histfile.c20
-rw-r--r--gnu/lib/libreadline/histlib.h10
-rw-r--r--gnu/lib/libreadline/isearch.c29
-rw-r--r--gnu/lib/libreadline/kill.c12
-rw-r--r--gnu/lib/libreadline/readline.c8
-rw-r--r--gnu/lib/libreadline/rldefs.h7
-rw-r--r--gnu/lib/libreadline/savestring.c17
-rw-r--r--gnu/lib/libreadline/search.c2
-rw-r--r--gnu/lib/libreadline/shell.c15
-rw-r--r--gnu/lib/libreadline/tilde.c17
-rw-r--r--gnu/lib/libreadline/util.c6
-rw-r--r--gnu/lib/libreadline/xmalloc.c2
-rw-r--r--gnu/lib/libreadline/xmalloc.h2
17 files changed, 119 insertions, 134 deletions
diff --git a/gnu/lib/libreadline/bind.c b/gnu/lib/libreadline/bind.c
index d9947c389df..fc6fe284116 100644
--- a/gnu/lib/libreadline/bind.c
+++ b/gnu/lib/libreadline/bind.c
@@ -1761,15 +1761,14 @@ rl_invoking_keyseqs_in_map (function, map)
for (i = 0; seqs[i]; i++)
{
- int len = 6 + strlen(seqs[i]);
- char *keyname = (char *)xmalloc (len);
+ char *keyname = (char *)xmalloc (6 + strlen (seqs[i]));
if (key == ESC)
- snprintf(keyname, len, "\\e");
+ sprintf (keyname, "\\e");
else if (CTRL_CHAR (key))
- snprintf(keyname, len, "\\C-%c", _rl_to_lower (UNCTRL (key)));
+ sprintf (keyname, "\\C-%c", _rl_to_lower (UNCTRL (key)));
else if (key == RUBOUT)
- snprintf(keyname, len, "\\C-?");
+ sprintf (keyname, "\\C-?");
else if (key == '\\' || key == '"')
{
keyname[0] = '\\';
@@ -1782,7 +1781,7 @@ rl_invoking_keyseqs_in_map (function, map)
keyname[1] = '\0';
}
- strlcat (keyname, seqs[i], len);
+ strcat (keyname, seqs[i]);
free (seqs[i]);
if (result_index + 2 > result_size)
@@ -1936,10 +1935,9 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
prefix_len = prefix ? strlen (prefix) : 0;
if (key == ESC)
{
- int len = 3 + prefix_len;
- keyname = xmalloc (len);
+ keyname = xmalloc (3 + prefix_len);
if (prefix)
- strlcpy (keyname, prefix, len);
+ strcpy (keyname, prefix);
keyname[prefix_len] = '\\';
keyname[prefix_len + 1] = 'e';
keyname[prefix_len + 2] = '\0';
@@ -1949,8 +1947,9 @@ _rl_macro_dumper_internal (print_readably, map, prefix)
keyname = _rl_get_keyname (key);
if (prefix)
{
- if (asprintf(&out, "%s%s", prefix, keyname) == -1)
- memory_error_and_abort("asprintf");
+ out = xmalloc (strlen (keyname) + prefix_len + 1);
+ strcpy (out, prefix);
+ strcpy (out + prefix_len, keyname);
free (keyname);
keyname = out;
}
diff --git a/gnu/lib/libreadline/complete.c b/gnu/lib/libreadline/complete.c
index d5f983b0489..fb48712a4e0 100644
--- a/gnu/lib/libreadline/complete.c
+++ b/gnu/lib/libreadline/complete.c
@@ -459,7 +459,7 @@ print_filename (to_print, full_pathname)
}
#else
char *s, c, *new_full_pathname;
- int extension_char;
+ int extension_char, slen, tlen;
for (s = to_print; *s; s++)
{
@@ -485,9 +485,16 @@ print_filename (to_print, full_pathname)
s = tilde_expand (full_pathname && *full_pathname ? full_pathname : "/");
if (rl_directory_completion_hook)
(*rl_directory_completion_hook) (&s);
- if (asprintf(&new_full_pathname, "%s/%s", s, to_print) == -1)
- memory_error_and_abort("asprintf");
+
+ slen = strlen (s);
+ tlen = strlen (to_print);
+ new_full_pathname = xmalloc (slen + tlen + 2);
+ strcpy (new_full_pathname, s);
+ new_full_pathname[slen] = '/';
+ strcpy (new_full_pathname + slen + 1, to_print);
+
extension_char = stat_char (new_full_pathname);
+
free (new_full_pathname);
to_print[-1] = c;
}
@@ -515,11 +522,10 @@ rl_quote_filename (s, rtype, qcp)
char *qcp;
{
char *r;
- int len = strlen(s) + 2;
- r = xmalloc (len);
+ r = xmalloc (strlen (s) + 2);
*r = *rl_completer_quote_characters;
- strlcpy (r + 1, s, len - 1);
+ strcpy (r + 1, s);
if (qcp)
*qcp = *rl_completer_quote_characters;
return r;
@@ -814,9 +820,8 @@ compute_lcd_of_matches (match_list, matches, text)
value of matches[0]. */
if (low == 0 && text && *text)
{
- match_list[0] = strdup(text);
- if (match_list[0] == NULL)
- memory_error_and_abort("strdup");
+ match_list[0] = xmalloc (strlen (text) + 1);
+ strcpy (match_list[0], text);
}
else
{
@@ -1447,12 +1452,11 @@ username_completion_function (text, state)
}
else
{
- int len = 2 + strlen(entry->pw_name);
- value = xmalloc (len);
+ value = xmalloc (2 + strlen (entry->pw_name));
*value = *text;
- strlcpy (value + first_char_loc, entry->pw_name, len - first_char_loc);
+ strcpy (value + first_char_loc, entry->pw_name);
if (first_char == '~')
rl_filename_completion_desired = 1;
@@ -1495,7 +1499,6 @@ filename_completion_function (text, state)
FREE (users_dirname);
filename = savestring (text);
- filename_len = strlen(filename);
if (*text == 0)
text = ".";
dirname = savestring (text);
@@ -1510,15 +1513,14 @@ filename_completion_function (text, state)
if (temp)
{
- strlcpy (filename, ++temp, filename_len);
+ strcpy (filename, ++temp);
*temp = '\0';
}
#if defined (__MSDOS__)
/* searches from current directory on the drive */
else if (isalpha (dirname[0]) && dirname[1] == ':')
{
- /* XXX DOS strlcpy anyone? */
- strlcpy (filename, dirname + 2, filename_len);
+ strcpy (filename, dirname + 2);
dirname[2] = '\0';
}
#endif
@@ -1623,13 +1625,11 @@ filename_completion_function (text, state)
/* dirname && (strcmp (dirname, ".") != 0) */
if (dirname && (dirname[0] != '.' || dirname[1]))
{
- int templen;
if (rl_complete_with_tilde_expansion && *users_dirname == '~')
{
dirlen = strlen (dirname);
- templen = 2 + dirlen + D_NAMLEN (entry);
- temp = xmalloc (templen);
- strlcpy (temp, dirname, templen);
+ temp = xmalloc (2 + dirlen + D_NAMLEN (entry));
+ strcpy (temp, dirname);
/* Canonicalization cuts off any final slash present. We
may need to add it back. */
if (dirname[dirlen - 1] != '/')
@@ -1641,12 +1641,11 @@ filename_completion_function (text, state)
else
{
dirlen = strlen (users_dirname);
- templen = 1 + dirlen + D_NAMLEN (entry);
- temp = xmalloc (templen);
- strlcpy (temp, users_dirname, templen);
+ temp = xmalloc (1 + dirlen + D_NAMLEN (entry));
+ strcpy (temp, users_dirname);
}
- strlcat (temp, entry->d_name, templen);
+ strcpy (temp + dirlen, entry->d_name);
}
else
temp = savestring (entry->d_name);
diff --git a/gnu/lib/libreadline/display.c b/gnu/lib/libreadline/display.c
index c26bdf44c7a..4487004a027 100644
--- a/gnu/lib/libreadline/display.c
+++ b/gnu/lib/libreadline/display.c
@@ -501,7 +501,7 @@ rl_redisplay ()
{
if (_rl_output_meta_chars == 0)
{
- snprintf (line + out, line_size - out, "\\%o", c);
+ sprintf (line + out, "\\%o", c);
if (lpos + 4 >= screenwidth)
{
@@ -1092,8 +1092,8 @@ rl_on_new_line_with_prompt ()
/* Make sure the line structures hold the already-displayed prompt for
redisplay. */
- strlcpy (visible_line, rl_prompt, line_size);
- strlcpy (invisible_line, rl_prompt, line_size);
+ strcpy (visible_line, rl_prompt);
+ strcpy (invisible_line, rl_prompt);
/* If the prompt contains newlines, take the last tail. */
prompt_last_line = strrchr (rl_prompt, '\n');
@@ -1312,7 +1312,7 @@ rl_message (va_alist)
format = va_arg (args, char *);
#endif
- vsnprintf (msg_buf, sizeof(msg_buf), format, args);
+ vsprintf (msg_buf, format, args);
va_end (args);
rl_display_prompt = msg_buf;
@@ -1324,7 +1324,7 @@ int
rl_message (format, arg1, arg2)
char *format;
{
- snprintf (msg_buf, sizeof(msg_buf), format, arg1, arg2);
+ sprintf (msg_buf, format, arg1, arg2);
rl_display_prompt = msg_buf;
(*rl_redisplay_function) ();
return 0;
@@ -1395,7 +1395,7 @@ _rl_make_prompt_for_search (pchar)
len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
pmt = xmalloc (len + 2);
if (len)
- strlcpy (pmt, rl_prompt, len + 2);
+ strcpy (pmt, rl_prompt);
pmt[len] = pchar;
pmt[len+1] = '\0';
}
@@ -1404,7 +1404,7 @@ _rl_make_prompt_for_search (pchar)
len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
pmt = xmalloc (len + 2);
if (len)
- strlcpy (pmt, saved_local_prompt, len + 2);
+ strcpy (pmt, saved_local_prompt);
pmt[len] = pchar;
pmt[len+1] = '\0';
local_prompt = savestring (pmt);
diff --git a/gnu/lib/libreadline/histexpand.c b/gnu/lib/libreadline/histexpand.c
index 4c42a213c0e..78da3e585a6 100644
--- a/gnu/lib/libreadline/histexpand.c
+++ b/gnu/lib/libreadline/histexpand.c
@@ -341,7 +341,7 @@ hist_error(s, start, current, errtype)
int start, current, errtype;
{
char *temp, *emsg;
- int ll, elen, len;
+ int ll, elen;
ll = current - start;
@@ -373,11 +373,11 @@ hist_error(s, start, current, errtype)
break;
}
- len = ll + elen + 3;
- temp = xmalloc (len);
+ temp = xmalloc (ll + elen + 3);
strncpy (temp, s + start, ll);
- strlcat (temp, ": ", len);
- strlcat (temp, emsg, len);
+ temp[ll] = ':';
+ temp[ll + 1] = ' ';
+ strcpy (temp + ll + 2, emsg);
return (temp);
}
@@ -443,7 +443,7 @@ postproc_subst_rhs ()
{
if (j + subst_lhs_len >= new_size)
new = xrealloc (new, (new_size = new_size * 2 + subst_lhs_len));
- strlcpy (new + j, subst_lhs, new_size - j);
+ strcpy (new + j, subst_lhs);
j += subst_lhs_len;
}
else
@@ -754,7 +754,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
n = strlen (temp);
if (n >= result_len)
result = xrealloc (result, n + 2);
- strlcpy (result, temp, n + 2);
+ strcpy (result, temp);
free (temp);
*end_index_ptr = i;
@@ -786,7 +786,7 @@ history_expand_internal (string, start, end_index_ptr, ret_string, current_line)
result_len += 128; \
result = xrealloc (result, result_len); \
} \
- strlcpy (result + j - sl, s, result_len - j + sl); \
+ strcpy (result + j - sl, s); \
} \
while (0)
@@ -847,7 +847,7 @@ history_expand (hstring, output)
string[0] = string[1] = history_expansion_char;
string[2] = ':';
string[3] = 's';
- strlcpy (string + 4, hstring, l - 4);
+ strcpy (string + 4, hstring);
l += 4;
}
else
@@ -966,7 +966,7 @@ history_expand (hstring, output)
if (i == 0 || member (string[i - 1], HISTORY_WORD_DELIMITERS))
{
temp = xmalloc (l - i + 1);
- strlcpy (temp, string + i, l - i + 1);
+ strcpy (temp, string + i);
ADD_STRING (temp);
free (temp);
i = l;
@@ -998,7 +998,7 @@ history_expand (hstring, output)
if (result)
{
temp = xmalloc (1 + strlen (result));
- strlcpy (temp, result, 1 + strlen(result));
+ strcpy (temp, result);
ADD_STRING (temp);
free (temp);
}
@@ -1192,7 +1192,7 @@ history_arg_extract (first, last, string)
for (i = first, offset = 0; i < last; i++)
{
- strlcpy (result + offset, list[i], size + 1 - offset);
+ strcpy (result + offset, list[i]);
offset += strlen (list[i]);
if (i + 1 < last)
{
diff --git a/gnu/lib/libreadline/histfile.c b/gnu/lib/libreadline/histfile.c
index ad200d3051b..0b3135d2a6b 100644
--- a/gnu/lib/libreadline/histfile.c
+++ b/gnu/lib/libreadline/histfile.c
@@ -88,7 +88,6 @@ history_filename (filename)
{
char *return_val, *home;
int home_len;
- char dot;
return_val = filename ? savestring (filename) : (char *)NULL;
@@ -103,13 +102,15 @@ history_filename (filename)
}
home_len = strlen (home);
+ return_val = xmalloc (2 + home_len + 8); /* strlen(".history") == 8 */
+ strcpy (return_val, home);
+ return_val[home_len] = '/';
#if defined (__MSDOS__)
- dot = '_';
+ strcpy (return_val + home_len + 1, "_history");
#else
- dot = '.';
+ strcpy (return_val + home_len + 1, ".history");
#endif
- if (asprintf(&return_val, "%s/%c%s", home, dot, "history") == -1)
- memory_error_and_abort("asprintf");
+
return (return_val);
}
@@ -334,6 +335,7 @@ history_do_write (filename, nelements, overwrite)
Suggested by Peter Ho (peter@robosts.oxford.ac.uk). */
{
HIST_ENTRY **the_history; /* local */
+ register int j;
int buffer_size;
char *buffer;
@@ -344,12 +346,12 @@ history_do_write (filename, nelements, overwrite)
/* Allocate the buffer, and fill it. */
buffer = xmalloc (buffer_size);
- buffer[0] = '\0';
- for (i = history_length - nelements; i < history_length; i++)
+ for (j = 0, i = history_length - nelements; i < history_length; i++)
{
- strlcat (buffer, the_history[i]->line, buffer_size);
- strlcat (buffer, "\n", buffer_size);
+ strcpy (buffer + j, the_history[i]->line);
+ j += strlen (the_history[i]->line);
+ buffer[j++] = '\n';
}
write (file, buffer, buffer_size);
diff --git a/gnu/lib/libreadline/histlib.h b/gnu/lib/libreadline/histlib.h
index e509381791f..88a34d10f1d 100644
--- a/gnu/lib/libreadline/histlib.h
+++ b/gnu/lib/libreadline/histlib.h
@@ -37,10 +37,12 @@ typedef char **CPPFunction ();
: ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
#endif
-#if !defined (savestring)
-extern char *xstrdup (char *);
-#define savestring(x) xstrdup(x)
-#endif /* !savestring */
+#ifndef savestring
+# ifndef strcpy
+extern char *strcpy ();
+# endif
+#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
+#endif
#ifndef whitespace
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
diff --git a/gnu/lib/libreadline/isearch.c b/gnu/lib/libreadline/isearch.c
index be051203335..952c10ddf8e 100644
--- a/gnu/lib/libreadline/isearch.c
+++ b/gnu/lib/libreadline/isearch.c
@@ -93,18 +93,17 @@ rl_display_search (search_string, reverse_p, where)
int reverse_p, where;
{
char *message;
- int msglen, searchlen, mlen;
+ int msglen, searchlen;
searchlen = (search_string && *search_string) ? strlen (search_string) : 0;
- mlen = searchlen + 33;
- message = xmalloc (mlen);
+ message = xmalloc (searchlen + 33);
msglen = 0;
#if defined (NOTDEF)
if (where != -1)
{
- snprintf (message, mlen, "[%d]", where + history_base);
+ sprintf (message, "[%d]", where + history_base);
msglen = strlen (message);
}
#endif /* NOTDEF */
@@ -113,17 +112,20 @@ rl_display_search (search_string, reverse_p, where)
if (reverse_p)
{
- strlcat (message, "reverse-", mlen);
+ strcpy (message + msglen, "reverse-");
+ msglen += 8;
}
- strlcat (message, "i-search)`", mlen);
+ strcpy (message + msglen, "i-search)`");
+ msglen += 10;
if (search_string)
{
- strlcat (message, search_string, mlen);
+ strcpy (message + msglen, search_string);
+ msglen += searchlen;
}
- strlcat (message, "': ", mlen);
+ strcpy (message + msglen, "': ");
rl_message ("%s", message, 0);
free (message);
@@ -200,9 +202,8 @@ rl_search_history (direction, invoking_key)
else
{
/* Keep track of this so we can free it. */
- allocated_line = strdup(rl_line_buffer);
- if (allocated_line == NULL)
- memory_error_and_abort("strdup");
+ allocated_line = xmalloc (1 + strlen (rl_line_buffer));
+ strcpy (allocated_line, &rl_line_buffer[0]);
lines[i] = allocated_line;
}
@@ -296,7 +297,7 @@ rl_search_history (direction, invoking_key)
break;
case CTRL ('G'):
- strlcpy (rl_line_buffer, lines[orig_line], rl_line_buffer_len);
+ strcpy (rl_line_buffer, lines[orig_line]);
rl_point = orig_point;
rl_end = strlen (rl_line_buffer);
rl_restore_prompt();
@@ -401,7 +402,7 @@ rl_search_history (direction, invoking_key)
if (line_len >= rl_line_buffer_len)
rl_extend_line_buffer (line_len);
- strlcpy (rl_line_buffer, lines[i], rl_line_buffer_len);
+ strcpy (rl_line_buffer, lines[i]);
rl_point = line_index;
rl_end = line_len;
last_found_line = i;
@@ -415,7 +416,7 @@ rl_search_history (direction, invoking_key)
not found. We use this to determine where to place rl_point. */
/* First put back the original state. */
- strlcpy (rl_line_buffer, lines[orig_line], rl_line_buffer_len);
+ strcpy (rl_line_buffer, lines[orig_line]);
rl_restore_prompt ();
diff --git a/gnu/lib/libreadline/kill.c b/gnu/lib/libreadline/kill.c
index b30dd707627..c3241bdadd0 100644
--- a/gnu/lib/libreadline/kill.c
+++ b/gnu/lib/libreadline/kill.c
@@ -128,20 +128,18 @@ _rl_copy_to_kill_ring (text, append)
/* If the last command was a kill, prepend or append. */
if (_rl_last_command_was_kill && rl_editing_mode != vi_mode)
{
- int len;
old = rl_kill_ring[slot];
- len = 1 + strlen (old) + strlen (text);
- new = xmalloc (len);
+ new = xmalloc (1 + strlen (old) + strlen (text));
if (append)
{
- strlcpy (new, old, len);
- strlcat (new, text, len);
+ strcpy (new, old);
+ strcat (new, text);
}
else
{
- strlcpy (new, text, len);
- strlcat (new, old, len);
+ strcpy (new, text);
+ strcat (new, old);
}
free (old);
free (text);
diff --git a/gnu/lib/libreadline/readline.c b/gnu/lib/libreadline/readline.c
index 5ccc001748a..2c6aef68f48 100644
--- a/gnu/lib/libreadline/readline.c
+++ b/gnu/lib/libreadline/readline.c
@@ -341,7 +341,7 @@ readline_internal_teardown (eof)
entry = replace_history_entry (where_history (), the_line, (histdata_t)NULL);
_rl_free_history_entry (entry);
- strlcpy (the_line, temp, rl_line_buffer_len);
+ strcpy (the_line, temp);
free (temp);
}
@@ -1865,7 +1865,7 @@ maybe_unsave_line ()
if (line_len >= rl_line_buffer_len)
rl_extend_line_buffer (line_len);
- strlcpy (the_line, saved_line_for_history->line, rl_line_buffer_len);
+ strcpy (the_line, saved_line_for_history->line);
rl_undo_list = (UNDO_LIST *)saved_line_for_history->data;
_rl_free_history_entry (saved_line_for_history);
saved_line_for_history = (HIST_ENTRY *)NULL;
@@ -1948,7 +1948,7 @@ rl_get_next_history (count, key)
if (line_len >= rl_line_buffer_len)
rl_extend_line_buffer (line_len);
- strlcpy (the_line, temp->line, rl_line_buffer_len);
+ strcpy (the_line, temp->line);
rl_undo_list = (UNDO_LIST *)temp->data;
rl_end = rl_point = strlen (the_line);
#if defined (VI_MODE)
@@ -2005,7 +2005,7 @@ rl_get_previous_history (count, key)
if (line_len >= rl_line_buffer_len)
rl_extend_line_buffer (line_len);
- strlcpy (the_line, temp->line, rl_line_buffer_len);
+ strcpy (the_line, temp->line);
rl_undo_list = (UNDO_LIST *)temp->data;
rl_end = rl_point = line_len;
diff --git a/gnu/lib/libreadline/rldefs.h b/gnu/lib/libreadline/rldefs.h
index 35bdafccc23..e504d9b1c30 100644
--- a/gnu/lib/libreadline/rldefs.h
+++ b/gnu/lib/libreadline/rldefs.h
@@ -93,11 +93,10 @@ extern int _rl_stricmp (), _rl_strnicmp ();
# define KEYMAP_TO_FUNCTION(data) (Function *)(data)
#endif
+#ifndef savestring
extern char *xmalloc ();
-#if !defined (savestring)
-extern char *xstrdup (char *);
-#define savestring(x) xstrdup(x)
-#endif /* !savestring */
+#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
+#endif
/* Possible values for _rl_bell_preference. */
#define NO_BELL 0
diff --git a/gnu/lib/libreadline/savestring.c b/gnu/lib/libreadline/savestring.c
index 679adeb86e1..0916ab8b0a4 100644
--- a/gnu/lib/libreadline/savestring.c
+++ b/gnu/lib/libreadline/savestring.c
@@ -22,25 +22,14 @@
#include <string.h>
-extern char * xmalloc();
-extern void memory_error_and_abort(char *);
+extern char *strcpy ();
+extern char *xmalloc ();
/* Backwards compatibility, now that savestring has been removed from
all `public' readline header files. */
-
-char *
-xstrdup(char *s)
-{
- char * cp;
- cp = strdup(s);
- if (cp == NULL)
- memory_error_and_abort("savestring");
- return(cp);
-}
-
char *
savestring (s)
char *s;
{
- return(xstrdup(s));
+ return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
}
diff --git a/gnu/lib/libreadline/search.c b/gnu/lib/libreadline/search.c
index 8a6d42b12a3..112f8072866 100644
--- a/gnu/lib/libreadline/search.c
+++ b/gnu/lib/libreadline/search.c
@@ -78,7 +78,7 @@ make_history_line_current (entry)
line_len = strlen (entry->line);
if (line_len >= rl_line_buffer_len)
rl_extend_line_buffer (line_len);
- strlcpy (rl_line_buffer, entry->line, rl_line_buffer_len);
+ strcpy (rl_line_buffer, entry->line);
rl_undo_list = (UNDO_LIST *)entry->data;
rl_end = line_len;
diff --git a/gnu/lib/libreadline/shell.c b/gnu/lib/libreadline/shell.c
index a51e45482b3..3daef69b4c2 100644
--- a/gnu/lib/libreadline/shell.c
+++ b/gnu/lib/libreadline/shell.c
@@ -102,20 +102,19 @@ set_lines_and_columns (lines, cols)
char *b;
#if defined (HAVE_PUTENV)
- if (asprintf (&b, "LINES=%d", lines) == -1)
- memory_error_and_abort("asprintf");
+ b = xmalloc (24);
+ sprintf (b, "LINES=%d", lines);
putenv (b);
b = xmalloc (24);
- if (asprintf (&b, "COLUMNS=%d", cols) == -1)
- memory_error_and_abort("asprintf");
+ sprintf (b, "COLUMNS=%d", cols);
putenv (b);
#else /* !HAVE_PUTENV */
# if defined (HAVE_SETENV)
- if (asprintf(&b, "%d", lines) == -1)
- memory_error_and_abort("asprintf");
+ b = xmalloc (8);
+ sprintf (b, "%d", lines);
setenv ("LINES", b, 1);
- if (asprintf (&b, "%d", cols) == -1)
- memory_error_and_abort("asprintf");
+ b = xmalloc (8);
+ sprintf (b, "%d", cols);
setenv ("COLUMNS", b, 1);
# endif /* HAVE_SETENV */
#endif /* !HAVE_PUTENV */
diff --git a/gnu/lib/libreadline/tilde.c b/gnu/lib/libreadline/tilde.c
index c82291be6ae..009c6992396 100644
--- a/gnu/lib/libreadline/tilde.c
+++ b/gnu/lib/libreadline/tilde.c
@@ -63,9 +63,11 @@ extern struct passwd *getpwuid (), *getpwnam ();
#endif /* !HAVE_GETPW_DECLS */
#if !defined (savestring)
-extern char *xstrdup (char *);
-#define savestring(x) xstrdup(x)
-#endif /* !savestring */
+# ifndef strcpy
+extern char *strcpy ();
+# endif
+#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
+#endif /* !savestring */
#if !defined (NULL)
# if defined (__STDC__)
@@ -242,8 +244,7 @@ tilde_expand (string)
if ((result_index + len + 1) > result_size)
result = xrealloc (result, 1 + (result_size += (len + 20)));
- strlcpy (result + result_index, expansion,
- result_size - result_index);
+ strcpy (result + result_index, expansion);
result_index += len;
}
free (expansion);
@@ -292,8 +293,8 @@ glue_prefix_and_suffix (prefix, suffix, suffind)
slen = strlen (suffix + suffind);
ret = xmalloc (plen + slen + 1);
if (plen)
- strlcpy (ret, prefix, plen + slen + 1);
- strlcat (ret, suffix + suffind, plen + slen + 1);
+ strcpy (ret, prefix);
+ strcpy (ret + plen, suffix + suffind);
return ret;
}
@@ -395,7 +396,7 @@ main (argc, argv)
fflush (stdout);
if (!gets (line))
- strlcpy (line, "done", sizeof(line));
+ strcpy (line, "done");
if ((strcmp (line, "done") == 0) ||
(strcmp (line, "quit") == 0) ||
diff --git a/gnu/lib/libreadline/util.c b/gnu/lib/libreadline/util.c
index e96a401dfd3..be9e0a9869a 100644
--- a/gnu/lib/libreadline/util.c
+++ b/gnu/lib/libreadline/util.c
@@ -347,9 +347,5 @@ char *
_rl_savestring (s)
char *s;
{
- char *cp;
- cp = strdup(s);
- if (cp == NULL)
- memory_error_and_abort ("savestring");
- return(cp);
+ return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
}
diff --git a/gnu/lib/libreadline/xmalloc.c b/gnu/lib/libreadline/xmalloc.c
index 0393c29f2ff..c0d06403a3c 100644
--- a/gnu/lib/libreadline/xmalloc.c
+++ b/gnu/lib/libreadline/xmalloc.c
@@ -40,7 +40,7 @@
/* */
/* **************************************************************** */
-void
+static void
memory_error_and_abort (fname)
char *fname;
{
diff --git a/gnu/lib/libreadline/xmalloc.h b/gnu/lib/libreadline/xmalloc.h
index 898d3906f09..bdf251b070a 100644
--- a/gnu/lib/libreadline/xmalloc.h
+++ b/gnu/lib/libreadline/xmalloc.h
@@ -42,5 +42,5 @@
extern char *xmalloc __P((int));
extern char *xrealloc __P((void *, int));
extern void xfree __P((void *));
-extern void memory_error_and_abort __P((char *));
+
#endif /* _XMALLOC_H_ */