commit bash-20110304 snapshot

This commit is contained in:
Chet Ramey
2011-12-29 13:04:46 -05:00
parent 5343870a1c
commit 40647963e2
24 changed files with 3999 additions and 36 deletions
+28 -4
View File
@@ -176,7 +176,8 @@ int _rl_vis_botlin = 0;
static int last_lmargin;
/* A buffer for `modeline' messages. */
static char msg_buf[128];
static char *msg_buf = 0;
static int msg_bufsiz = 0;
/* Non-zero forces the redisplay even if we thought it was unnecessary. */
static int forced_display;
@@ -2136,6 +2137,9 @@ rl_message (va_alist)
#if defined (PREFER_VARARGS)
char *format;
#endif
#if defined (HAVE_VSNPRINTF)
int bneed;
#endif
#if defined (PREFER_STDARG)
va_start (args, format);
@@ -2144,11 +2148,28 @@ rl_message (va_alist)
format = va_arg (args, char *);
#endif
if (msg_buf == 0)
msg_buf = xmalloc (msg_bufsiz = 128);
#if defined (HAVE_VSNPRINTF)
vsnprintf (msg_buf, sizeof (msg_buf) - 1, format, args);
bneed = vsnprintf (msg_buf, msg_bufsiz - 1, format, args);
if (bneed >= msg_bufsiz - 1)
{
msg_bufsiz = bneed + 1;
msg_buf = xrealloc (msg_buf, msg_bufsiz);
va_end (args);
#if defined (PREFER_STDARG)
va_start (args, format);
#else
va_start (args);
format = va_arg (args, char *);
#endif
vsnprintf (msg_buf, msg_bufsiz - 1, format, args);
}
#else
vsprintf (msg_buf, format, args);
msg_buf[sizeof(msg_buf) - 1] = '\0'; /* overflow? */
msg_buf[msg_bufsiz - 1] = '\0'; /* overflow? */
#endif
va_end (args);
@@ -2173,8 +2194,11 @@ int
rl_message (format, arg1, arg2)
char *format;
{
if (msg_buf == 0)
msg_buf = xmalloc (msg_bufsiz = 128);
sprintf (msg_buf, format, arg1, arg2);
msg_buf[sizeof(msg_buf) - 1] = '\0'; /* overflow? */
msg_buf[msg_bufsiz - 1] = '\0'; /* overflow? */
rl_display_prompt = msg_buf;
if (saved_local_prompt == 0)