Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Apr 2011 01:19:02 +0000 (UTC)
From:      Doug Barton <dougb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r220531 - user/dougb/portmaster
Message-ID:  <201104110119.p3B1J3Qk065652@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dougb
Date: Mon Apr 11 01:19:02 2011
New Revision: 220531
URL: http://svn.freebsd.org/changeset/base/220531

Log:
  Make the --index* options more friendly to being duplicated in the rc file
  and command line. Mixing different options will still trigger an error,
  however having the same option both places will not.

Modified:
  user/dougb/portmaster/portmaster

Modified: user/dougb/portmaster/portmaster
==============================================================================
--- user/dougb/portmaster/portmaster	Sun Apr 10 20:43:07 2011	(r220530)
+++ user/dougb/portmaster/portmaster	Mon Apr 11 01:19:02 2011	(r220531)
@@ -557,10 +557,11 @@ cross_idx () {
 
 	e1='The --index, --index-first, and --index-only options are mutually exclusive'
 
-	case "$1" in
-	index)		[ -n "$PM_INDEX_FIRST" -o -n "$PM_INDEX_ONLY" ] && fail $e1 ;;
-	first)		[ -n "$PM_INDEX" -o -n "$PM_INDEX_ONLY" ] && fail $e1 ;;
-	only)		[ -n "$PM_INDEX" -o -n "$PM_INDEX_FIRST" ] && fail $e1 ;;
+	case "$*" in
+	*--index*--index*)	fail $e1 ;;
+	index\ *)		[ -n "$PM_INDEX_FIRST" -o -n "$PM_INDEX_ONLY" ] && fail $e1 ;;
+	first\ *)		[ -n "$PM_INDEX_ONLY" ] && fail $e1 ;;
+	only\ *)		[ -n "$PM_INDEX_FIRST" ] && fail $e1 ;;
 	esac
 }
 
@@ -597,11 +598,11 @@ for var in "$@" ; do
 	--no-term-title)	PM_NO_TERM_TITLE=pm_no_term_title
 				export PM_NO_TERM_TITLE ;;
 	--no-index-fetch)	PM_NO_INDEX_FETCH=pm_no_index_fetch ;;
-	--index)		cross_idx index ; PM_INDEX=pm_index ; export PM_INDEX ;;
-	--index-first)		cross_idx first ; PM_INDEX=pm_index
+	--index)		cross_idx "index $*" ; PM_INDEX=pm_index ; export PM_INDEX ;;
+	--index-first)		cross_idx "first $*" ; PM_INDEX=pm_index
 				PM_INDEX_FIRST=pm_index_first
 				export PM_INDEX PM_INDEX_FIRST ;;
-	--index-only)		cross_idx only ; PM_INDEX=pm_index
+	--index-only)		cross_idx "only $*" ; PM_INDEX=pm_index
 				PM_INDEX_ONLY=pm_index_only
 				export PM_INDEX PM_INDEX_ONLY ;;
 	--help)			usage 0 ;;



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