From 96a1fdc278649dd7a5d3e6afd2bdb39ed5a71587 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 24 Jun 2019 17:51:40 -0400 Subject: ob_set_binary_substvar(), ob_substvars(): Improve "clean" naming --- diff --git a/lib/control.sh b/lib/control.sh index c7a8010..35913aa 100644 --- a/lib/control.sh +++ b/lib/control.sh @@ -245,7 +245,8 @@ ob_set_binary_substvar() value="$(printf '%s' "${value}" | sed -n "${_OB_SUBSTVAR_TRIM_SED}")" # Convert package name to clean form. - package="$(printf '%s' "${package}" | tr 'A-Z' 'a-z' | tr -dC 'a-z0-9')" + package="$(printf '%s' "${package}" | tr 'A-Z' 'a-z' | \ + tr -C 'a-z0-9' '_')" # TODO: Maybe disallow variable names beginning with hyphens, and/or # otherwise make this safer. @@ -326,7 +327,7 @@ ob_substvars() # Perform the substitution. name_tr="$(printf '%s' "${name}" | tr 'A-Z-' 'a-z_')" package="$(printf '%s' "${package}" | tr 'A-Z' 'a-z' | \ - tr -dC 'a-z0-9')" + tr -C 'a-z0-9' '_')" if eval "[ x\"\${_ob_substvar_src_${name_tr}:+set}\" = x'set' ]" then name_tr="_ob_substvar_src_${name_tr}" -- cgit v0.9.1