File: fix-logs-all

package info (click to toggle)
kamailio 6.0.1-1%2Bdeb13u1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 70,116 kB
  • sloc: ansic: 858,459; xml: 203,250; makefile: 9,285; sh: 8,928; sql: 8,571; yacc: 4,120; python: 3,086; perl: 2,955; java: 449; cpp: 289; javascript: 270; php: 258; ruby: 248; awk: 27
file content (37 lines) | stat: -rwxr-xr-x 837 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
#
# Usage: fix-logs-all [DIR]
#
# Fixes logging macros and messages in SER source files in DIR
# directory (recursively).
#
# See doc/logging-api.txt and fix-logs script for details.
#
# $Id$

# <filename>.ORIG backup files is created for each processed file.
# If TEST is set, it only prints a "patch" file.
#

find ${1:-.} -type f \( -name "*.[chy]" -o -name "*.lex" -o -name "*.cc" \) | \
    grep -v "/dprint\.[hc]$" | \
	while read file; do
	    echo "=== $file"

	    if ! test "$TEST"; then
		mv "$file" "$file.ORIG"
	    fi

	    if expr match "$file" ".*/modules/" >/dev/null; then
		module=$(basename $(dirname $file))
	    fi

	    if ! test "$TEST"; then
		fix-logs "$module" < "$file.ORIG" > "$file"
	    else
		fix-logs "$module" < "$file" > "$file.NEW"

		diff "$file.NEW" "$file"
		rm "$file.NEW"
	    fi
	done