Add compile-time checks for various tables being in alphabetical order.
[exim.git] / src / scripts / source_checks
1 #!/bin/sh
2
3 cd src;
4
5 # Tables with struct items
6 while read file table
7 do
8   : $file $table
9   < $file \
10   perl -e '$/= undef; while (<>) { print $1 if /(?<='$table'\[\])\s*=\s*{\n(([^}].*\n)+)/m }' \
11   | awk '/{ (US)?"/ {print $2}' \
12   | awk -F\" '{print $2}' \
13   | LANG=C sort -c \
14   || exit 1
15 done <<-END
16         readconf.c      optionlist_config
17         globals.c       optionlist_auths
18         globals.c       debug_options
19         globals.c       header_names
20         globals.c       log_options
21         expand.c        item_table
22         transport.c     optionlist_transports
23         route.c         optionlist_routers
24         transports/appendfile.c appendfile_transport_options
25         transports/autoreply.c  autoreply_transport_options
26         transports/lmtp.c       lmtp_transport_options
27         transports/pipe.c       pipe_transport_options
28         transports/smtp.c       smtp_transport_options
29         expand.c        var_table
30 END
31
32 # Tables with just string items
33 while read file table
34 do
35   : $file $table
36   < $file \
37   perl -e '$/= undef; while (<>) { print $1 if /(?<='$table'\[\])\s*=\s*{\s?(([^}]*)+)}/m }' \
38   | awk -F\" '/"/ {print $2}' \
39   | LANG=C sort -c \
40   || exit 1
41
42 done <<-END
43         expand.c        item_table
44         expand.c        op_table_underscore
45         expand.c        op_table_main
46         expand.c        cond_table
47         acl.c           verbs
48         acl.c           conditions
49 END
50