Use special environment variables to transmit the cwd of the various
[wine.git] / tools / find_debug_channels
blob7127396088699c4516edee316613d806533908d5
1 #!/bin/sh
3 # This script scans the whole source code for symbols of the form
4 # 'xxx(yyy' where:
5 # xxx is either DECLARE_DEBUG_CHANNEL or DEFAULT_DEBUG_CHANNEL
6 # yyy is a C identifier
7 # It outputs on the standard output a sorted list of the
8 # yyy identifiers found in the .c files.
9 # Each identifier is reported once. Header files are not scanned.
11 # The script can be given an argument that specifies the files to be
12 # searched according to the following scheme:
13 # - if the argument does not contain a slash (/), the script
14 # will search the tree rooted in the current directory for
15 # files that match that description. You can also pass
16 # wildcard arguments, but remember to quote them to prevent
17 # expansion by the shell
18 # - if the argument does contain a slash, only that file is
19 # searched
20 # - if no argument is given, the argument defaults to "*.c"
21 # that is, all C files are searched.
22 # - if more than one argument is given, only the listed files are
23 # searched. Note that in this case, the script will not
24 # attempt to find them in some subdirectories, but rather
25 # it will try to open them in the current directory.
26 # Thus, if you want to disable the automatic searching when the file
27 # name does not contain a /, either prefix the filename with ./
28 # or add /dev/null as another argument.
30 # Dimitrie O. Paun <dimi@cs.toronto.edu>
31 # Patrik Stridvall <ps@leissner.se>
34 case "$#" in
35 0 | 1) files=${1:-'*.c'}
36 if [ `echo $files | sed 's/^\(.*\)\/$/\1/g'` = "$files" ]; then
37 files=`find . -name "$files" -print`
38 fi;;
39 * ) files="$@";;
40 esac
43 grep -h "DECLARE_DEBUG_CHANNEL *(" $files /dev/null | \
44 sed 's/.*DECLARE_DEBUG_CHANNEL( *\([A-Za-z0-9_]*\) *).*/\1/g'
45 grep -h "DEFAULT_DEBUG_CHANNEL *(" $files /dev/null | \
46 sed 's/.*DEFAULT_DEBUG_CHANNEL( *\([A-Za-z0-9_]*\) *).*/\1/g'
47 ) | sort | uniq