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".
pull/2516/head
Jason Ish 8 years ago committed by Victor Julien
parent a18af7325f
commit 1abaf1c96d

@ -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:]')

Loading…
Cancel
Save