blob: 4ccac236e21201dda02c21562703d0ffef78bf99 [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
Dave Rodgman7ff79652023-11-03 12:04:52 +000013# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Manuel Pégourié-Gonnard3385cf42015-04-02 17:59:30 +010014
15set -eu
16
Manuel Pégourié-Gonnardd1ddd292015-04-09 10:15:10 +020017if [ -d include/mbedtls ]; then :; else
Gilles Peskine8266b5b2021-09-27 19:53:31 +020018 echo "$0: Must be run from Mbed TLS root" >&2
Manuel Pégourié-Gonnardd1ddd292015-04-09 10:15:10 +020019 exit 1
20fi
21
Darryl Green383d1fa2019-04-04 11:33:22 +010022INTERNAL=""
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
Gilles Peskine8266b5b2021-09-27 19:53:31 +020041 tests/scripts/list_internal_identifiers.py
42 wc -l identifiers
Darryl Green383d1fa2019-04-04 11:33:22 +010043else
Gilles Peskine8266b5b2021-09-27 19:53:31 +020044 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
Darryl Green383d1fa2019-04-04 11:33:22 +010054fi