From owner-freebsd-hackers@FreeBSD.ORG Sat Oct 30 22:40:19 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47E721065694 for ; Sat, 30 Oct 2010 22:40:19 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 09F4A8FC08 for ; Sat, 30 Oct 2010 22:40:18 +0000 (UTC) Received: by iwn39 with SMTP id 39so5277355iwn.13 for ; Sat, 30 Oct 2010 15:40:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=gIsK3jNIQqISiGrl2SujRQhrzbXk3XO+b51IugKFQ1E=; b=Evnus5RMj5byt2tUl1JCxHpMjWh6M+AxWtaUNoMVQk2LWQz94apL3o4TDQip83s6AM VkNclrVPv6o/zvQT4v+Ym7uoYv0y967IK4JWI5TAYn5pHlODDVhJflWVuQTf0HUjK8nV zzFlx3HuZ7NPHV1Ak+jFQFvKEp6eEzao/YNKM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=Lw+tlZux1ILY18zRVk3o7J7cIYPkqKHvhTaH2VT/WNh5m8FOifhtLX36kcO0aSJxjY vHb2XP5bN2DRftKhEq4tiCXnwmHdSwU31ZUECddzvdGCiPyJS8Yxf2ZUuNqq6Ekerqc5 +PzI02Fskbv5MWOl/KxHfkLVcmYiR0bditTQU= Received: by 10.42.191.139 with SMTP id dm11mr209016icb.391.1288478418336; Sat, 30 Oct 2010 15:40:18 -0700 (PDT) Received: from mark-laptop-bsd.mark-home ([38.112.100.65]) by mx.google.com with ESMTPS id u6sm5829617ibd.0.2010.10.30.15.40.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 30 Oct 2010 15:40:17 -0700 (PDT) Date: Sat, 30 Oct 2010 18:40:01 -0400 From: Mark Johnston To: Jilles Tjoelker Message-ID: <20101030224001.GA10529@mark-laptop-bsd.mark-home> References: <4CCC7C07.8080903@FreeBSD.org> <20101030220828.GA24395@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20101030220828.GA24395@stack.nl> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-hackers@freebsd.org Subject: Re: Space character in rc.conf variable X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 22:40:19 -0000 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