cscope man page on DigitalUNIX

Man page or keyword search:  
man Server   12896 pages
apropos Keyword Search (all sections)
Output format
DigitalUNIX logo
[printable version]

cscope(1)							     cscope(1)

       cscope - Examines a C program interactively

       cscope [-options] files...

       Builds  the cross reference only.  Ignores letter case when  searching.
       Uses only ASCII characters in the cross reference file, that is, do not
       compress	 the  data.  Does not update the cross references.  Suppresses
       the [^e] command prompt between files.  Uses reffile as the cross  ref‐
       erence  file  name  instead of the default cscope.out.  Looks in incdir
       (before looking in INCDIR, the standard place for header files, usually

       /usr/include) for any #include files whose names does not begin with  a
       /  and  are not specified on the command line or in namefile below (the
       #include 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 -I appears, the direc‐
       tories are searched in the order	 they  appear  on  the	command	 line.
       Browses	through	 all  source  files whose names are listed in namefile
       (file names separated by spaces, tabs, or new  lines)  instead  of  the
       default	(cscope.files).	 When this option is specified, cscope ignores
       any files appearing on the command line.	  Specifies  a	single	search
       with  line  oriented  output  when  used	 with the -num pattern option.
       Specifies a  line  oriented  interface  (see  Line  Oriented  Interface
       below).	Locates to input field num (counting from 0) and find pattern.
       Prepends path to relative file names in a prebuilt 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  -d	option.	  Dis‐
       plays  the last n file path components instead of the default (1). Uses
       0 to not display the file name at all.  Looks  in  dir  for  additional
       source  files.  The  option is ignored if source files are given on the
       command line.  Uses only the first eight characters to match against  C
       symbols.	 The  regular  expression  containing special characters other
       than a period will not match any	 symbol	 if   its  minimum  length  is
       greater	than  eight  characters.  Does not check the file time stamps,
       and assumes that no files have  changed.	  Unconditionally  builds  the
       cross  reference	 file and assumes that all files have changed.	Prints
       on the first line of the screen, the version number of cscope.

	      The -I, -p, and -T options also can be in the cscope.files file.

       The cscope command is an interactive screen oriented tool  that	allows
       the  user  to  browse  through C source files for specified elements of

       By default, the cscope command examines the C (.c and yacc (.y)	source
       files  in the current directory. The cscope command may also be invoked
       for source files named on  the command line.  In	 either	 case,	cscope
       searches the  standard directories for

       #include	 files	that  it  does not  find in the current directory. The
       cscope command uses a  symbol cross reference, cscope.out by   default,
       to  locate functions, function calls, macros, variables and  preproces‐
       sor symbols in the files.

       The cscope command builds the symbol cross reference the first time  it
       is  used on the source files for the program being browsed.  On	a sub‐
       sequent invocation, the cscope command rebuilds	the   cross  reference
       only  if a source file has changed or the list of source files is  dif‐
       ferent. 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.

   Initial Search Requesting
       When the cross reference is ready, cscope will display this menu:

	 Find this C symbol:
	 Find this function 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:

       Pressing the [TAB] key repeatedly to move to the desired	 input	field,
       type the text to search for, and then press the [RETURN] key.

   Issuing Subsequent Requests
       If the search is successful, any of these single character commands can
       be used: Edits the file referenced by the given line number.   Displays
       the  next  set  of  matching  lines.  Displays the next set of matching
       lines.  Displays the previous set of matching lines.   Edits  displayed
       files  in order.	 Appends the displayed list of lines to a file.	 Pipes
       all lines to a shell command.

       At any time these single character commands also can be	used: Moves to
       the  next  input	 field.	  Moves to the next input field.  Moves to the
       next input field.  Moves to the previous	 input	field.	 Searches  the
       last text typed.	 Moves to the previous input field and search pattern.
       Moves to the next input field and search pattern.   Toggles  ignore/use
       letter  case when searching. When ignoring letter case, search for FILE
       will match File and file.  Rebuilds the	cross  reference.   Starts  an
       interactive  shell  type [^d] to return to cscope.  Redraws the screen.
       Gives help information about cscope commands.  Exits  cscope.   If  the
       first  character	 of  the  text	to be searched for  matches one of the
       above commands, escape it by typing a [\] backslash first.

   New for Old Text Substitutions
       After the text to be changed has been typed, the	 cscope	 command  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  charac‐
       ter  commands:  Marks  or  unmarks  the	line  to be changed.  Marks or
       unmarks all displayed lines to be changed.  Displays the	 next  set  of
       lines.	Displays  the next set of lines.  Displays the previous set of
       lines.  Marks all lines to be changed.  Changes the  marked  lines  and
       exit.   Exits without changing the marked lines.	 Starts an interactive
       shell (type [^d] to return to cscope).  Redraws the screen.  Gives help
       information about cscope commands.

   Special Keys
       If  your	 keyboard  has arrow keys that work in vi, 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 [TAB] key repeatedly. If you
       have the [CLEAR], [NEXT], or [PREV] keys they will  act	as  the	 [^l],
       [+], and [-] commands, respectively.

   Line Oriented Interface
       The  -l	option	lets  you use cscope where a screen oriented interface
       would   not be useful, e.g., from another screen oriented program.  The
       cscope  command	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., lmain finds the definition of the main func‐
       tion.  If you  just want a single search, instead of the -l option  use
       the -L and -num pattern options and you will not	 get the >> prompt.

       For  the	 -l option, the cscope command outputs the number of reference
       lines cscope: 2 lines

       For each reference found, the cscope command outputs a line  consisting
       of  the file name, function name, line number, and line text, separated
       by spaces, for example, main.c main 161 main(argc, argv). Note that the
       editor  is  not called to display a single reference, unlike the screen
       oriented interface.

       You can use the r command to rebuild the database.  The cscope  command
       will  quit when it detects the end of file or  when the first character
       of an input line is [^d] or [q].

       The cscope command recognizes function definitions of the form: fname()
       blank  ( args ) white arg_decs white { where: Specifies the name of the
       function Specifies zero or more spaces or tabs, not including  newlines
       Specifies any string that does not contain a " or a newline Specifies a
       zero or more spaces, tabs, or newlines Specifies a zero or  more	 argu‐
       ment declarations (arg_decs may include comments and white space)

       It  is  not necessary for a function declaration to start at the begin‐
       ning of a line. The return type may precede the function	 name;	cscope
       will still recognize the declaration. Function definitions that deviate
       from this form will not be recognized by cscope.

       The Function column of the search  output  for  the  menu  option  Find
       functions  called  by  this function: input field will only display the
       first function called in the line, that is, for this function

		 return (f() + g());

       the display would be functions called by this function: e

       File Function Line

       a.c  f  3 return(f() + g());

       Occasionally, a function definition  or	call  may  not	be  recognized
       because of braces inside#if() statements. Similarly, the use of a vari‐
       able may be incorrectly recognized as a definition.

       A typedef() name preceding a preprocessor statement will be incorrectly
       recognized as a global definition, e.g.,

       LDFILE *
	 #if AR16WR

       Preprocessor  statements	 can  also prevent the recognition of a global
       definition, e.g.,

       char flag
		 = -1

       A function declaration inside a function is incorrectly recognized as a
       function call, e.g.,

		 void g();

       is incorrectly recognized as a call to g()().

       The cscope command recognizes C++ classes by looking for the class key‐
       word, but does not recognize that a structure is also a	class,	so  it
       doesn't	recognize  inline  member function definitions in a structure.
       It also does not expect the class keyword in a typedef(), so it	incor‐
       rectly recognizes X as a definition  in

       typedef class X * Y;

       It  also	 does  not  recognize  operator function definitions Bool Fea‐
       ture::operator==(const Feature & other)


       Success.	 An error occurred.

       The preferred editor, which defaults to vi.  The home directory,	 which
       is  automatically  set  at  login.  The standard directory for #include
       files (usually /usr/include).  A colon separated list of directories to
       search  for #include files.  The preferred shell, which defaults to sh.
       A colon separated list of directories to search for  additional	source
       files.  The terminal type, which must be a screen terminal.  The termi‐
       nal information directory with full path name. If your terminal is  not
       in  the	standard terminfo directory, see curses(3) and terminfo(4) for
       how to make your own terminal description.  The temporary  file	direc‐
       tory,  which  defaults to /var/tmp.  The preferred file display program
       such as pg, which overrides the EDITOR environment variable.   A	 colon
       separated  list	of  directories,  each of which has the same directory
       structure below it. If VPATH is set, the cscope	command	 searches  for
       source  files  in  the  directories specified; if it is not set, cscope
       searches only in the current directory.

       The default files containing -I, -p, and -T options  and	 the  list  of
       source files (overridden by the -i option).  The symbol cross reference
       file, which is put in the home directory if it cannot be created in the
       current	directory.   The temporary file containing new cross reference
       before it replaces the old cross reference.


List of man pages available for DigitalUNIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net