Note: Due to technical difficulties, the Archives are currently not up to date.
GMANE provides an alternative service for most mailing lists. c.f. bug 424647
List Archive: gentoo-commits
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@g.o>
+
+ * emacs.eselect (do_show, do_list, do_set, do_update): Test for
+ number of parameters. Quote variables correctly.
+
2007-06-17 Ulrich Mueller <ulm@g.o>
* 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"
|
|