1a8e1175bSopenharmony_ci#!/bin/bash
2a8e1175bSopenharmony_ci#
3a8e1175bSopenharmony_ci# Create a file named identifiers containing identifiers from internal header
4a8e1175bSopenharmony_ci# files, based on the --internal flag.
5a8e1175bSopenharmony_ci# Outputs the line count of the file to stdout.
6a8e1175bSopenharmony_ci# A very thin wrapper around list_internal_identifiers.py for backwards
7a8e1175bSopenharmony_ci# compatibility.
8a8e1175bSopenharmony_ci# Must be run from Mbed TLS root.
9a8e1175bSopenharmony_ci#
10a8e1175bSopenharmony_ci# Usage: list-identifiers.sh [ -i | --internal ]
11a8e1175bSopenharmony_ci#
12a8e1175bSopenharmony_ci# Copyright The Mbed TLS Contributors
13a8e1175bSopenharmony_ci# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
14a8e1175bSopenharmony_ci
15a8e1175bSopenharmony_ciset -eu
16a8e1175bSopenharmony_ci
17a8e1175bSopenharmony_ciif [ -d include/mbedtls ]; then :; else
18a8e1175bSopenharmony_ci    echo "$0: Must be run from Mbed TLS root" >&2
19a8e1175bSopenharmony_ci    exit 1
20a8e1175bSopenharmony_cifi
21a8e1175bSopenharmony_ci
22a8e1175bSopenharmony_ciINTERNAL=""
23a8e1175bSopenharmony_ci
24a8e1175bSopenharmony_ciuntil [ -z "${1-}" ]
25a8e1175bSopenharmony_cido
26a8e1175bSopenharmony_ci  case "$1" in
27a8e1175bSopenharmony_ci    -i|--internal)
28a8e1175bSopenharmony_ci      INTERNAL="1"
29a8e1175bSopenharmony_ci      ;;
30a8e1175bSopenharmony_ci    *)
31a8e1175bSopenharmony_ci      # print error
32a8e1175bSopenharmony_ci      echo "Unknown argument: '$1'"
33a8e1175bSopenharmony_ci      exit 1
34a8e1175bSopenharmony_ci      ;;
35a8e1175bSopenharmony_ci  esac
36a8e1175bSopenharmony_ci  shift
37a8e1175bSopenharmony_cidone
38a8e1175bSopenharmony_ci
39a8e1175bSopenharmony_ciif [ $INTERNAL ]
40a8e1175bSopenharmony_cithen
41a8e1175bSopenharmony_ci    tests/scripts/list_internal_identifiers.py
42a8e1175bSopenharmony_ci    wc -l identifiers
43a8e1175bSopenharmony_cielse
44a8e1175bSopenharmony_ci    cat <<EOF
45a8e1175bSopenharmony_ciSorry, this script has to be called with --internal.
46a8e1175bSopenharmony_ci
47a8e1175bSopenharmony_ciThis script exists solely for backwards compatibility with the previous
48a8e1175bSopenharmony_ciiteration of list-identifiers.sh, of which only the --internal option remains in
49a8e1175bSopenharmony_ciuse. It is a thin wrapper around list_internal_identifiers.py.
50a8e1175bSopenharmony_ci
51a8e1175bSopenharmony_cicheck-names.sh, which used to depend on this script, has been replaced with
52a8e1175bSopenharmony_cicheck_names.py and is now self-complete.
53a8e1175bSopenharmony_ciEOF
54a8e1175bSopenharmony_cifi
55