Gentoo Archives: gentoo-commits

From: Ulrich Mueller <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/emacs-tools:eselect-emacs-1.1 commit in: /
Date: Fri, 22 Jun 2012 17:30:04
Message-Id: 1182520436.6ad92f033249d0563fe44657d04a5a6b82439c55.ulm@gentoo
1 commit: 6ad92f033249d0563fe44657d04a5a6b82439c55
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 22 13:53:56 2007 +0000
4 Commit: Ulrich Mueller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 22 13:53:56 2007 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/emacs-tools.git;a=commit;h=6ad92f03
7
8 Test for number of parameters. Quote variables correctly.
9
10 svn path=/emacs-extra/eselect-emacs/; revision=448
11
12 ---
13 ChangeLog | 5 +++++
14 emacs.eselect | 14 +++++++-------
15 2 files changed, 12 insertions(+), 7 deletions(-)
16
17 diff --git a/ChangeLog b/ChangeLog
18 index b64ef9a..6ef0d99 100644
19 --- a/ChangeLog
20 +++ b/ChangeLog
21 @@ -1,3 +1,8 @@
22 +2007-06-22 Ulrich Mueller <ulm@g.o>
23 +
24 + * emacs.eselect (do_show, do_list, do_set, do_update): Test for
25 + number of parameters. Quote variables correctly.
26 +
27 2007-06-17 Ulrich Mueller <ulm@g.o>
28
29 * version 1.0
30
31 diff --git a/emacs.eselect b/emacs.eselect
32 index ab413d0..895368c 100644
33 --- a/emacs.eselect
34 +++ b/emacs.eselect
35 @@ -145,13 +145,13 @@ describe_show() {
36 }
37
38 do_show() {
39 - [[ -z "${@}" ]] || die -q "Too many parameters"
40 + [[ ${#@} -gt 0 ]] && die -q "Too many parameters"
41
42 write_list_start "Current target of GNU Emacs symlink:"
43 if [[ -L "${ROOT}/usr/bin/emacs" && \
44 -e $(canonicalise "${ROOT}/usr/bin/emacs") ]]; then
45 write_kv_list_entry \
46 - "$(basename $(canonicalise ${ROOT}/usr/bin/emacs) )" ""
47 + $(basename $(canonicalise "${ROOT}/usr/bin/emacs") ) ""
48 elif [[ -e "${ROOT}/usr/bin/emacs" ]]; then
49 write_kv_list_entry \
50 "(not a symlink or target of symlink does not exist)" ""
51 @@ -168,7 +168,7 @@ describe_list() {
52 }
53
54 do_list() {
55 - [[ -z "${@}" ]] || die -q "Too many parameters"
56 + [[ ${#@} -gt 0 ]] && die -q "Too many parameters"
57
58 local i targets
59 targets=( $(find_targets) )
60 @@ -204,7 +204,7 @@ describe_set_parameters() {
61
62 do_set() {
63 [[ -z "${1}" ]] && die -q "You didn't tell me what to set the symlink to"
64 - [[ -n "${2}" ]] && die -q "Too many parameters"
65 + [[ ${#@} -gt 1 ]] && die -q "Too many parameters"
66 test_for_root
67
68 if [[ -e "${ROOT}/usr/bin/emacs" ]] \
69 @@ -226,13 +226,13 @@ describe_update_options() {
70 }
71
72 do_update() {
73 - [[ -z "${1}" || ( -z "${2}" && "${1}" == "--if-unset" ) ]] \
74 - || die -q "Usage error"
75 + [[ -z "${1}" || "${1}" == "--if-unset" ]] || die -q "Usage error"
76 + [[ ${#@} -gt 1 ]] && die -q "Too many parameters"
77 test_for_root
78
79 if [[ -L "${ROOT}/usr/bin/emacs" ]]; then
80 [[ ${1} == "--if-unset" \
81 - && -e "$(canonicalise ${ROOT}/usr/bin/emacs)" ]] && return
82 + && -e $(canonicalise "${ROOT}/usr/bin/emacs") ]] && return
83 # this is not redundant: "update" is called in pkg_postrm() of emacs
84 # and should clean up any dead symlinks if no valid target exists
85 remove_symlinks || die -q "Couldn't remove existing symlink"