list-identifiers.sh 1.8 KB

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