all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Tom Davey <tdavey@gmail.com>, emacs-devel@gnu.org
Subject: Re: Puzzling behavior from echo area: truncates prompt string at 100	characters?
Date: Sat, 24 Dec 2011 11:59:36 +0100	[thread overview]
Message-ID: <m28vm29qw7.fsf@igel.home> (raw)
In-Reply-To: <83liq2xqm3.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 24 Dec 2011 11:31:48 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

> This limitation was there since 1991, but AFAICS it is not documented
> anywhere.

I don't think this was a deliberate decision, just sloppy coding.

> Do we want to keep this limitation?  If so, it should be at least
> documented.

I can trivially be lifted:

diff --git a/src/callint.c b/src/callint.c
index 80e24f6..8dcf9a6 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -274,7 +274,6 @@ invoke it.  If KEYS is omitted or nil, the return value of
 
   ptrdiff_t i, nargs;
   int foo;
-  char prompt1[100];
   char *tem1;
   int arg_from_tty = 0;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
@@ -491,13 +490,8 @@ invoke it.  If KEYS is omitted or nil, the return value of
   tem = string;
   for (i = 1; *tem; i++)
     {
-      strncpy (prompt1, tem + 1, sizeof prompt1 - 1);
-      prompt1[sizeof prompt1 - 1] = 0;
-      tem1 = strchr (prompt1, '\n');
-      if (tem1) *tem1 = 0;
-
-      visargs[0] = build_string (prompt1);
-      if (strchr (prompt1, '%'))
+      visargs[0] = make_string (tem + 1, strcspn (tem + 1, "\n"));
+      if (strchr (SSDATA (visargs[0]), '%'))
 	callint_message = Fformat (i, visargs);
       else
 	callint_message = visargs[0];

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



  reply	other threads:[~2011-12-24 10:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21  1:29 Puzzling behavior from echo area: truncates prompt string at 100 characters? Tom Davey
2011-12-24  9:31 ` Eli Zaretskii
2011-12-24 10:59   ` Andreas Schwab [this message]
2011-12-24 13:20     ` Eli Zaretskii
2011-12-24 17:41       ` Tom Davey
2011-12-25  6:08       ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m28vm29qw7.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=tdavey@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.