[Freeciv-Dev] Re: [Patch] Watchtower v3
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
> > I totaly disagree here. The opposite would be useful: make all
> > rulesets server variables. Especialy on meta server games it is
> > a pain that you still can not change citymindist at runtime.
>
> That's what he was suggesting, basically.
>
> This qwould require a better (.e. half-decent) server cmdline parsing
> mechanism, strtok() at the least. That way it becomes easier to extend
> the syntax, which is required to represent all ruleset variables.
How about something like this? PERL-like split syntax, and the ability
to split on several different characters simultaneously (but always on
whitespace). As always, memory allocation rears its ugly head, but not
too badly. Sample code:
char *str = "foo bar.baz=5";
int nargs;
char **ptrs;
char **subptrs;
ptrs = fc_malloc(3 * sizeof(char *));
nargs = split("=", str, strlen(str), ptrs, 3);
if(nargs < 3) { err_msg(); }
/* ptrs[0] = "foo", ptrs[1] = "bar.baz", ptrs[2] = "5" */
subptrs = fc_malloc(2 * sizeof(char*));
nargs = split(".", ptrs[1], strlen(ptrs[1]), subptrs, 2);
if(nargs < 2) { err_msg2(); }
/* subptrs[0] = "bar", subptrs[1] = "baz" */
/* ... do stuff ... */
free(subptrs);
free(ptrs);
-jdm
Department of Computer Science, Duke University, Durham, NC 27708-0129
Email: justin@xxxxxxxxxxx
split-stdinhand-cvs.patch
Description: PERL-like split
- [Freeciv-Dev] Re: [Patch] Watchtower v3, (continued)
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Bert Buchholz, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Karl-Ingo Friese, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Jules Bean, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Karl-Ingo Friese, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Jules Bean, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Daniel L Speyer, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Reinier Post, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3,
Justin Moore <=
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Justin Moore, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Reinier Post, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Paul Zastoupil, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Justin Moore, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Paul Zastoupil, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Reinier Post, 2001/08/31
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Daniel Sjölie, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Sebastian Bauer, 2001/08/30
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Raimar Falke, 2001/08/31
- [Freeciv-Dev] Re: [Patch] Watchtower v3, Daniel L Speyer, 2001/08/31
|
|