From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1R68n2-00076k-13 for garchives@archives.gentoo.org; Tue, 20 Sep 2011 22:27:44 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5104021C061; Tue, 20 Sep 2011 22:27:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1CB6621C061 for ; Tue, 20 Sep 2011 22:27:36 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A2BA91B4029 for ; Tue, 20 Sep 2011 22:27:35 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id A6D4C80042 for ; Tue, 20 Sep 2011 22:27:34 +0000 (UTC) From: "Christian Ruppert" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Christian Ruppert" Message-ID: <930f4021b1904b9c46c41c70b99d6e0620a1b59d.idl0r@gentoo> Subject: [gentoo-commits] proj/openrc:master commit in: init.d/ X-VCS-Repository: proj/openrc X-VCS-Files: init.d/net.lo.in X-VCS-Directories: init.d/ X-VCS-Committer: idl0r X-VCS-Committer-Name: Christian Ruppert X-VCS-Revision: 930f4021b1904b9c46c41c70b99d6e0620a1b59d Date: Tue, 20 Sep 2011 22:27:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 2f5cceb2c9e38f0104dea5d968c28eed commit: 930f4021b1904b9c46c41c70b99d6e0620a1b59d Author: Christian Ruppert gentoo org> AuthorDate: Tue Sep 20 22:21:43 2011 +0000 Commit: Christian Ruppert gentoo org> CommitDate: Tue Sep 20 22:21:43 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3D930f4021 Add a new helper functions for _{flatten,get}_array A new helper function (_array_helper) since both, the _flatten_array and _get_array function share partially the same code. We also reduce multiple whitespace to a single space, remove leading newl= ines as well as skipping "empty" lines. This makes the data returned by _{flatten,get}_array much nicer than befo= re. It also fixes bug 366677 where net-tools having trouble with the whitespa= ce mentioned above. iproute2 was not affected. Reported-by: Andrew Maltsev ejelta.com> X-Gentoo-Bug: 366677 X-Gentoo-Bug-URL: https://bugs.gentoo.org/366677 --- init.d/net.lo.in | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/init.d/net.lo.in b/init.d/net.lo.in index 2f052ca..9b6bf64 100644 --- a/init.d/net.lo.in +++ b/init.d/net.lo.in @@ -41,6 +41,15 @@ depend() done } =20 +_array_helper() { + local _a=3D + + eval _a=3D\$$1 + _a=3D$(echo "${_a}" | sed -e 's:^[[:space:]]*::' -e 's:[[:space:]]*$::'= -e '/^$/d' -e 's:[[:space:]]\{1,\}: :g') + + [ -n "${_a}" ] && printf "%s\n" "${_a}" +} + # Support bash arrays - sigh _get_array() { @@ -60,10 +69,7 @@ _get_array() esac fi =20 - eval _a=3D\$$1 - printf "%s" "${_a}" - printf "\n" - [ -n "${_a}" ] + _array_helper $1 } =20 # Flatten bash arrays to simple strings @@ -84,10 +90,7 @@ _flatten_array() esac fi =20 - eval _a=3D\$$1 - printf "%s" "${_a}" - printf "\n" - [ -n "${_a}" ] + _array_helper $1 } =20 _wait_for_carrier()