list_yet_unsupported_chips.sh 659 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. scriptname=$(readlink -f "$0") 2>/dev/null
  3. path=$(dirname "$scriptname")/.. 2>/dev/null
  4. if [ ! -e "$path/flashchips.c" -o ! -e "$path/flashchips.h" ]; then
  5. echo "Warning: could not calculate flashchips.[ch]'s directory. Trying current..."
  6. path="."
  7. if [ ! -e "$path/flashchips.c" -o ! -e "$path/flashchips.h" ]; then
  8. echo "Nope, sorry!"
  9. exit 1
  10. fi
  11. fi
  12. chips=$(sed -re '/#define [A-Z]/ !d' -e '/_ID\s/d' -e 's/\s*#define\s+([[:alnum:]_]+)\s+.*/\1/' "$path/flashchips.h")
  13. for c in $chips ; do
  14. if ! grep "$c" "$path/flashchips.c" >/dev/null ; then
  15. if [ -n "$1" ]; then
  16. grep -o "$c.*" "$path/flashchips.h"
  17. else
  18. echo "$c"
  19. fi
  20. fi
  21. done