blob: 9b930802f5522f95d07f255ca5eba8ba2d05657e [file] [log] [blame]
Darryl Green383d1fa2019-04-04 11:33:22 +01001#!/bin/bash
2#
Darryl Green1ae48862019-04-18 13:09:25 +01003# Create a file named identifiers containing identifiers from internal header
Gilles Peskine8266b5b2021-09-27 19:53:31 +02004# files, based on the --internal flag.
Darryl Green1ae48862019-04-18 13:09:25 +01005# Outputs the line count of the file to stdout.
Gilles Peskine8266b5b2021-09-27 19:53:31 +02006# A very thin wrapper around list_internal_identifiers.py for backwards
7# compatibility.
8# Must be run from Mbed TLS root.
Darryl Green383d1fa2019-04-04 11:33:22 +01009#
10# Usage: list-identifiers.sh [ -i | --internal ]
Bence Szépkúti700ee442020-05-26 00:33:31 +020011#
Bence Szépkúti1e148272020-08-07 13:07:28 +020012# Copyright The Mbed TLS Contributors
Bence Szépkútic7da1fe2020-05-26 01:54:15 +020013# 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.
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010026
27set -eu
28
Manuel Pégourié-Gonnardd1ddd292015-04-09 10:15:10 +020029if [ -d include/mbedtls ]; then :; else
Gilles Peskine8266b5b2021-09-27 19:53:31 +020030 echo "$0: Must be run from Mbed TLS root" >&2
Manuel Pégourié-Gonnardd1ddd292015-04-09 10:15:10 +020031 exit 1
32fi
33
Darryl Green383d1fa2019-04-04 11:33:22 +010034INTERNAL=""
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
Gilles Peskine8266b5b2021-09-27 19:53:31 +020053 tests/scripts/list_internal_identifiers.py
54 wc -l identifiers
Darryl Green383d1fa2019-04-04 11:33:22 +010055else
Gilles Peskine8266b5b2021-09-27 19:53:31 +020056 cat <<EOF
57Sorry, this script has to be called with --internal.
58
59This script exists solely for backwards compatibility with the previous
60iteration of list-identifiers.sh, of which only the --internal option remains in
61use. It is 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
Darryl Green383d1fa2019-04-04 11:33:22 +010066fi