<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40196 >
On 09/04/2008, Madeline Book wrote:
> As far as I can see the mystrncasequotecmp function
> is only used by find_player_by_name_prefix. Why would
> the player names in the internal server/client data
> structures (i.e. in game.players) have meaningless
> (i.e. not significant for comparison) quotes around
> them at all?
> I would think that this should never be the case; the
> server and client should never store strings wrapped
> in meaningless quotes, and should always remove them
> when parsing input (i.e. from rulesets or command arguments).
find_<something>_by_name_prefix() is for parsing user input (computer
can pass full strings, lazy humans want to type only prefix)
> Quotes should only be used in input data when argument
> separators (e.g. a space or a newline) need to be included
> in the string. To have them in the internal data structures
> would imply that they are meant as part of the string (e.g.
> they were escaped in the original), and so should not in
> fact be ignored.
We agree on principles.
I think current implementation works according to these principles
(that's a bit hard to see from the design) Good thing about current
implementation is that quote removal is in one place only instead of
each command requiring separate code (as in Pepeto's #39614 stdinhand
Best solution would be to tokenize input in just one place before
execution branches to separate commands. That would require quite a
big rewrite, I'm afraid (too much work compared to benefit)
Freeciv-dev mailing list