Use GNU sed if available

Fixes update-copyright.sh on macOS, which doesn't support the -b option.

(cherry picked from commit a357021800b4af2b850476bcd87be5648923b847)
This commit is contained in:
Sam Lantinga 2023-02-06 15:47:16 -08:00
parent 4f8dd2d39d
commit d649f95723

View file

@ -1,7 +1,15 @@
#!/bin/sh
if [ "$SED" = "" ]; then
if type gsed >/dev/null; then
SED=gsed
else
SED=sed
fi
fi
find . -type f \
| grep -v \.git \
| while read file; do \
LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \
LC_ALL=C $SED -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \
done