| 1 | #!/bin/sh |
| 2 | # Copyright (c) The Exim Maintainters 2022 - 2026 |
| 3 | # SPDX-License-Identifier: GPL-2.0-or-later |
| 4 | |
| 5 | cd src; |
| 6 | |
| 7 | # Tables with struct items |
| 8 | while read file table |
| 9 | do |
| 10 | : $file $table |
| 11 | < $file \ |
| 12 | perl -e '$/= undef; while (<>) { print $1 if /(?<='$table'\[\])\s*=\s*{\n(([^}].*\n)+)/m }' \ |
| 13 | | awk '/{ (US)?"/ {print $2}' \ |
| 14 | | awk -F\" '{print $2}' \ |
| 15 | | LC_ALL=C sort -c \ |
| 16 | || { echo "Table $table in $file is not alphabetically ordered" >&2 ; exit 1; } |
| 17 | done <<-END |
| 18 | readconf.c optionlist_config |
| 19 | globals.c optionlist_auths |
| 20 | globals.c header_names |
| 21 | expand.c item_table |
| 22 | std-crypto.c dh_constants |
| 23 | transport.c optionlist_transports |
| 24 | route.c optionlist_routers |
| 25 | transports/appendfile.c appendfile_transport_options |
| 26 | transports/autoreply.c autoreply_transport_options |
| 27 | transports/lmtp.c lmtp_transport_options |
| 28 | transports/pipe.c pipe_transport_options |
| 29 | transports/smtp.c smtp_transport_options |
| 30 | expand.c var_table |
| 31 | acl.c conditions |
| 32 | acl.c controls_list |
| 33 | END |
| 34 | |
| 35 | # Tables with one-arg macros as items |
| 36 | # (ignoring #ifdef lines) |
| 37 | while read file table |
| 38 | do |
| 39 | : $file $table |
| 40 | < $file \ |
| 41 | perl -e '$/= undef; while (<>) { print $1 if /(?<='$table'\[\])\s*=\s*{\s?(([^}]*)+)}/m }' \ |
| 42 | | awk '!/^\s*#/ {split($0,a,"[()]");print a[2]}' \ |
| 43 | | LC_ALL=C sort -c \ |
| 44 | || { echo "Table $table in $file is not alphabetically ordered" >&2 ; exit 1; } |
| 45 | done <<-END |
| 46 | globals.c debug_channels |
| 47 | globals.c log_channels |
| 48 | END |
| 49 | |
| 50 | # Tables with just string items |
| 51 | while read file table |
| 52 | do |
| 53 | : $file $table |
| 54 | < $file \ |
| 55 | perl -e '$/= undef; while (<>) { print $1 if /(?<='$table'\[\])\s*=\s*{\s?(([^}]*)+)}/m }' \ |
| 56 | | awk -F\" '/"/ {print $2}' \ |
| 57 | | LC_ALL=C sort -c \ |
| 58 | || { echo "Table $table in $file is not alphabetically ordered" >&2 ; exit 1; } |
| 59 | done <<-END |
| 60 | expand.c item_table |
| 61 | expand.c op_table_underscore |
| 62 | expand.c op_table_main |
| 63 | expand.c cond_table |
| 64 | acl.c verbs |
| 65 | END |
| 66 |