summaryrefslogtreecommitdiff
path: root/src/scripts
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2013-05-12 22:31:36 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2013-05-12 22:34:48 +0100
commitf9d04f08f7ca18e099843180edea967dd831df91 (patch)
tree96c4590310b7b7026da9f383a92da1ee2e7c6e8e /src/scripts
parent83712b3900eb045eb14df258fd092ad54314e990 (diff)
Add compile-time checks for various tables being in alphabetical order.
This is gross hackery and somewhat fragile. A better method would actuallyt compile the 'C' involved and check programmatically.
Diffstat (limited to 'src/scripts')
-rw-r--r--src/scripts/source_checks50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/scripts/source_checks b/src/scripts/source_checks
new file mode 100644
index 000000000..79f9c3555
--- /dev/null
+++ b/src/scripts/source_checks
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+cd src;
+
+# Tables with struct items
+while read file table
+do
+ : $file $table
+ < $file \
+ perl -e '$/= undef; while (<>) { print $1 if /(?<='$table'\[\])\s*=\s*{\n(([^}].*\n)+)/m }' \
+ | awk '/{ (US)?"/ {print $2}' \
+ | awk -F\" '{print $2}' \
+ | LANG=C sort -c \
+ || exit 1
+done <<-END
+ readconf.c optionlist_config
+ globals.c optionlist_auths
+ globals.c debug_options
+ globals.c header_names
+ globals.c log_options
+ expand.c item_table
+ transport.c optionlist_transports
+ route.c optionlist_routers
+ transports/appendfile.c appendfile_transport_options
+ transports/autoreply.c autoreply_transport_options
+ transports/lmtp.c lmtp_transport_options
+ transports/pipe.c pipe_transport_options
+ transports/smtp.c smtp_transport_options
+ expand.c var_table
+END
+
+# Tables with just string items
+while read file table
+do
+ : $file $table
+ < $file \
+ perl -e '$/= undef; while (<>) { print $1 if /(?<='$table'\[\])\s*=\s*{\s?(([^}]*)+)}/m }' \
+ | awk -F\" '/"/ {print $2}' \
+ | LANG=C sort -c \
+ || exit 1
+
+done <<-END
+ expand.c item_table
+ expand.c op_table_underscore
+ expand.c op_table_main
+ expand.c cond_table
+ acl.c verbs
+ acl.c conditions
+END
+