summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/output.sh29
1 files changed, 12 insertions, 17 deletions
diff --git a/lib/output.sh b/lib/output.sh
index bc262e9..bd56715 100644
--- a/lib/output.sh
+++ b/lib/output.sh
@@ -31,9 +31,10 @@
## @pure no This function causes the current shell to exit.
ob_error()
{
- printf '%s: Error: ' "${0##*/}" >&2
- printf "${@}" >&2
- printf '\n' >&2
+ local format="${1}"
+ shift 1
+
+ printf '%s: Error: %s\n' "${0##*/}" "${@}" >&2
exit 1
}
@@ -44,19 +45,16 @@ ob_error()
## of \fIformat\fP.
## @operand arguments opt Arguments to be printed, as referenced by
## \fIformat\fP.
-## @return Returns 0 on success or 125 if \fIformat\fP is missing.
+## @return Returns 0.
## @stderr This function prints the formatted message, preceded by the program
## name and "Warning:", to stderr.
## @pure yes This function has no side effects.
ob_warn()
{
- if [ ${#} -eq 0 ]; then
- return 125
- fi
+ local format="${1}"
+ shift 1
- printf '%s: Warning: ' "${0##*/}" >&2
- printf "${@}" >&2
- printf '\n' >&2
+ printf '%s: Warning: %s\n' "${0##*/}" "${@}" >&2
return 0
}
@@ -67,19 +65,16 @@ ob_warn()
## of \fIformat\fP.
## @operand arguments opt Arguments to be printed, as referenced by
## \fIformat\fP.
-## @return Returns 0 on success or 125 if \fIformat\fP is missing.
+## @return Returns 0.
## @stderr This function prints the formatted message, preceded by the program
## name, to stderr.
## @pure yes This function has no side effects.
ob_info()
{
- if [ ${#} -eq 0 ]; then
- return 125
- fi
+ local format="${1}"
+ shift 1
- printf '%s: ' "${0##*/}" >&2
- printf "${@}" >&2
- printf '\n' >&2
+ printf '%s: %s\n' "${0##*/}" "${@}" >&2
return 0
}