File: find_debug_channels

package info (click to toggle)
wine 0.0.20000109-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 22,652 kB
  • ctags: 59,973
  • sloc: ansic: 342,054; perl: 3,697; yacc: 3,059; tcl: 2,647; makefile: 2,466; lex: 1,494; sh: 394
file content (47 lines) | stat: -rwxr-xr-x 1,910 bytes parent folder | download
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
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
#
# This script scans the whole source code for symbols of the form 
# 'xxx(yyy' where:
#        xxx is either DECLARE_DEBUG_CHANNEL or DEFAULT_DEBUG_CHANNEL
#        yyy is a C identifier 
# It outputs on the standard output a sorted list of the 
# yyy identifiers found in the .c files. 
# Each identifier is reported once. Header files are not scanned.
#
# The script can be given an argument that specifies the files to be
# searched according to the following scheme:
#    - if the argument does not contain a slash (/), the script
#      will search the tree rooted in the current directory for
#      files that match that description. You can also pass
#      wildcard arguments, but remember to quote them to prevent
#      expansion by the shell
#    - if the argument does contain a slash, only that file is
#      searched
#    - if no argument is given, the argument defaults to "*.c"
#      that is, all C files are searched.
#    - if more than one argument is given, only the listed files are
#      searched. Note that in this case, the script will not
#      attempt to find them in some subdirectories, but rather
#      it will try to open them in the current directory.
# Thus, if you want to disable the automatic searching when the file
# name does not contain a /, either prefix the filename with ./
# or add /dev/null as another argument.
#
# Dimitrie O. Paun <dimi@cs.toronto.edu>
# Patrik Stridvall <ps@leissner.se>
#

case "$#" in
    0 | 1)  files=${1:-'*.c'}
	    if [ `echo $files | sed 's/^\(.*\)\/$/\1/g'` = "$files" ]; then
		files=`find . -name "$files" -print`
	    fi;;
    *    )  files="$@";;
esac

(
grep -h "DECLARE_DEBUG_CHANNEL *(" $files /dev/null | \
    sed 's/.*DECLARE_DEBUG_CHANNEL( *\([A-Za-z0-9_]*\) *).*/\1/g'
grep -h "DEFAULT_DEBUG_CHANNEL *(" $files /dev/null | \
    sed 's/.*DEFAULT_DEBUG_CHANNEL( *\([A-Za-z0-9_]*\) *).*/\1/g'
) | sort | uniq