]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
templates: require the protocol name to start with a capital
authorJason Ish <ish@unx.ca>
Fri, 18 Nov 2016 16:53:25 +0000 (10:53 -0600)
committerVictor Julien <victor@inliniac.net>
Tue, 24 Jan 2017 09:53:37 +0000 (10:53 +0100)
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

index 2789f20dd7cdadb36934624db792c42e44d2dec6..87cebab80085a93a2411098198149c61fc85a07e 100755 (executable)
@@ -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:]')