emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extensions for emacsclient (CVS version)


From: Andreas Büsching
Subject: Re: extensions for emacsclient (CVS version)
Date: Thu, 11 Sep 2003 08:57:32 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Miles Bader <address@hidden> 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).
>
> 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);

Okay, Here is another version of the patch, with a new version of
quote_file_name and the bug fix suggested by Sfefan and Miles.

and again RFC

crunchy


Attachment: emacsclient.c.patch
Description: Text Data

-- 
BREAKFAST.COM halted... cereal port not responding!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]