[Top][All Lists]
[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: |
Wed, 10 Sep 2003 17:00:45 +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).
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?
- Re: extensions for emacsclient (CVS version), (continued)
- Re: extensions for emacsclient (CVS version), Alex Schroeder, 2003/09/10
- Re: extensions for emacsclient (CVS version), Andreas Buesching, 2003/09/11
- Re: extensions for emacsclient (CVS version), Andreas Buesching, 2003/09/11
- Re: extensions for emacsclient (CVS version), Miles Bader, 2003/09/11
- Re: extensions for emacsclient (CVS version), Richard Stallman, 2003/09/12
- Re: extensions for emacsclient (CVS version), Richard Stallman, 2003/09/11
- Re: extensions for emacsclient (CVS version), Stefan Monnier, 2003/09/12
- Re: extensions for emacsclient (CVS version), Alex Schroeder, 2003/09/12
- Re: extensions for emacsclient (CVS version), Richard Stallman, 2003/09/13
- Re: extensions for emacsclient (CVS version), Miles Bader, 2003/09/10
- Re: extensions for emacsclient (CVS version),
Andreas Büsching <=
- Re: extensions for emacsclient (CVS version), Miles Bader, 2003/09/10
- Re: extensions for emacsclient (CVS version), Andreas Büsching, 2003/09/11
- Re: extensions for emacsclient (CVS version), Richard Stallman, 2003/09/11
- Re: extensions for emacsclient (CVS version), Andreas Buesching, 2003/09/12
- Re: extensions for emacsclient (CVS version), Richard Stallman, 2003/09/12
- Re: extensions for emacsclient (CVS version), Andreas Büsching, 2003/09/12
Re: extensions for emacsclient (CVS version), Richard Stallman, 2003/09/11