DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
C programmer's productivity tools

Configuring the environment

Before you can use cscope, you must ensure that it can employ the editor and terminal that you wish to use.

Setting the terminal type

Check the value of the TERM environment variable to make sure you have set it to the correct terminal type for your terminal. This is done with commands such as the following:

   TERM=ansi; export TERM
These commands may be used at the UNIX System prompt or in a .profile file.

When you invoke cscope, you may see the following error message:

   cscope: "term" is not in the terminal database.
If this message appears, your terminal may not be listed in the terminal information (terminfo) database that is currently loaded. Try reloading the database from the Terminal Information Utilities.

You may also see the message:

   cscope: TERM variable is not set or is not exported in your .profile
If this message appears, set and export the TERM variable.

Choosing an editor

By default, cscope invokes the vi editor. If you want to use another editor, such as the emacs editor, you must set the EDITOR environment variable. This is done with commands such as the following:

   EDITOR=emacs; export EDITOR
These commands may be used at the UNIX System prompt or in a .profile file.

cscope expects vi and any other editor it uses to have a standard command-line syntax of the following form:

editor +linenum filename

However, if the editor you want to use does not conform to this command-line syntax, you must write an interface between cscope and the editor.

For example, suppose you want to use ed. Because ed does not allow specification of a line number on the command line, you will not be able to edit or view any files while using cscope. To solve this problem, write a shell script called, for example, myedit, that consists of the following line:

   /bin/ed $2
Then set the value of EDITOR to the name of your shell script:

EDITOR=myedit; export EDITOR

Normally, when cscope invokes the editor, it uses a command line such as:

vi +17 file.c

Now, when cscope invokes the editor, it will calls the shell script myedit with the same arguments; this script will discard the line number and call ed correctly with the filename ($2).


NOTE: The ed tool has one other drawback as a cscope editor that you should take into consideration when selecting an editor: it cannot move you to specified lines in the file. If you use the shell script shown in the previous example, you will have to move to specified lines manually.

Choosing a browser

If you want to use cscope only for browsing (without editing) you can set the VIEWER environment variable to pg and export VIEWER. cscope will then invoke pg instead of vi.


Next topic: Using cscope
Previous topic: cscope

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003