summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-05-25 16:43:13 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-05-25 17:28:30 -0400
commit8b9f2e30834c469cfe4529c64c355d548c8b00cf (patch)
treeb14d32377b031614c33812e83f5a7e986dfaea2f /src
parent1b0f24c5ba3d319145ac70e09e37d547a72390b4 (diff)
more $EXIT_* usage
Diffstat (limited to 'src')
-rwxr-xr-xsrc/lib/libreblacklist2
-rwxr-xr-xsrc/lib/librelib10
-rwxr-xr-xsrc/lib/librexgettext10
3 files changed, 13 insertions, 9 deletions
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 <lukeshu@sbcglobal.net>
+# Copyright (C) 2013-2014, 2017 Luke Shumaker <lukeshu@sbcglobal.net>
#
# 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 <lukeshu@sbcglobal.net>
+# Copyright (C) 2013-2017 Luke Shumaker <lukeshu@sbcglobal.net>
#
# 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 <http://www.gnu.org/licenses/>.
+# 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[@]}")