From owner-freebsd-ports Sun Apr 23 11:21:13 2000 Delivered-To: freebsd-ports@freebsd.org Received: from wcn4.wcnet.net (mail.wcnet.net [216.88.248.234]) by hub.freebsd.org (Postfix) with ESMTP id 1620337B8E4; Sun, 23 Apr 2000 11:20:51 -0700 (PDT) (envelope-from jestess@wcnet.net) Received: from ec-nortel-0089.wcnet.net [216.88.253.91] by wcn4.wcnet.net with ESMTP (SMTPD32-6.00) id AEFB411023A; Sun, 23 Apr 2000 13:20:43 -0500 Date: Sun, 23 Apr 2000 18:23:50 -0500 (CDT) From: John Estess X-Sender: jestess@localhost.localdomain To: doc@freebsd.org Cc: ports@freebsd.org Subject: cscope man page in text Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org My apologies - I didn't know Pine sent attachments in Mime. ____________________________________________________________ .Dd April 22, 2000 .Dt CSCOPE 1 .Os FreeBSD 4.0 .Sh NAME .Nm cscope .Nd interactively examine a C program .Sh SYNOPSIS .Nm cscope .Op [options] .Op [file . . . ] .Sh DESCRIPTION .Nm is an interactive, screen-oriented tool that allows the user to browse through C source files for specified elements of code. By default, .Nm examines the C (.c and .h), lex (.l), and yacc (.y) source files in the current directory. .Nm may also be invoked for source files named on the command line. In either case, .Nm searches the standard directories for #include files that it does not find in the current directory. .Nm uses a symbol cross-reference, .Pa cscope.out by default, to locate functions, function calls, macros, variables, and preprocessor symbols in the files. .Nm builds the symbol cross-reference the first time it is used on the source files for the program being browsed. On a subsequent invocation, .Nm 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: .Bl -tag -width indent .It Fl b Build the cross-reference only. .It Fl C Ignore letter case when searching. .It Fl c Use only ASCII characters in the cross-reference file, that is, do not compress the data. .It Fl d Do not update the cross-reference. .It Fl e Suppress the -e command prompt between files. .It Fl F symfile Read symbol reference lines from symfile. (A symbol reference file is created by > and >>, and can also be read using the < command, described under ``Issuing Subsequent Requests,'' below.) .It Fl f reffile Use reffile as the cross-reference file name instead of the default .Pa cscope.out. .It Fl I incdir Look in incdir (before looking in INCDIR, the standard place for header files, normally .Pa /usr/include ) for any #include files whose names do not begin with ``/'' and that 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 .Fl I appears, the directories are searched in the order they appear on the command line. .It Fl i namefile Browse through all source files whose names are listed in namefile .Pq file names separated by spaces, tabs, or new-lines instead of the default .Pq Pa cscope.files . If this option is specified, .Nm ignores any files appearing on the command line. .It Fl L Do a single search with line-oriented output when used with the .Fl num pattern option. .It Fl l Line-oriented interface (see ``Line-Oriented Interface'' below). .It Fl num pattern Go to input field num (counting from 0) and find pattern. .It Fl P 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 .Fl d option. .It Fl p n Display the last .Sy n file path components instead of the default (1). Use 0 to not display the file name at all. .It Fl q Build an inverted index for quick symbol searching. If you use this option with the .Fl f option, you must use .Fl f on every call to .Nm , including when you build the cross-reference file, because it changes the names of the inverted index files. .It Fl s dir Look in dir for additional source files. This option is ignored if source files are given on the command line. .It Fl T Use only the first eight characters to match against C symbols. A regular expression containing special characters other than a period (.) will not match any symbol if its minimum length is greater than eight characters. .It Fl U Check file time stamps. This option will update the time stamp on the database even if no files have changed. .It Fl u Unconditionally build the cross-reference file (assume that all files have changed). .It Fl V Print on the first line of screen the version number of .Nm . .Pp The .Fl I , .Fl p , .Fl q , and .Fl T options can also be in the .Pa cscope.files file. .El .Pp .Ss Requesting the initial search .Pp After the cross-reference is ready, .Nm will display this menu: .Pp .Bl -inset -offset -indent -compact .It Find this C symbol: .It Find this function definition: .It Find functions called by this function: .It Find functions calling this function: .It Find this text string: .It Change this text string: .It Find this egrep pattern: .It Find this file: .It Find files #including this file: .El .Pp Press the key repeatedly to move to the desired input field, type the text to search for, and then press the key. .Pp .Ss Issuing subsequent requests .Pp If the search is successful, any of these single-character commands can be used: .Bl -tag -width indent .It Sy 1-9 Edit the file referenced by the given line number. .It Aq Sy Space Display next set of matching lines. .It Sy + Display next set of matching lines. .It Sy - Display previous set of matching lines. .It Sy ^e Edit displayed files in order. .It Sy > Write the displayed list of lines to a file. .It Sy >> Append the displayed list of lines to a file. .It Sy < Read lines from a file that is in symbol reference format (created by > or >>), just like the -F option. .It Sy ^ Filter all lines through a shell command and display the resulting lines, replacing the lines that were already there. .It Sy | Pipe all lines to a shell command and display them without changing them. .El .Pp At any time these single-character commands can also be used: .Bl -tag -width indent .It Aq Sy Tab Move to next input field. .It Aq Sy Return Move to next input field. .It Sy ^n Move to next input field. .It Sy ^p Move to previous input field. .It Sy ^y Search with the last text typed. .It Sy ^b Move to previous input field and search pattern. .It Sy ^f Move to next input field and search pattern. .It Sy ^c Toggle ignore/use letter case when searching. (When ignoring letter case, search for ``FILE'' will match ``File'' and ``file''.) .It Sy ^r Rebuild the cross-reference. .It Sy ! Start an interactive shell (type ^d to return to .Nm ). .It Sy ^l Redraw the screen. .It Sy ? Give help information about .Nm commands. .It Sy ^d Exit .Nm .El .Pp 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. .Pp .Ss Substituting new text for old text .Pp After the text to be changed has been typed, .Nm 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: .Bl -tag -width indent .It 1-9 Mark or unmark the line to be changed. .It * Mark or unmark all displayed lines to be changed. .It Aq Space Display next set of lines. .It + Display next set of lines. .It - Display previous set of lines. .It a Mark or unmark all lines to be changed. .It ^d Change the marked lines and exit. .It Aq Esc Exit without changing the marked lines. .It ! Start an interactive shell (type ^d to return to .Nm ). .It ^l Redraw the screen. .It ? Give help information about .Nm commands. .El .Pp .Ss Special keys .Pp If your terminal 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 key repeatedly. If you have , , or keys they will act as the ^l, +, and - commands, respectively. .Pp .Ss Line-Oriented interface .Pp The -l option lets you use .Nm where a screen-oriented interface would not be useful, for example, from another screen-oriented program. .Pp .Nm 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, for example, ``lmain'' finds the definition of the main function. .Pp If you just want a single search, instead of the -l option use the -L and -num pattern options, and you won't get the >> prompt. .Pp For -l, .Nm outputs the number of reference lines .Nm : 2 lines .Pp For each reference found, .Nm 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) .Pp Note that the editor is not called to display a single reference, unlike the screen-oriented interface. .Pp You can use the c command to toggle ignore/use letter case when searching. (When ignoring letter case, search for ``FILE'' will match ``File'' and ``file''.) .Pp You can use the r command to rebuild the database. .Pp .Nm will quit when it detects end-of-file, or when the first character of an input line is ``^d'' or ``q''. .Pp .Bl -tag -width indent .Ss Environment variables .It Ev EDITOR Preferred editor, which defaults to vi. .It Ev HOME Home directory, which is automatically set at login. .It Ev INCLUDEDIRS Colon-separated list of directories to search for #include files. .It Ev SHELL Preferred shell, which defaults to sh. .It Ev SOURCEDIRS Colon-separated list of directories to search for additional source files. .It Ev TERM Terminal type, which must be a screen terminal. .It Ev TERMINFO Terminal information directory full path name. If your terminal is not in the standard terminfo directory, see curses and terminfo for how to make your own terminal description. .It Ev TMPDIR Temporary file directory, which defaults to /var/tmp. .It Ev VIEWER Preferred file display program (such as less), which overrides EDITOR (see above). .It Ev VPATH A colon-separated list of directories, each of which has the same directory structure below it. If VPATH is set, .Nm searches for source files in the directories specified; if it is not set, .Nm searches only in the current directory. .El .Pp .Ss Files .Bl -tag -width indent .It Em cscope.files Default files containing -I , -p, -q, and -T options and the list of source files (overridden by the -i option). .It Em cscope.out Symbol cross-reference file (overridden by the -f option), which is put in the home directory if it cannot be created in the current directory. .It Em cscope.in.out, cscope.po.out Default files containing the inverted index used for quick symbol searching (-q option). If you use the -f option to rename the cross-reference file (so it's not cscope.out ), the names for these inverted index files will be created by adding .in and .po to the name you supply with -f. For example, if you indicated -f xyz, then these files would be named xyz.in and xyz.po. .It Em INCDIR Standard directory for #include files (usually /usr/include). .El .Pp .Ss Notices .Pp .Nm recognizes function definitions of the form: .Pp fname blank ( args ) white arg_decs white { .Bl -tag -width indent .It Sy where: .It fname is the function name .It blank is zero or more spaces or tabs, not including newlines .It args is any string that does not contain a ``"'' or a newline .It white is zero or more spaces, tabs, or newlines .It arg_decs are zero or more argument declarations (arg_decs may include comments and white space) .El .Pp It is not necessary for a function declaration to start at the beginning of a line. The return type may precede the function name; .Nm will still recognize the declaration. Function definitions that deviate from this form will not be recognized by .Nm .Pp 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 .Bl -inset -offset indent -compact .It e() .It { .It return (f() + g()); .It } .El the display would be: .Bl -inset -offset indent -compact .It Functions called by this function: e .It File Function Line .It a.c f 3 return(f() + g()); .El .Pp Occasionally, a function definition or call may not be recognized because of braces inside #if statements. Similarly, the use of a variable may be incorrectly recognized as a definition. .Pp A typedef name preceding a preprocessor statement will be incorrectly recognized as a global definition, for example, .Bl -inset -offset indent -compact .It LDFILE * .It #if AR16WR .El .Pp Preprocessor statements can also prevent the recognition of a global definition, for example, .Bl -inset -offset indent -compact .It char flag .It #ifdef ALLOCATE_STORAGE .It = -1 .It #endif .It ; .El .Pp A function declaration inside a function is incorrectly recognized as a function call, for example, .Bl -inset -offset indent -compact .It f() .It { .It void g(); .It } .El is incorrectly recognized as a call to g. .Pp .Nm recognizes C++ classes by looking for the class keyword, but doesn't recognize that a struct 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 typedef, so it incorrectly recognizes X as a definition in .Bl -inset -offset indent -compact .It typedef class X * Y; .El .Pp It also doesn't recognize operator function definitions .Bl -inset -offset indent -compact .It Bool Feature::operator==(const Feature & other) .It { .It ... .It } .El .Pp Nor does it recognize function definitions with a function pointer argument. .Bl -inset -offset indent -compact .It ParseTable::Recognize(int startState, .It char *pattern, int finishState, .It void (*FinalAction)(char *)) .It { .It ... .It } .El .Sh COPYRIGHT 17 April 2000 The Santa Cruz Operation, Inc. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message