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