Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Oct 2010 18:40:01 -0400
From:      Mark Johnston <markjdb@gmail.com>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Space character in rc.conf variable
Message-ID:  <20101030224001.GA10529@mark-laptop-bsd.mark-home>
In-Reply-To: <20101030220828.GA24395@stack.nl>
References:  <AANLkTinQ6QpKacJLnKU=zgSYMo-NG7PajG26wBVxw0PR@mail.gmail.com> <4CCC7C07.8080903@FreeBSD.org> <20101030220828.GA24395@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Oct 31, 2010 at 12:08:28AM +0200, Jilles Tjoelker wrote:
> Array support in the shell could make this easier, but not much unless
> the rc.conf syntax would be changed as well, like
>   ifconfig_wlan0=(ssid "SSID WITH SPACE" dhcp)
> but then changed some more such that "DHCP" can be used as SSID.
> 
> Array support would add a fair bit of code to sh, and even then it will
> remain fairly limited and clumsy. For example, an array can only be
> returned from a function by passing the name of an existing array to
> place the result in and using eval, extending setvar in some strange way
> or implementing another ksh93 extension, namerefs.
> 
> -- 
> Jilles Tjoelker

Incidentally, I've actually been working on this, though it was more for
fun than anything else - my impression is that new features for sh(1)
are generally unwelcome because of the testing required and the
possibility of regressions. I have some of the syntax working, e.g.

$ foo[1]=one
$ foo[2]=two
$ foo[3]=three
$ echo ${foo[1]} ${foo[2]} ${foo[3]}
one two three
$ unset foo[2]
$ echo ${foo[1]} ${foo[2]} ${foo[3]}
one three

It was while working on the ${#arr[@]} syntax that I ran into
bin/151720.

If people are actually interested in this, I can discuss my changes in
more detail. The actually array implementation is quite simple, around
200 LOC... a number of changes to var.c, parser.c and eval.c are
necessary however.

-Mark



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101030224001.GA10529>