Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 1 | #!/bin/sh |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 2 | # |
| 3 | # This script scans the whole source code for symbols of the form |
Alexandre Julliard | c7c217b | 1998-04-13 12:21:30 +0000 | [diff] [blame] | 4 | # 'xxx(yyy' where: |
| 5 | # xxx is either TRACE, WARN, ERR or WARN |
| 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. |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 10 | # |
| 11 | # The script can be given an argument that specify 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 a 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. |
| 29 | # |
| 30 | # Dimitrie O. Paun <dimi@cs.toronto.edu> |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 31 | # Patrik Stridvall <ps@leissner.se> |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 32 | # |
| 33 | |
| 34 | case "$#" in |
| 35 | 0 | 1) files=${1:-'*.c'} |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 36 | if [ `echo $files | sed 's/^\(.*\)\/$/\1/g'` = "$files" ]; then |
| 37 | files=`find . -name "$files" -print` |
Alexandre Julliard | a11d7b1 | 1998-03-01 20:05:02 +0000 | [diff] [blame] | 38 | fi;; |
| 39 | * ) files="$@";; |
| 40 | esac |
| 41 | |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 42 | ( |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 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' |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 47 | ) | sort | uniq |