diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-19 12:46:11 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-19 22:56:28 +0200 |
commit | 2b7d86ec7369804af9ab5549e20d6ff021679e95 (patch) | |
tree | 08cc7d588b730b4e03a4acef55da632b8af90924 /tools | |
parent | d817843d2e0d8f9708620c76c471fc5e94f84264 (diff) | |
download | android-node-v8-2b7d86ec7369804af9ab5549e20d6ff021679e95.tar.gz android-node-v8-2b7d86ec7369804af9ab5549e20d6ff021679e95.tar.bz2 android-node-v8-2b7d86ec7369804af9ab5549e20d6ff021679e95.zip |
tools: make check-imports.sh work on bsd-likes
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/check-imports.sh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/check-imports.sh b/tools/check-imports.sh index 54cba93d83..caeb382ff7 100755 --- a/tools/check-imports.sh +++ b/tools/check-imports.sh @@ -1,14 +1,21 @@ #!/bin/sh +SED=sed +UNAME=`uname` + +if [ "$UNAME" = Darwin ] || [ "$UNAME" = FreeBSD ]; then + SED=gsed +fi + cd `dirname "$0"`/../ for FILE in src/*.cc; do - sed -rne 's/^using (\w+::\w+);$/\1/p' $FILE | sort -c || echo "in $FILE" + $SED -rne 's/^using (\w+::\w+);$/\1/p' $FILE | sort -c || echo "in $FILE" done for FILE in src/*.cc; do - for IMPORT in `sed -rne 's/^using (\w+)::(\w+);$/\2/p' $FILE`; do - if ! sed -re '/^using (\w+)::(\w+);$/d' $FILE | grep -q "$IMPORT"; then + for IMPORT in `$SED -rne 's/^using (\w+)::(\w+);$/\2/p' $FILE`; do + if ! $SED -re '/^using (\w+)::(\w+);$/d' $FILE | grep -q "$IMPORT"; then echo "$IMPORT unused in $FILE" fi done |