public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ulrich Mueller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/emacs-tools:eselect-emacs-1.1 commit in: /
Date: Fri, 22 Jun 2012 17:29:23 +0000 (UTC)	[thread overview]
Message-ID: <1182520436.6ad92f033249d0563fe44657d04a5a6b82439c55.ulm@gentoo> (raw)

commit:     6ad92f033249d0563fe44657d04a5a6b82439c55
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 22 13:53:56 2007 +0000
Commit:     Ulrich Mueller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri Jun 22 13:53:56 2007 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/emacs-tools.git;a=commit;h=6ad92f03

Test for number of parameters. Quote variables correctly.

svn path=/emacs-extra/eselect-emacs/; revision=448

---
 ChangeLog     |    5 +++++
 emacs.eselect |   14 +++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b64ef9a..6ef0d99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-06-22  Ulrich Mueller  <ulm@gentoo.org>
+
+	* emacs.eselect (do_show, do_list, do_set, do_update): Test for
+	number of parameters. Quote variables correctly.
+
 2007-06-17  Ulrich Mueller  <ulm@gentoo.org>
 
 	* version 1.0

diff --git a/emacs.eselect b/emacs.eselect
index ab413d0..895368c 100644
--- a/emacs.eselect
+++ b/emacs.eselect
@@ -145,13 +145,13 @@ describe_show() {
 }
 
 do_show() {
-	[[ -z "${@}" ]] || die -q "Too many parameters"
+	[[ ${#@} -gt 0 ]] && die -q "Too many parameters"
 
 	write_list_start "Current target of GNU Emacs symlink:"
 	if [[ -L "${ROOT}/usr/bin/emacs" && \
 		  -e $(canonicalise "${ROOT}/usr/bin/emacs") ]]; then
 		write_kv_list_entry \
-			"$(basename $(canonicalise ${ROOT}/usr/bin/emacs) )" ""
+			$(basename $(canonicalise "${ROOT}/usr/bin/emacs") ) ""
 	elif [[ -e "${ROOT}/usr/bin/emacs" ]]; then
 		write_kv_list_entry \
 			"(not a symlink or target of symlink does not exist)" ""
@@ -168,7 +168,7 @@ describe_list() {
 }
 
 do_list() {
-	[[ -z "${@}" ]] || die -q "Too many parameters"
+	[[ ${#@} -gt 0 ]] && die -q "Too many parameters"
 
 	local i targets
 	targets=( $(find_targets) )
@@ -204,7 +204,7 @@ describe_set_parameters() {
 
 do_set() {
 	[[ -z "${1}" ]] && die -q "You didn't tell me what to set the symlink to"
-	[[ -n "${2}" ]] && die -q "Too many parameters"
+	[[ ${#@} -gt 1 ]] && die -q "Too many parameters"
 	test_for_root
 
 	if [[ -e "${ROOT}/usr/bin/emacs" ]] \
@@ -226,13 +226,13 @@ describe_update_options() {
 }
 
 do_update() {
-	[[ -z "${1}" || ( -z "${2}" && "${1}" == "--if-unset" ) ]] \
-		|| die -q "Usage error"
+	[[ -z "${1}" || "${1}" == "--if-unset" ]] || die -q "Usage error"
+	[[ ${#@} -gt 1 ]] && die -q "Too many parameters"
 	test_for_root
 
 	if [[ -L "${ROOT}/usr/bin/emacs" ]]; then
 		[[ ${1} == "--if-unset" \
-			&& -e "$(canonicalise ${ROOT}/usr/bin/emacs)" ]] && return
+			&& -e $(canonicalise "${ROOT}/usr/bin/emacs") ]] && return
 		# this is not redundant: "update" is called in pkg_postrm() of emacs
 		# and should clean up any dead symlinks if no valid target exists
 		remove_symlinks || die -q "Couldn't remove existing symlink"



             reply	other threads:[~2012-06-22 17:30 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-22 17:29 Ulrich Mueller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-06-22 17:29 [gentoo-commits] proj/emacs-tools:eselect-emacs-1.1 commit in: / Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller
2012-06-22 17:29 Ulrich Mueller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1182520436.6ad92f033249d0563fe44657d04a5a6b82439c55.ulm@gentoo \
    --to=ulm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox