| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Usage: fix-logs-all [DIR] |
| 4 |
# |
| 5 |
# Fixes logging macros and messages in SER source files in DIR |
| 6 |
# directory (recursively). |
| 7 |
# |
| 8 |
# See doc/logging-api.txt and fix-logs script for details. |
| 9 |
# |
| 10 |
# $Id$ |
| 11 |
|
| 12 |
# <filename>.ORIG backup files is created for each processed file. |
| 13 |
# If TEST is set, it only prints a "patch" file. |
| 14 |
# |
| 15 |
|
| 16 |
find ${1:-.} -type f \( -name "*.[chy]" -o -name "*.lex" -o -name "*.cc" \) | \ |
| 17 |
grep -v "/dprint\.[hc]$" | \ |
| 18 |
while read file; do |
| 19 |
echo "=== $file" |
| 20 |
|
| 21 |
if ! test "$TEST"; then |
| 22 |
mv "$file" "$file.ORIG" |
| 23 |
fi |
| 24 |
|
| 25 |
if expr match "$file" ".*/modules/" >/dev/null; then |
| 26 |
module=$(basename $(dirname $file)) |
| 27 |
fi |
| 28 |
|
| 29 |
if ! test "$TEST"; then |
| 30 |
fix-logs "$module" < "$file.ORIG" > "$file" |
| 31 |
else |
| 32 |
fix-logs "$module" < "$file" > "$file.NEW" |
| 33 |
|
| 34 |
diff "$file.NEW" "$file" |
| 35 |
rm "$file.NEW" |
| 36 |
fi |
| 37 |
done |