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 1RlYvH-0007So-LB for garchives@archives.gentoo.org; Fri, 13 Jan 2012 04:39:27 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E67FAE058A; Fri, 13 Jan 2012 04:39:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id AFCBDE058A for ; Fri, 13 Jan 2012 04:39:19 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 33CCE1B4003 for ; Fri, 13 Jan 2012 04:39:19 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id A40F780044 for ; Fri, 13 Jan 2012 04:39:15 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: Subject: [gentoo-commits] proj/openrc:master commit in: net/ X-VCS-Repository: proj/openrc X-VCS-Files: net/iproute2.sh X-VCS-Directories: net/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: e7649f117af827a855baeaa2fc72a5cf1a09f31c Date: Fri, 13 Jan 2012 04:39:15 +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: 97b04e07-ef0d-4370-8ff2-ce4635ba8b12 X-Archives-Hash: 11acfd6649402cf0f3dcb6f3996630b9 commit: e7649f117af827a855baeaa2fc72a5cf1a09f31c Author: Robin H. Johnson gentoo org> AuthorDate: Fri Jan 13 04:38:31 2012 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Fri Jan 13 04:38:31 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3De7649f11 net/iproute2: Handle shortened arguments Allow users to shorten iproute arguments to the shortest unique argument that will match a flag of iproute2. X-Gentoo-Bug: 398721 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=3D398721 Signed-off-by: Robin H. Johnson gentoo.org> --- net/iproute2.sh | 35 +++++++++++++++++++++++------------ 1 files changed, 23 insertions(+), 12 deletions(-) diff --git a/net/iproute2.sh b/net/iproute2.sh index 9b89352..09912bf 100644 --- a/net/iproute2.sh +++ b/net/iproute2.sh @@ -101,24 +101,35 @@ _add_address() ip addr add "$@" dev "${IFACE}" 2>/dev/null return 0 fi - + local x local address netmask broadcast peer anycast label scope local valid_lft preferred_lft home nodad local confflaglist address=3D"$1" ; shift while [ -n "$*" ]; do - case "$1" in - netmask) - netmask=3D"/$(_netmask2cidr "$2")" ; shift ; shift ;; - broadcast|brd) - broadcast=3D"$2" ; shift ; shift ;; - pointopoint|pointtopoint|peer) - peer=3D"$2" ; shift ; shift ;; - anycast|label|scope|valid_lft|preferred_lft) - eval "$1=3D$2" ; shift ; shift ;; - home|nodad) + x=3D$1 ; shift + case "$x" in + netmask|ne*) + netmask=3D"/$(_netmask2cidr "$1")" ; shift ;; + broadcast|brd|br*) + broadcast=3D"$1" ; shift ;; + pointopoint|pointtopoint|peer|po*|pe*) + peer=3D"$1" ; shift ;; + anycast|label|scope|valid_lft|preferred_lft|a*|l*|s*|v*|pr*) + case $x in + a*) x=3Danycast ;; + l*) x=3Dlabel ;; + s*) x=3Dscope ;; + v*) x=3Dvalid_lft ;; + pr*) x=3Dpreferred_lft ;; + esac + eval "$x=3D$1" ; shift ;; + home|nodad|h*|no*) + case $x in h*) x=3Dhome ;; n*) x=3Dnodad ;; esac # FIXME: If we need to reorder these, this will take more code - confflaglist=3D"${confflaglist} $1" ; shift ;; + confflaglist=3D"${confflaglist} $x" ; ;; + *) + ewarn "Unknown argument to config_$IFACE: $x" esac done =20