make-ca: Handle getopt style short options in get_args().

This commit is contained in:
DJ Lucas 2021-08-07 00:40:39 -05:00
parent de5bf4a332
commit c79ee2ff79
2 changed files with 14 additions and 0 deletions

View File

@ -12,6 +12,7 @@
- Fix output of NSSDB and Java PCKS#12 stores
- Correct incorrectly named get_p11_val()
- Use p11label value and .p11-kit extension for anchor naming
- Handle getopt style short options in get_args()
1.7 - Revert help2man update (requires complete perl environment)
1.6 - Fix install target for make -j#
- Add detailed dependency info and add note about configuration file

13
make-ca
View File

@ -9,6 +9,8 @@
# Bruce Dubbs
# Graham Weldon
shopt -s extglob;
VERSION="1.8"
MAKE_CA_CONF="/etc/make-ca.conf"
@ -218,6 +220,17 @@ function get_args(){
echo -e "$(basename ${0}) ${VERSION}\n"
exit 0
;;
# Handle getopt style short args (use extglob instead of loop)
-+([a-z,A-Z]))
# split up the arguments and call recursively with trailing break
arg="${1}"
newargs=$( echo ${1} | sed 's@-@@' | \
sed 's/.\{1\}/& /g' | \
sed 's/[^ ]* */-&/g')
newargs="${newargs} $(echo ${@} | sed "s@${arg}@@")"
get_args ${newargs}
break;
;;
*)
showhelp
exit 1