2018-07-24 00:06:04 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-04-25 12:55:34 +02:00
|
|
|
|
|
|
|
EXIT_CODE=0
|
2019-02-07 21:35:50 +01:00
|
|
|
for FILE in $(git grep -lE 'int main\(' | grep -vE '^ccan/' | grep '.c$'); do
|
2018-04-25 12:55:34 +02:00
|
|
|
if ! grep -q 'setup_locale();' "${FILE}"; then
|
|
|
|
echo "main(...) in ${FILE} does not call setup_locale() (see common/utils.h)"
|
|
|
|
EXIT_CODE=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [[ ${EXIT_CODE} != 0 ]]; then
|
|
|
|
echo
|
|
|
|
echo "setup_locale() forces the use of the POSIX C locale. By using the"
|
|
|
|
echo "POSIX C locale we avoid a class of localization related parsing bugs"
|
|
|
|
echo "that can be very tricky to isolate and fix."
|
|
|
|
fi
|
|
|
|
exit ${EXIT_CODE}
|