blob: 781c609fc1e8bf2f524ad2f3f2d49010d0e3136a [file] [log] [blame]
Yuto Takanoac72fac2021-08-10 15:09:16 +01001#!/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
27set -eu
28
29if [ -d include/mbedtls ]; then :; else
30 echo "$0: Must be run from Mbed TLS root" >&2
31 exit 1
32fi
33
34INTERNAL=""
35
36until [ -z "${1-}" ]
37do
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
49done
50
51if [ $INTERNAL ]
52then
53 tests/scripts/list_internal_identifiers.py
54 wc -l identifiers
55else
56 cat <<EOF
57Sorry, this script has to be called with --internal.
58
59This script exists solely for backwards compatibility for the previous ieration
60of list-identifiers.sh, of which only the --internal option remains in use. It
61is a thin wrapper around list_internal_identifiers.py.
62
63check-names.sh, which used to depend on this script, has been replaced with
64check_names.py and is now self-complete.
65EOF
Yuto Takanod73cec12021-08-10 15:45:28 +010066fi