Browsing through your code with cscope

Using viewpaths

cscope searches for source files in the current directory by default. When the environment variable VPATH is set, cscope searches for source files in directories that comprise your viewpath. A viewpath is an ordered list of directories, each of which has the same directory structure below it.

For example, suppose you are part of a software project. There is an ``official'' set of source files in directories below /fs1/ofc. Each user has a home directory (/usr/you). If you make changes to the software system, you may have copies of just those files you are changing in /usr/you/src/cmd/prog1. The official versions of the entire program can be found in the directory /fs1/ofc/src/cmd/prog1.

Suppose you use cscope to browse through the three files that comprise prog1, namely, f1.c, f2.c, and f3.c. You would set VPATH to /usr/you and /fs1/ofc and export it, as in

   $ VPATH=/usr/you:/fs1/ofc export VPATH
You would then make your current directory /usr/you/src/cmd/prog1, and invoke cscope:
   $ cscope
The program will locate all files in the viewpath. In case duplicates are found, cscope uses the file whose parent directory appears earlier in VPATH. Thus if f2.c is in your directory (and all three files are in the official directory), cscope will examine f2.c from your directory and f1.c and f3.c from the official directory.

The first directory in VPATH must be a prefix (usually $HOME) of the directory you will be working in. Each colon-separated directory in VPATH must be absolute: it should begin at /.

Next topic: Stacking cscope and editor calls
Previous topic: Command line options

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005