From 1abaf1c96d7e2a49f7d3645e48f9ab83868547c7 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Fri, 18 Nov 2016 10:53:25 -0600 Subject: [PATCH] templates: require the protocol name to start with a capital When running ./setup-app-layer.sh require the protocol name to start with a capital letter so it looks somewhat like a proper name. This will help give better function names. For example: ./setup-app-layer.sh IRC ./setup-app-layer.sh Irc will create function names starting with IRC or Irc. But we do not want function names to start with "irc". --- scripts/setup-app-layer.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/scripts/setup-app-layer.sh b/scripts/setup-app-layer.sh index 2789f20dd7..87cebab800 100755 --- a/scripts/setup-app-layer.sh +++ b/scripts/setup-app-layer.sh @@ -139,10 +139,25 @@ EOF protoname="$1" -if [ "${protoname}" = "" ]; then - usage - exit 1 -fi +# Make sure the protocol name looks like a proper name (starts with a +# capital letter). +case "${protoname}" in + + [[:upper:]]*) + # OK. + ;; + + "") + usage + exit 1 + ;; + + *) + echo "error: protocol name must beging with an upper case letter" + exit 1 + ;; + +esac protoname_lower=$(printf ${protoname} | tr '[:upper:]' '[:lower:]') protoname_upper=$(printf ${protoname} | tr '[:lower:]' '[:upper:]')