diff options
Diffstat (limited to 'common.sh.in')
-rw-r--r-- | common.sh.in | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/common.sh.in b/common.sh.in index 614f462..b2b4768 100644 --- a/common.sh.in +++ b/common.sh.in @@ -1,6 +1,6 @@ # begin common.sh {{{ -# Copyright (C) 2013-2014 Luke Shumaker <lukeshu@sbcglobal.net> +# Copyright (C) 2013-2014, 2016 Luke Shumaker <lukeshu@sbcglobal.net> # # This file is not considered part of GNU Emacs. # @@ -17,6 +17,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +unset IFS +IFS=$' \t\n' + if type gettext &>/dev/null; then _() { gettext "$@"; } else @@ -48,10 +51,6 @@ emacs_quote() { printf -- '"%s" ' "${args[@]}" # wrap them in quotes, return } -bash_quote() { - printf -- '%q ' "$@" -} - version() { print '%s (Emacs utils) %s, %s' \ "${0##*/}" @VERSION@ "$(emacsclient --version)" @@ -106,4 +105,17 @@ emacs_usage() { emacsclient --help | grep -E '^(\s|-)' } + +next() { + local mode=$1 + shift + case "$mode" in + error) print "Try \``%q --help'' for more information" "$0" >&2; return 1;; + usage) usage; return 0;; + version) version; return 0;; + normal) exec -- "$@";; + *) error 'Internal error. The programmer writing this tool screwed up.'; exit 1;; + esac +} + # }}} end common.sh |