buildroot/package/gettext-tiny/gettext-wrapper
Yann E. MORIN b5afd8dfd5 package/gettext-tiny: fix gettext wrapper
When a textdomain is specified, we ignore it twice: we shift args, and
we printf ${2}, which would yield an empty printf.

Fix that by not shifting, and just printf ${2}; this is nicer.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Vadim Kochan <vadim4j@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2019-11-15 22:14:20 +01:00

25 lines
730 B
Bash

#!/bin/sh
#
# Thanks to "Yann E. MORIN" <yann.morin.1998@free.fr>
# for this gettext replacement.
while [ ${#} -ne 0 ]; do
case "${1}" in
(-h) printf "no help\n"; return 0;;
(-V) printf "0.0.0\n"; return 0;;
(-d|--domain) shift 2;;
(-d*|--domain=*) shift 1;;
(-e|-E|-n) shift 1;;
(-s) shift 1;; # Ignore?
(-*) printf "invalid option '%s'\n" "${1}" >&2; return 1;;
(*) break;;
esac
done
case ${#} in
(0) printf "missing arguments\n" >&2; return 1;;
(1) printf "%s" "${1}";;
(2) printf "%s" "${2}";;
(*) printf "too many arguments\n" >&2; return 1;;
esac