blob: 3a4d1b85b70750735ad0347b3fc196b24ec62e1c [file] [log] [blame]
Stefan Taunerbf97bdc2013-03-09 17:55:35 +00001#!/bin/sh
2
3scriptname=$(readlink -f "$0") 2>/dev/null
4path=$(dirname "$scriptname")/.. 2>/dev/null
5if [ ! -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
12fi
13
14chips=$(sed -re '/#define [A-Z]/ !d' -e '/_ID\s/d' -e 's/\s*#define\s+([[:alnum:]_]+)\s+.*/\1/' "$path/flashchips.h")
15for 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
23done