• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3scriptname=$(readlink -f "$0") 2>/dev/null
4path=$(dirname "$scriptname")/.. 2>/dev/null
5if [ ! -e "$path/flashchips.c" -o ! -e "$path/include/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/include/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/include/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/include/flashchips.h"
19		else
20			echo "$c"
21		fi
22	fi
23done
24