From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: extensions for emacsclient (CVS version) Date: Wed, 10 Sep 2003 10:37:48 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <20030910143748.GA27983@fencepost> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1063205226 15063 80.91.224.253 (10 Sep 2003 14:47:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 10 Sep 2003 14:47:06 +0000 (UTC) Cc: emacs-devel@gnu.org, Stefan Monnier , Miles Bader Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Sep 10 16:47:02 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 19x6FJ-00051O-00 for ; Wed, 10 Sep 2003 16:47:01 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19x6Fj-0002Cc-00 for ; Wed, 10 Sep 2003 16:47:27 +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 19x6Cw-0004nv-MJ for emacs-devel@quimby.gnus.org; Wed, 10 Sep 2003 10:44:34 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 19x6Bh-0004TO-TS for emacs-devel@gnu.org; Wed, 10 Sep 2003 10:43:17 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 19x6Bd-0004Rv-Qe for emacs-devel@gnu.org; Wed, 10 Sep 2003 10:43:15 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 19x6Bc-0004R0-EK for emacs-devel@gnu.org; Wed, 10 Sep 2003 10:43:12 -0400 Original-Received: from miles by fencepost.gnu.org with local (Exim 4.20) id 19x66O-0007n8-C2; Wed, 10 Sep 2003 10:37:48 -0400 Original-To: Andreas B?sching Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i Blat: Foop 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:16270 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:16270 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). 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); -Miles -- Would you like fries with that?