File: list_yet_unsupported_chips.sh

package info (click to toggle)
flashprog 1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,104 kB
  • sloc: ansic: 61,779; makefile: 919; sh: 310
file content (23 lines) | stat: -rwxr-xr-x 691 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

scriptname=$(readlink -f "$0") 2>/dev/null
path=$(dirname "$scriptname")/.. 2>/dev/null
if [ ! -e "$path/flashchips.c" -o ! -e "$path/include/flashchips.h" ]; then
	echo "Warning: could not calculate flashchips.[ch]'s directory. Trying current..."
	path="."
	if [ ! -e "$path/flashchips.c" -o ! -e "$path/include/flashchips.h" ]; then
		echo "Nope, sorry!"
		exit 1
	fi
fi

chips=$(sed -re '/#define [A-Z]/ !d' -e '/_ID\s/d' -e 's/\s*#define\s+([[:alnum:]_]+)\s+.*/\1/' "$path/include/flashchips.h")
for c in $chips ; do
	if ! grep "$c" "$path/flashchips.c" >/dev/null ; then
		if [ -n "$1" ]; then
			grep -o "$c.*" "$path/include/flashchips.h"
		else
			echo "$c"
		fi
	fi
done