diff options
author | Dave Reisner <dreisner@archlinux.org> | 2012-01-23 17:14:25 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-01-30 21:31:38 -0600 |
commit | 9e9835f4640a45cc758fa64de5923d7f836fe1f4 (patch) | |
tree | a105d263cda79f687fed3a91fb4bfec4267c1eb6 /scripts/repo-add.sh.in | |
parent | 7ff1b945f6c8b2286f04626be39291a7527119f4 (diff) | |
download | pacman-9e9835f4640a45cc758fa64de5923d7f836fe1f4.tar.xz |
scripts: always use printf with embedded gettext
This addresses two problems:
1) echo's behavior is inconsistent when dealing with flags, and can
potentially be problematic.
$ echo -n
$ echo -- -n
-- -n
2) Always using the end of options markers prevents translated strings
from throwing errors, as shown in FS#28069.
The remaining "inconsistencies" are because printf is being used in a
guaranteed safe manner, e.g.
printf '%s\n' "$(gettext "--this can never break")"
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts/repo-add.sh.in')
-rw-r--r-- | scripts/repo-add.sh.in | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 8c1d53da..26aa7257 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -45,48 +45,48 @@ m4_include(library/output_format.sh) # print usage instructions usage() { cmd=${0##*/} - printf "%s (pacman) %s\n\n" "$cmd" "$myver" + printf -- "%s (pacman) %s\n\n" "$cmd" "$myver" if [[ $cmd == "repo-add" ]] ; then - printf "$(gettext "Usage: repo-add [options] <path-to-db> <package|delta> ...\n")" - printf "\n" - printf "$(gettext "\ + printf -- "$(gettext "Usage: repo-add [options] <path-to-db> <package|delta> ...\n")" + printf -- "\n" + printf -- "$(gettext "\ repo-add will update a package database by reading a package file.\n\ Multiple packages to add can be specified on the command line.\n")" - printf "\n" - printf "$(gettext "Options:\n")" - printf "$(gettext " -d, --delta generate and add delta for package update\n")" - printf "$(gettext " -f, --files update database's file list\n")" + printf -- "\n" + printf -- "$(gettext "Options:\n")" + printf -- "$(gettext " -d, --delta generate and add delta for package update\n")" + printf -- "$(gettext " -f, --files update database's file list\n")" elif [[ $cmd == "repo-remove" ]] ; then - printf "$(gettext "Usage: repo-remove [options] <path-to-db> <packagename|delta> ...\n")" - printf "\n" - printf "$(gettext "\ + printf -- "$(gettext "Usage: repo-remove [options] <path-to-db> <packagename|delta> ...\n")" + printf -- "\n" + printf -- "$(gettext "\ repo-remove will update a package database by removing the package name\n\ specified on the command line from the given repo database. Multiple\n\ packages to remove can be specified on the command line.\n")" - printf "\n" - printf "$(gettext "Options:\n")" + printf -- "\n" + printf -- "$(gettext "Options:\n")" else - printf "$(gettext "Please move along, there is nothing to see here.\n")" + printf -- "$(gettext "Please move along, there is nothing to see here.\n")" return fi - printf "$(gettext " -q, --quiet minimize output\n")" - printf "$(gettext " -s, --sign sign database with GnuPG after update\n")" - printf "$(gettext " -k, --key <key> use the specified key to sign the database\n")" - printf "$(gettext " -v, --verify verify database's signature before update\n")" - printf "$(gettext "\n\ + printf -- "$(gettext " -q, --quiet minimize output\n")" + printf -- "$(gettext " -s, --sign sign database with GnuPG after update\n")" + printf -- "$(gettext " -k, --key <key> use the specified key to sign the database\n")" + printf -- "$(gettext " -v, --verify verify database's signature before update\n")" + printf -- "$(gettext "\n\ See %s(8) for more details and descriptions of the available options.\n")" $cmd printf "\n" if [[ $cmd == "repo-add" ]] ; then - printf "$(gettext "Example: repo-add /path/to/repo.db.tar.gz pacman-3.0.0-1-i686.pkg.tar.gz\n")" + printf -- "$(gettext "Example: repo-add /path/to/repo.db.tar.gz pacman-3.0.0-1-i686.pkg.tar.gz\n")" elif [[ $cmd == "repo-remove" ]] ; then - printf "$(gettext "Example: repo-remove /path/to/repo.db.tar.gz kernel26\n")" + printf -- "$(gettext "Example: repo-remove /path/to/repo.db.tar.gz kernel26\n")" fi } version() { cmd=${0##*/} printf "%s (pacman) %s\n\n" "$cmd" "$myver" - printf "$(gettext "\ + printf -- "$(gettext "\ Copyright (c) 2006-2012 Pacman Development Team <pacman-dev@archlinux.org>\n\n\ This is free software; see the source for copying conditions.\n\ There is NO WARRANTY, to the extent permitted by law.\n")" |