NAME
cscope - interactively examine a C program
SYNOPSIS
ccssccooppee [[options]] files......
DESCRIPTION
ccssccooppee is an interactive screen-oriented tool that allows
the user to browse through C source files for specified ele-
ments of code.
By default, ccssccooppee examines the C (..cc and ..hh), lleexx (..ll), and
yyaacccc (..yy) source files in the current directory. ccssccooppee may
also be invoked for source files named on the command line.
In either case, ccssccooppee searches the standard directories for
##iinncclluuddee files that it does not find in the current direc-
tory. ccssccooppee uses a symbol cross-reference, ccssccooppee..oouutt by
default, to locate functions, function calls, macros, vari-
ables, and preprocessor symbols in the files.
ccssccooppee builds the symbol cross-reference the first time it
is used on the source files for the program being browsed.
On a subsequent invocation, ccssccooppee rebuilds the cross-
reference only if a source file has changed or the list of
source files is different. When the cross-reference is
rebuilt, the data for the unchanged files are copied from
the old cross-reference, which makes rebuilding faster than
the initial build.
The following options can appear in any combination:
--bb Build the cross-reference only.
--CC Ignore letter case when searching.
--cc Use only ASCII characters in the cross-
reference file, that is, do not compress the
data.
--dd Do not update the cross-reference.
--ee Suppress the ^^ee command prompt between files.
--ff reffile Use reffile as the cross-reference file name
instead of the default ccssccooppee..oouutt.
--II incdir Look in incdir (before looking in the stan-
dard place for header files, normally
//uussrr//iinncclluuddee) for any ##iinncclluuddee files whose
names do not begin with // and that are not
specified on the command line or in namefile
below. (The ##iinncclluuddee files may be specified
with either double quotes or angle brackets.)
The incdir directory is searched in addition
to the current directory (which is searched
first) and the standard list (which is
searched last). If more than one occurrence
of --II appears, the directories are searched
in the order they appear on the command line.
--ii namefile Browse through all source files whose names
are listed in namefile (file names separated
by spaces, tabs, or new-lines) instead of the
default (ccssccooppee..ffiilleess). If this option is
specified, ccssccooppee ignores any files appearing
on the command line.
--LL Do a single search with line-oriented output
when used with the --num pattern option.
--ll Line-oriented interface (see ``Line-Oriented
Interface'' below).
--num pattern Go to input field num (counting from 0) and
find pattern.
--PP path Prepend path to relative file names in a
pre-built cross-reference file so you do not
have to change to the directory where the
cross-reference file was built. This option
is only valid with the --dd option.
--pp n Display the last n file path components
instead of the default (1). Use 0 to not
display the file name at all.
--ss dir Look in dir for additional source files.
This option is ignored if source files are
given on the command line.
--TT Use only the first eight characters to match
against C symbols. A regular expression con-
taining special characters other than a
period (.) will not match any symbol if its
minimum length is greater than eight charac-
ters.
--UU Do not check file time stamps (assume that no
files have changed).
--uu Unconditionally build the cross-reference
file (assume that all files have changed).
--VV Print on the first line of screen the version
number of ccssccooppee.
The --II, --pp, and --TT options can also be in the ccssccooppee..ffiilleess
file.
Requesting the Initial Search
After the cross-reference is ready, ccssccooppee will display this
menu:
Find this C symbol:
Find this global definition:
Find functions called by this function:
Find functions calling this function:
Find this text string:
Change this text string:
Find this egrep pattern:
Find this file:
Find files #including this file:
Press the TTAABB key repeatedly to move to the desired input
field, type the text to search for, and then press the
RREETTUURRNN key.
Issuing Subsequent Requests
If the search is successful, any of these single-character
commands can be used:
11--99 Edit the file referenced by the given line
number.
SSPPAACCEE Display next set of matching lines.
++ Display next set of matching lines.
-- Display previous set of matching lines.
^^ee Edit displayed files in order.
>> Append the displayed list of lines to a file.
|| Pipe all lines to a shell command.
At any time these single-character commands can also be
used:
TTAABB Move to next input field.
RREETTUURRNN Move to next input field.
^^nn Move to next input field.
^^pp Move to previous input field.
^^yy Search with the last text typed.
^^bb Move to previous input field and search pattern.
^^ff Move to next input field and search pattern.
^^cc Toggle ignore/use letter case when searching.
(When ignoring letter case, search for FFIILLEE will
match FFiillee and ffiillee.)
^^rr Rebuild the cross-reference.
!! Start an interactive shell (type ^^dd to return to
ccssccooppee).
^^ll Redraw the screen.
?? Give help information about ccssccooppee commands.
^^dd Exit ccssccooppee.
Note: If the first character of the text to be searched for
matches one of the above commands, escape it by typing a \
(backslash) first.
Substituting New Text for Old Text
After the text to be changed has been typed, ccssccooppee will
prompt for the new text, and then it will display the lines
containing the old text. Select the lines to be changed
with these single-character commands:
11--99 Mark or unmark the line to be changed.
** Mark or unmark all displayed lines to be changed.
SSPPAACCEE Display next set of lines.
++ Display next set of lines.
-- Display previous set of lines.
aa Mark all lines to be changed.
^^dd Change the marked lines and exit.
EESSCCAAPPEE Exit without changing the marked lines.
!! Start an interactive shell (type ^^dd to return to
ccssccooppee).
^^ll Redraw the screen.
?? Give help information about ccssccooppee commands.
Special Keys
If your terminal has arrow keys that work in vi(1), you can
use them to move around the input fields. The up-arrow key
is useful to move to the previous input field instead of
using the TTAABB key repeatedly. If you have the CCLLEEAARR, NNEEXXTT,
or PPRREEVV keys they will act as the ^^ll, ++, and -- commands,
respectively.
Line-Oriented Interface
The --ll option lets you use cscope where a screen-oriented
interface would not be useful, e.g., from another screen-
oriented program.
ccssccooppee will prompt with >>>> when it is ready for an input
line starting with the field number (counting from 0)
immediately followed by the search pattern, e.g., llmmaaiinn
finds the definition of the mmaaiinn function.
If you just want a single search, instead of the --ll option
use the --LL and --num pattern options, and you won't get the
>>>> prompt.
For --ll, ccssccooppee outputs the number of reference lines.
ccssccooppee:: 22 lliinneess
For each reference found, ccssccooppee outputs a line consisting
of the file name, function name, line number, and line text,
separated by spaces, e.g.,
mmaaiinn..cc mmaaiinn 116611 mmaaiinn((aarrggcc,, aarrggvv))
Note that the editor is not called to display a single
reference, unlike the screen-oriented interface.
You can use the rr command to rebuild the database.
ccssccooppee will quit when it detects end-of-file, or when the
first character of an input line is ^^dd or qq.
ENVIRONMENT VARIABLES
EEDDIITTOORR Preferred editor, which defaults to vi(1).
IINNCCLLUUDDEEDDIIRRSS Colon-separated list of directories to search
for ##iinncclluuddee files.
HHOOMMEE Home directory, which is automatically set at
login.
SSHHEELLLL Preferred shell, which defaults to sh(1).
SSOOUURRCCEEDDIIRRSS Colon-separated list of directories to search
for additional source files.
TTEERRMM Terminal type, which must be a screen termi-
nal.
TTEERRMMIINNFFOO Terminal information directory full path
name. If your terminal is not in the stan-
dard tteerrmmiinnffoo directory, see curses(3X) and
terminfo(4) for how to make your own terminal
description.
TTMMPPDDIIRR Temporary file directory, which defaults to
//vvaarr//ttmmpp.
VVIIEEWWEERR Preferred file display program [such as ppgg],
which overrides EEDDIITTOORR (see above).
VVPPAATTHH A colon-separated list of directories, each
of which has the same directory structure
below it. If VVPPAATTHH is set, ccssccooppee searches
for source files in the directories speci-
fied; if it is not set, ccssccooppee searches only
in the current directory.
FILES
ccssccooppee..ffiilleess Default files containing --II, --pp, and --TT
options and the list of source files (over-
ridden by the --ii option).
ccssccooppee..oouutt Symbol cross-reference file, which is put in
the home directory if it cannot be created in
the current directory.
nnccssccooppee..oouutt Temporary file containing new cross-reference
before it replaces the old cross-reference.
SEE ALSO
The C User's Guide.
NOTES
ccssccooppee recognizes function definitions of the form:
fname blank (( args )) white arg_decs white {{
where:
fname is the function name
blank is zero or more spaces or tabs, not including
newlines
args is any string that does not contain a "" or a new-
line
white is zero or more spaces, tabs, or newlines
arg_decs are zero or more argument declarations (arg_decs
may include comments and white space)
It is not necessary for a function declaration to start at
the beginning of a line. The return type may precede the
function name; ccssccooppee will still recognize the declaration.
Function definitions that deviate from this form will not be
recognized by ccssccooppee.
The FFuunnccttiioonn column of the search output for the menu option
FFiinndd ffuunnccttiioonnss ccaalllleedd bbyy tthhiiss ffuunnccttiioonn:: input field will
only display the first function called in the line, that is,
for this function
ee(())
{{
rreettuurrnn ((ff(()) ++ gg(())));;
}}
the display would be
FFuunnccttiioonnss ccaalllleedd bbyy tthhiiss ffuunnccttiioonn:: ee
FFiillee FFuunnccttiioonn LLiinnee
aa..cc ff 33 rreettuurrnn((ff(()) ++ gg(())));;
Occasionally, a function definition or call may not be
recognized because of braces inside ##iiff statements. Simi-
larly, the use of a variable may be incorrectly recognized
as a definition.
A ttyyppeeddeeff name preceding a preprocessor statement will be
incorrectly recognized as a global definition, e.g.,
LLDDFFIILLEE **
##iiff AARR1166WWRR
Preprocessor statements can also prevent the recognition of
a global definition, e.g.,
cchhaarr ffllaagg
##iiffddeeff AALLLLOOCCAATTEE_SSTTOORRAAGGEE
== --11
##eennddiiff
;;
A function declaration inside a function is incorrectly
recognized as a function call, e.g.,
ff(())
{{
vvooiidd gg(());;
}}
is incorrectly recognized as a call to gg(()).
ccssccooppee recognizes C++ classes by looking for the class key-
word, but doesn't recognize that a ssttrruucctt is also a class,
so it doesn't recognize inline member function definitions
in a structure. It also doesn't expect the class keyword in
a ttyyppeeddeeff, so it incorrectly recognizes XX as a definition in
ttyyppeeddeeff ccllaassss XX ** YY;;
It also doesn't recognize operator function definitions
BBooooll FFeeaattuurree::::ooppeerraattoorr====((ccoonnsstt FFeeaattuurree && ootthheerr))
{{
......
}}
|
Закладки на сайте Проследить за страницей |
Created 1996-2025 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |