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 OR GPL-2.0-or-later
14
15set -eu
16
17if [ -d include/mbedtls ]; then :; else
18    echo "$0: Must be run from Mbed TLS root" >&2
19    exit 1
20fi
21
22INTERNAL=""
23
24until [ -z "${1-}" ]
25do
26  case "$1" in
27    -i|--internal)
28      INTERNAL="1"
29      ;;
30    *)
31      # print error
32      echo "Unknown argument: '$1'"
33      exit 1
34      ;;
35  esac
36  shift
37done
38
39if [ $INTERNAL ]
40then
41    tests/scripts/list_internal_identifiers.py
42    wc -l identifiers
43else
44    cat <<EOF
45Sorry, this script has to be called with --internal.
46
47This script exists solely for backwards compatibility with the previous
48iteration of list-identifiers.sh, of which only the --internal option remains in
49use. It is a thin wrapper around list_internal_identifiers.py.
50
51check-names.sh, which used to depend on this script, has been replaced with
52check_names.py and is now self-complete.
53EOF
54fi
55