From 8b9f2e30834c469cfe4529c64c355d548c8b00cf Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 25 May 2017 16:43:13 -0400 Subject: more $EXIT_* usage --- src/lib/libreblacklist | 2 +- src/lib/librelib | 10 +++++----- src/lib/librexgettext | 10 +++++++--- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/lib/libreblacklist b/src/lib/libreblacklist index 595b22d..df50398 100755 --- a/src/lib/libreblacklist +++ b/src/lib/libreblacklist @@ -63,7 +63,7 @@ else while read -r line; do print "$line"; done | sed "s/blacklist-/${0##*/} /g" | fmt -us - return 0 + exit $EXIT_SUCCESS fi done < <(usage-outside) fi diff --git a/src/lib/librelib b/src/lib/librelib index 5f17b6f..332f172 100755 --- a/src/lib/librelib +++ b/src/lib/librelib @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright (C) 2013-2014 Luke Shumaker +# Copyright (C) 2013-2014, 2017 Luke Shumaker # # License: GNU GPLv2+ # @@ -69,11 +69,11 @@ usage() { main() { if [[ $# != 1 ]]; then _l usage >&2 - return 2 + return 2 # $EXIT_INVALIDARGUMENT fi if [[ $1 == '-h' ]]; then _l usage - return 0; + return 0 # $EXIT_SUCCESS fi if [[ -z $LIBRETOOLS_LIBDIR ]]; then @@ -87,11 +87,11 @@ main() { for file in ${lib} libre${lib} ${lib}.sh libre${lib}.sh; do if [[ -f "$LIBRETOOLS_LIBDIR/$file" ]]; then printf '%s\n' "$LIBRETOOLS_LIBDIR/$file" - return 0; + return 0 # $EXIT_SUCCESS fi done _l print '%s: could not find library: %s' "$cmd" "$lib" >&2 - return 1 + return 1 # $EXIT_FAILURE } main "$@" diff --git a/src/lib/librexgettext b/src/lib/librexgettext index a4f2eb9..cc18999 100755 --- a/src/lib/librexgettext +++ b/src/lib/librexgettext @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright (C) 2013-2016 Luke Shumaker +# Copyright (C) 2013-2017 Luke Shumaker # # License: GNU GPLv2+ # @@ -16,6 +16,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# NB: During normal operation (i.e. not printing `usage()`) text, we +# don't use librelib. This is important as we need to be able to run +# this program statically in-place when building libretools. + export TEXTDOMAIN='librelib' export TEXTDOMAINDIR='/usr/share/locale' @@ -196,7 +200,7 @@ main() { --prose) i+=1; prose+=(--keyword="${!i}");; --prose=*) prose+=(--keyword="${!i#*=}");; -k) use_defaults=false;; - --help|-h) usage; return 0;; + --help|-h) usage; return 0;; # $EXIT_SUCCESS --) i+=1; break;; -*) errusage "unrecognized option: %s" "${!i}"; error=true;; *) files+=("${!i}");; @@ -208,7 +212,7 @@ main() { error=true fi if "$error"; then - return 1 + return 1 # $EXIT_FAILURE fi if "$use_defaults"; then simple+=("${default_simple[@]}") -- cgit v1.2.3-54-g00ecf