blob: ac6d741e6124ac87ad6b2cd82e0b0621148d0f12 [file] [log] [blame]
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +00001#!/bin/sh
Alexandre Julliarda11d7b11998-03-01 20:05:02 +00002#
3# This script scans the whole source code for symbols of the form
Alexandre Julliardc7c217b1998-04-13 12:21:30 +00004# '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 Julliarda11d7b11998-03-01 20:05:02 +000010#
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 Stridvallb4b9fae1999-04-19 14:56:29 +000031# Patrik Stridvall <ps@leissner.se>
Alexandre Julliarda11d7b11998-03-01 20:05:02 +000032#
33
34case "$#" in
35 0 | 1) files=${1:-'*.c'}
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000036 if [ `echo $files | sed 's/^\(.*\)\/$/\1/g'` = "$files" ]; then
37 files=`find . -name "$files" -print`
Alexandre Julliarda11d7b11998-03-01 20:05:02 +000038 fi;;
39 * ) files="$@";;
40esac
41
Alexandre Julliarda69b88b1998-03-15 20:29:56 +000042(
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000043grep -h "DECLARE_DEBUG_CHANNEL *(" $files /dev/null | \
44 sed 's/.*DECLARE_DEBUG_CHANNEL( *\([A-Za-z0-9_]*\) *).*/\1/g'
45grep -h "DEFAULT_DEBUG_CHANNEL *(" $files /dev/null | \
46 sed 's/.*DEFAULT_DEBUG_CHANNEL( *\([A-Za-z0-9_]*\) *).*/\1/g'
Alexandre Julliarda69b88b1998-03-15 20:29:56 +000047) | sort | uniq