unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
Cc: emacs-devel@gnu.org, Stefan Monnier <monnier@IRO.UMontreal.CA>,
	Miles Bader <miles@gnu.org>
Subject: Re: extensions for emacsclient (CVS version)
Date: Wed, 10 Sep 2003 10:37:48 -0400	[thread overview]
Message-ID: <20030910143748.GA27983@fencepost> (raw)
In-Reply-To: <xtzn0dcu58h.fsf@dataman.informatik.uni-bremen.de>

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?

  reply	other threads:[~2003-09-10 14:37 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-10  8:26 extensions for emacsclient (CVS version) Andreas Büsching
2003-09-10  8:44 ` Miles Bader
2003-09-10  9:00   ` Andreas Büsching
2003-09-10  9:30     ` Miles Bader
2003-09-10 10:56       ` Andreas Büsching
2003-09-10 11:36         ` Miles Bader
2003-09-10 11:40           ` Andreas Büsching
2003-09-10 12:38             ` Stefan Monnier
2003-09-10 13:45               ` Andreas Büsching
2003-09-10 14:37                 ` Miles Bader [this message]
2003-09-10 15:00                   ` Andreas Büsching
2003-09-10 15:09                     ` Miles Bader
2003-09-11  6:57                   ` Andreas Büsching
2003-09-11 23:47                     ` Richard Stallman
2003-09-12  5:22                       ` Andreas Buesching
2003-09-12 21:06                         ` Richard Stallman
2003-09-12  7:35                       ` Andreas Büsching
2003-09-10 14:41                 ` Stefan Monnier
2003-09-10 15:02                   ` Andreas Büsching
2003-09-10 15:08                     ` Stefan Monnier
2003-09-10 16:13                       ` David Kastrup
2003-09-10 16:22                         ` Andreas Büsching
2003-09-10 16:50                           ` David Kastrup
2003-09-10 19:40                           ` Alex Schroeder
2003-09-11  5:20                             ` Andreas Buesching
2003-09-11 19:30                             ` Andreas Buesching
2003-09-11 21:22                               ` Miles Bader
2003-09-12 21:06                                 ` Richard Stallman
2003-09-11 23:46                           ` Richard Stallman
2003-09-12 15:38                             ` Stefan Monnier
2003-09-12 22:49                               ` Alex Schroeder
2003-09-13 13:56                               ` Richard Stallman
2003-09-11 13:16 ` Richard Stallman
2003-09-11 14:15   ` Andreas Büsching

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20030910143748.GA27983@fencepost \
    --to=miles@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).