Before you can use cscope, you must ensure that it can employ the editor and terminal that you wish to use.
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 TERMThese 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 .profileIf this message appears, set and export the TERM variable.
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 EDITORThese 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 $2Then set the value of EDITOR to the name of your shell script:
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).
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.