From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: =?iso-8859-1?q?Andreas_B=FCsching?= Newsgroups: gmane.emacs.devel Subject: Re: extensions for emacsclient (CVS version) Date: Wed, 10 Sep 2003 17:00:45 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <20030910143748.GA27983@fencepost> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1063207058 19403 80.91.224.253 (10 Sep 2003 15:17:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 10 Sep 2003 15:17:38 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Sep 10 17:17:36 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19x6iu-0007OZ-00 for ; Wed, 10 Sep 2003 17:17:36 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19x6jK-0002Ut-00 for ; Wed, 10 Sep 2003 17:18:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19x6fv-00043X-GQ for emacs-devel@quimby.gnus.org; Wed, 10 Sep 2003 11:14:31 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 19x6Uh-0001Oo-T3 for emacs-devel@gnu.org; Wed, 10 Sep 2003 11:02:55 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 19x6TX-0000st-PN for emacs-devel@gnu.org; Wed, 10 Sep 2003 11:01:45 -0400 Original-Received: from [134.102.224.4] (helo=imh.informatik.uni-bremen.de) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.22) id 19x6Si-0000g0-B0; Wed, 10 Sep 2003 11:00:52 -0400 Original-Received: from dataman.informatik.uni-bremen.de (IDENT:TXV9jx8ZKxY/6kQiTBz7B/wxJoGmDkmP@dataman.informatik.uni-bremen.de [134.102.218.127]) by imh.informatik.uni-bremen.de (8.12.9/8.12.9) with ESMTP id h8AF0je0027533; Wed, 10 Sep 2003 17:00:46 +0200 (MEST) Original-Received: (from crunchy@localhost) by dataman.informatik.uni-bremen.de (8.11.6/8.8.7) id h8AF0jn22030; Wed, 10 Sep 2003 17:00:45 +0200 Original-To: Miles Bader Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEUAAADgvEcRDgkCAAD4 +PjoxUn//+35+PFNQyz////+/vTCnz7l3sqEckP39eyvu3nmAAACRUlEQVR4nG3UQWsTQRQA4Efi IaI5zGGkkFbC5LJgAmFzyaG9LfVSA3uYk3oQNNDaY88STQ8pxmuwaXoV4kHYniqTQBNCSHUicSNi 2Y4nQYU0v8Hdmc2aZrOn2fnmzZt5+1g4DJ4hAPwM3iAYNZIAeuZjGLpuQN4+CMPIg1fxvyFw5yEH 0fMwRAAIQBgilaQuyBLI81Ka23ARgg0xrlb/wM0Q6JlToQ+WQLySYGQZ2K8xbtvZMAwsStHKcjAT J9lbIeh+pQ47zWghGK4x1hpopYtFEB3B+AuA6gIcb0w6/JcxgvUFGO0X+G/D6M7KOINGqWd4zxXA wTV4G5PzxgOAe9egFO8ZU6PAeSqrCuxDI5mRW3FeTqly+XAcqaqtJmc6xOfginxTYHCSjM1BV/Pn jS1CIudzkA4gpcnsPkRvGEZByUg1qoIjsv8fdLgdwInm5t7ygczByIMlEfUx6fkR96cjkg2gJuwZ FKbjVGx9Bh/o4/Segk1UzunppoL6rkXtLyrHplnOkda2hFoxgeiatqfuh+xcZlXBLmMYJ1KXqohm +42FdjyoP0EII2TnZd0nFmMW7m978AxRatEVXQFzl+FHOzICu0JRRcLQQd5bv6kAUYzuPvU+ue1g E2N6RwIyselu4IGtux2MqelF1DpuborNdovzs2jecsPNVZnjs3cOarbdPwNE8wyZiBab8h5Dx5WE D4573r68x2G9+PyhYExUvHauOKz9vekX8X2xaAlx2ZQNJoT4NNcl7/iPvhzUBy+5XPEPHY0ktsnr +9wAAAAASUVORK5CYII= X-URL: http://www.crunchy-home.de/ In-Reply-To: <20030910143748.GA27983@fencepost> (Miles Bader's message of "Wed, 10 Sep 2003 10:37:48 -0400") User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:16273 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:16273 Miles Bader wrote: > On Wed, Sep 10, 2003 at 03:45:34PM +0200, Andreas B?sching wrote: > + while ((str = fgets (string, BUFSIZ, stdin))) > + { > + fprintf (out, "%s ", quote_file_name (str)); > + } > > I think that there shouldn't be a space after the %s -- that will cause each > line of input to be evaluated independantly, which is probably not what you > want, as well as being the wrong thing if a line is longer than BUFSIZ. > Also, you don't free the result from quote_file_name (it's only only going to > matter for extremely long input -- but that's probably more likely for stuff > being fed from stdin). > > Hmmm, this isn't really your fault, but I notice that _every_ call to > quote_file_name immediately just prints the result, like: > > fprintf (out, "-display %s ", quote_file_name (display)); > > where quote_file_name mallocs a new string. > > It would be nicer to just change quote_file_name to something like > `output_quoted_string (char *str, FILE *stream)', which just copies STR to > STREAM with appropriate quoting (doing away with all the mallocing). I think it's a great idea to clean up the memory and to add the second argument, but I would still prefer to do the copying and write the string at once into the stream and not character by character. > Then expressions like the above could be changed to: > > { > fputs ("-display ", out); > output_quoted_string (display, out); > } > > and your loop would be: > > while ((str = fgets (string, BUFSIZ, stdin))) > output_quoted_string (str, out); I'm already working on it. crunchy -- If God is dead, who will save the Queen?