if ! . "$DELINT_PATH/libdelint"
then
diff --git a/delint/libdelint b/delint/libdelint
index ae1ca19..ec9ae65 100644
--- a/delint/libdelint
+++ b/delint/libdelint
@@ -20,7 +20,7 @@
export LC_COLLATE="C"
# ensure that DELINT_PATH has a value
-[[ -z "$DELINT_PATH" ]] && DELINT_PATH="$(dirname $0)"
+DELINT_PATH="${DELINT_PATH:-$(dirname $0)}"
# load liberror (this is not optional)
if ! . "$DELINT_PATH/../lib/liberror"
@@ -36,6 +36,16 @@ then
exit 1
fi
+#-------------------------------------------------------------------------------
+## @param definition file
+## @param source1 [source2 source3...]
+##
+## Tests whether any variables used in source1 (source2, source3, etc.) are
+## defined in the definition file. Any variables that are used but not
defined
+## in the definition file are output via libcolor_warn, preceded by the file
+## they were found in via libcolor_file.
+##
+#-------------------------------------------------------------------------------
function delint_global_variables() {
local defines=""
local file=""
@@ -71,8 +81,17 @@ function delint_global_variables() {
done
}
+#-------------------------------------------------------------------------------
+## @param error code file
+##
+## Ensures that the error code file itself is properly defined, making sure
that
+## for every error code there is a matching error message, and for every
error
+## message there is a matching error code.
+##
+#-------------------------------------------------------------------------------
function delint_error_codes() {
local errorcodes="$1"
+ local leader=" "
local codes=()
local msgcode=""
local count=""
@@ -80,14 +99,17 @@ function delint_error_codes() {
# make sure the defines file exists, otherwise we can't check anything
if [[ ! -f "$errorcodes" ]]
then
- libcolor_error "error: error code file \"$errorcodes\" not found"
+ libcolor_error "error: error code file "
+ libcolor_file "$errorcodes"
+ libcolor_error " not found"
echo ""
liberror_die $ERR_FATAL
fi
if ! source "$errorcodes" 2 > /dev/null
then
- libcolor_error "error: could not source error code file \"$errorcodes\""
+ libcolor_error "error: could not source error code file "
+ libcolor_file "$errorcodes"
echo ""
fi
@@ -97,15 +119,13 @@ function delint_error_codes() {
# test if the number of messages matches the number of error codes
if [[ "${#codes[@]}" -ne "${#ERR_MSGS[@]}" ]]
then
- libcolor_error "error: number of error codes not equal to "
- libcolor_error "number of messages in \"$errorcodes\""
+ libcolor_error "error: "
+ libcolor_error "number of error codes not equal to number of messages"
echo ""
- libcolor_error " codes: ${#codes[@]}"
+ libcolor_error "${leader}codes: ${#codes[@]}"
echo ""
- libcolor_error " messages: ${#ERR_MSGS[@]}"
+ libcolor_error "${leader}messages: ${#ERR_MSGS[@]}"
echo ""
-
- echo "${codes[@]}"
fi
# for every error code defined, make sure there is a corresponding message
@@ -113,7 +133,8 @@ function delint_error_codes() {
do
if ! grep -q "${codes[count]}\$" "$errorcodes"
then
- libcolor_error "error: ${codes[count]} defined but has no
corresponding message"
+ libcolor_error "error: ${codes[count]}: "
+ libcolor_error "DEFINED but has no corresponding message"
echo ""
fi
done
@@ -125,7 +146,8 @@ function delint_error_codes() {
if ! grep -q "^${msgcode}=" "$errorcodes"
then
- libcolor_error "error: $msgcode not defined but message is"
+ libcolor_error "error: $msgcode: "
+ libcolor_error "NOT DEFINED but message is"
echo ""
fi
done
diff --git a/delint/local_variables b/delint/local_variables
new file mode 100755
index 0000000..e69de29
diff --git a/delint/return_values b/delint/return_values
new file mode 100755
index 0000000..e69de29
diff --git a/delint/test-configvars b/delint/test-configvars
index a8b1970..0ad5034 100755
--- a/delint/test-configvars
+++ b/delint/test-configvars
@@ -19,7 +19,7 @@