2 ###############################################################################
5 # RCS: $Header: /cvsroot/cscope/cscope/contrib/xcscope/cscope-indexer,v 1.2 2001/06/28 04:39:47 darrylo Exp $
6 # Description: Script to index files for cscope
8 # This script generates a list of files to index
9 # (cscope.out), which is then (optionally) used to
10 # generate a cscope database. You can use this script
11 # to just build a list of files, or it can be used to
12 # build a list and database. This script is not used to
13 # just build a database (skipping the list of files
14 # step), as this can be simply done by just calling
17 # Normally, cscope will do its own indexing, but this
18 # script can be used to force indexing. This is useful
19 # if you need to recurse into subdirectories, or have
20 # many files to index (you can run this script from a
21 # cron job, during the night). It is especially useful
22 # for large projects, which can contstantly have source
23 # files added and deleted; by using this script, the
24 # changing sources files are automatically handled.
26 # Currently, any paths containing "/CVS/" or "/RCS/" are
27 # stripped out (ignored).
29 # This script is written to use only basic shell features, as
30 # not all shells have advanced features.
32 # Author: Darryl Okahata
33 # Created: Thu Apr 27 17:12:14 2000
34 # Modified: Tue Jun 19 09:47:45 2001 (Darryl Okahata) darrylo@soco.agilent.com
35 # Language: Shell-script
37 # Status: Experimental
39 # (C) Copyright 2000, Darryl Okahata, all rights reserved.
41 ###############################################################################
45 # cscope-indexer [ -v ] [-f database_file ] [-i list_file ] [ -l ] [ -r ]
50 # Specifies the cscope database file (default: cscope.out).
53 # Specifies the name of the file into which the list of files
54 # to index is placed (default: cscope.files).
57 # Suppress the generation/updating of the cscope database
58 # file. Only a list of files is generated.
61 # Recurse into subdirectories to locate files to index.
62 # Without this option, only the current directory is
66 # Be verbose. Output simple progress messages.
69 ###############################################################################
72 # May have to edit this:
73 PATH
="/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin:$PATH"
78 LIST_FILE
='cscope.files'
79 DATABASE_FILE
='cscope.out'
82 export DIR RECURSE
# Need to pass these to subprocesses
90 echo "$0: No database file specified" >&2
99 echo "$0: No list file specified" >&2
123 if [ "X$VERBOSE" != "X" ]
125 echo "Creating list of files to index ..."
129 if [ "X$RECURSE" = "X" ]
131 # Ugly, inefficient, but it works.
137 find $DIR \
( -type f
-o -type l \
)
140 egrep -i '\.([chly](xx|pp)*|cc|hh)$' | \
141 sed -e '/\/CVS\//d' -e '/\/RCS\//d' -e 's/^\.\///' | \
144 if [ "X$VERBOSE" != "X" ]
146 echo "Creating list of files to index ... done"
149 if [ "X$LIST_ONLY" != "X" ]
154 if [ "X$VERBOSE" != "X" ]
156 echo "Indexing files ..."
159 cscope
-b -i $LIST_FILE -f $DATABASE_FILE
161 if [ "X$VERBOSE" != "X" ]
163 echo "Indexing files ... done"