summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-10-12 14:49:11 (EDT)
committer P. J. McDermott <pjm@nac.net>2013-10-12 14:49:11 (EDT)
commit6b6ef334901b74677a484624bde426c425795e61 (patch)
treec6a3ea794ce2d676e6789a6c68bef14244d5cfa9
parent04eff6b0b42f46088c3e6da0f04d34b366f2ac34 (diff)
OPTSTRING: New global variable.
-rw-r--r--lib/cmd.sh3
-rw-r--r--lib/cmd/help.sh2
-rw-r--r--src/pro-archman.sh3
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/cmd.sh b/lib/cmd.sh
index a14eb00..d05e7eb 100644
--- a/lib/cmd.sh
+++ b/lib/cmd.sh
@@ -39,14 +39,13 @@ load_cmds()
print_opt_summaries()
{
- local optstring="${1}"
local padding=
local opt=
local opt_out=
local summary=
padding="$(printf '%24s' '')"
- for opt in $(printf '%s' "${optstring}" | sed 's/\([a-zA-Z0-9]\)/ \1/g')
+ for opt in $(printf '%s' "${OPTSTRING}" | sed 's/\([a-zA-Z0-9]\)/ \1/g')
do
if [ ${#opt} -eq 1 ]; then
# No argument expected.
diff --git a/lib/cmd/help.sh b/lib/cmd/help.sh
index e186663..42b1e63 100644
--- a/lib/cmd/help.sh
+++ b/lib/cmd/help.sh
@@ -33,7 +33,7 @@ cmd_help_main()
printf "$(get_msg 'cmd_help_head')\n\n" "${0}"
printf "$(get_msg 'cmd_help_opts_head')\n"
- print_opt_summaries 'hVb:'
+ print_opt_summaries
printf '\n'
printf "$(get_msg 'cmd_help_summary_head')\n"
diff --git a/src/pro-archman.sh b/src/pro-archman.sh
index 2e0332e..dd8fe2e 100644
--- a/src/pro-archman.sh
+++ b/src/pro-archman.sh
@@ -29,6 +29,7 @@ PKGLIBCMDDIR='@@PKGLIBCMDDIR@@'
PKGLIBCMD='@@PKGLIBCMD@@'
LF='
'
+OPTSTRING='hVb:'
# Global variables
loading_cmd=
@@ -123,7 +124,7 @@ get_options()
{
local opt=
- while getopts 'b:hV' opt; do
+ while getopts "${OPTSTRING}" opt; do
case "${opt}" in
'b')
opt_base_dir="$(cd "${OPTARG}" && pwd)"