Yuto Takano | ac72fac | 2021-08-10 15:09:16 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Create a file named identifiers containing identifiers from internal header |
| 4 | # files, based on the --internal flag. |
| 5 | # Outputs the line count of the file to stdout. |
| 6 | # A very thin wrapper around list_internal_identifiers.py for backwards |
| 7 | # compatibility. |
| 8 | # Must be run from Mbed TLS root. |
| 9 | # |
| 10 | # Usage: list-identifiers.sh [ -i | --internal ] |
| 11 | # |
| 12 | # Copyright The Mbed TLS Contributors |
| 13 | # SPDX-License-Identifier: Apache-2.0 |
| 14 | # |
| 15 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 16 | # not use this file except in compliance with the License. |
| 17 | # You may obtain a copy of the License at |
| 18 | # |
| 19 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 20 | # |
| 21 | # Unless required by applicable law or agreed to in writing, software |
| 22 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 23 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 24 | # See the License for the specific language governing permissions and |
| 25 | # limitations under the License. |
| 26 | |
| 27 | set -eu |
| 28 | |
| 29 | if [ -d include/mbedtls ]; then :; else |
| 30 | echo "$0: Must be run from Mbed TLS root" >&2 |
| 31 | exit 1 |
| 32 | fi |
| 33 | |
| 34 | INTERNAL="" |
| 35 | |
| 36 | until [ -z "${1-}" ] |
| 37 | do |
| 38 | case "$1" in |
| 39 | -i|--internal) |
| 40 | INTERNAL="1" |
| 41 | ;; |
| 42 | *) |
| 43 | # print error |
| 44 | echo "Unknown argument: '$1'" |
| 45 | exit 1 |
| 46 | ;; |
| 47 | esac |
| 48 | shift |
| 49 | done |
| 50 | |
| 51 | if [ $INTERNAL ] |
| 52 | then |
| 53 | tests/scripts/list_internal_identifiers.py |
| 54 | wc -l identifiers |
| 55 | else |
| 56 | cat <<EOF |
| 57 | Sorry, this script has to be called with --internal. |
| 58 | |
| 59 | This script exists solely for backwards compatibility for the previous ieration |
| 60 | of list-identifiers.sh, of which only the --internal option remains in use. It |
| 61 | is a thin wrapper around list_internal_identifiers.py. |
| 62 | |
| 63 | check-names.sh, which used to depend on this script, has been replaced with |
| 64 | check_names.py and is now self-complete. |
| 65 | EOF |
Yuto Takano | d73cec1 | 2021-08-10 15:45:28 +0100 | [diff] [blame] | 66 | fi |