1 |
On Tue, 6 Feb 2007, Roy Marples wrote: |
2 |
|
3 |
> This email is about network configuration. Before I joined Gentoo, |
4 |
> network configuration was done in bash arrays like so (note, that the |
5 |
> variable name was changed in baselayout-1.11) |
6 |
> |
7 |
> ifconfig_eth0=( |
8 |
> "10.1.1.1 netmask 255.255.255.0" |
9 |
> "10.1.1.2 netmask 255.255.255.0" |
10 |
> ) |
11 |
> |
12 |
> This is all well and good, but only bash and zsh can use it. |
13 |
|
14 |
That's not true. Only bash and zsh can *source* it. Aside from the fact |
15 |
that most other shells don't have any way of storing the results of |
16 |
reading such a file in an accessible way, that format is easy enough to |
17 |
parse with a bit of sed. |
18 |
|
19 |
> Who's got any bright ideas for a new config then? Lets brain storm! |
20 |
|
21 |
If it's necessary to change at all, I'd vote for sections in square |
22 |
brackets, applying to everything until the next square bracket, and lines |
23 |
with a key, followed by a ':' or '=', followed by optional whitespace, |
24 |
followed by any number of values, optionally in quotes with |
25 |
backslash-escaped quotes and backslashes, separated by whitespace, with |
26 |
the value lists for duplicate keys being concatenated. |
27 |
|
28 |
It's not hard to parse (assuming, again, that you have some way to store |
29 |
the results), users coming from Windows can write it as "ini" files, users |
30 |
who like Java can write it as resource files, and old-school Unix types |
31 |
can write RFC822 headers. And they're all mutually comprehensible if the |
32 |
parser is just reasonably lenient. |
33 |
|
34 |
-Daniel |
35 |
*This .sig left intentionally blank* |
36 |
-- |
37 |
gentoo-dev@g.o mailing list |