1GTAGS-CSCOPE(1)             General Commands Manual            GTAGS-CSCOPE(1)
2
3
4

NAME

6       gtags-cscope - interactively examine a C program
7

SYNOPSIS

9       gtags-cscope [-bCdehLlVv][-F file ][-012345678 pattern][-p n]
10

DESCRIPTION

12       gtags-cscope  is  an  interactive, screen-oriented tool that allows the
13       user to browse through source files for specified elements of code.
14
15       gtags-cscope builds the symbol cross-reference the  first  time  it  is
16       used on the source files for the program being browsed. On a subsequent
17       invocation, gtags-cscope rebuilds the cross-reference only if a  source
18       file  has  changed  or  the list of source files is different. When the
19       cross-reference is rebuilt, it is updated  incrementally,  which  makes
20       rebuilding faster than the initial build.
21
22       gtags-cscope  is a tool which just borrows user interface of cscope; it
23       is GLOBAL itself for the substance.
24

OPTIONS

26       Some command line arguments can only occur as the only argument in  the
27       execution  of  gtags-cscope.   They cause the program to just print out
28       some output and exit immediately:
29
30       -h     View the long usage help display.
31
32       -V     Print the version number of gtags-cscope.
33
34       --help Same as -h
35
36       --version
37              Same as -V
38
39       The following options can appear in any combination:
40
41       -a     Print absolute path names.
42
43       -b     Build the cross-reference only.
44
45       -C     Ignore letter case when searching.
46
47       -d     Do not update the cross-reference.
48
49       -e     Suppress the ´^e´ command prompt between files.
50
51       -F file
52              Read symbol reference lines from file.  (A symbol reference file
53              is  created  by  > and >>, and can also be read using the < com‐
54              mand, described under ``Issuing Subsequent Requests'', below.)
55
56       -i     Ignore SIGINT signal in line-oriented mode.
57
58       -L     Do a single search with line-oriented output when used with  the
59              -num pattern option.
60
61       -l     Line-oriented interface.  This option implies the -d option.
62
63       -[0-9] pattern
64              Go to input field num (counting from 0) and find pattern.
65
66       -p n   Display  the  last n file path components instead of the default
67              (1). Use ´0´ to not display the file name at all.
68
69       -v     Be more verbose in line-oriented mode.
70
72       After the cross-reference is  ready,  gtags-cscope  will  display  this
73       menu:
74
75       Find this symbol:
76       Find this function definition:
77       Find functions called by this function (N/A):
78       Find references of this function:
79       Find this text string:
80       Change this text string:
81       Find this egrep pattern:
82       Find this file:
83       Find files #including this file:
84
85       Press  the  <Up> or <Down> keys repeatedly to move to the desired input
86       field, type the text to search for, and then press the <Return> key.
87

Issuing subsequent requests

89       If the search is successful, any of these single-character commands can
90       be used:
91
92       0-9a-zA-Z
93              Edit the file referenced by the given line number.
94
95       <Space>
96              Display next set of matching lines.
97
98       <Tab>  Alternate between the menu and the list of matching lines
99
100       <Up>   Move to the previous menu item (if the cursor is in the menu) or
101              move to the previous matching line (if  the  cursor  is  in  the
102              matching line list).
103
104       <Down> Move  to  the  next  menu item (if the cursor is in the menu) or
105              move to the next matching line (if the cursor is in the matching
106              line list).
107
108       +      Display next set of matching lines.
109
110       -      Display previous set of matching lines.
111
112       ^e     Edit displayed files in order.
113
114       >      Write the displayed list of lines to a file.
115
116       >>     Append the displayed list of lines to a file.
117
118       <      Read  lines from a file that is in symbol reference format (cre‐
119              ated by ´>´ or ´>>´), just like the -F option.
120
121       ^      Filter all lines through a shell command and display the result‐
122              ing lines, replacing the lines that were already there.
123
124       |      Pipe  all  lines  to  a  shell  command and display them without
125              changing them.
126
127       ^g     Read lines from the result of the execution of global(1).
128
129       At any time these single-character commands can also be used:
130
131       <Return>
132              Move to next input field.
133
134       ^n     Move to next input field.
135
136       ^p     Move to previous input field.
137
138       ^y     Search with the last text typed.
139
140       ^b     Move to previous input field and search pattern.
141
142       ^f     Move to next input field and search pattern.
143
144       ^c     Toggle ignore/use letter case  when  searching.  (When  ignoring
145              letter case, a search for ´FILE´ will match ´File´ and ´file´.)
146
147       ^r     Rebuild the cross-reference.
148
149       !      Start  an  interactive  shell  (type  ´^d´  to  return to gtags-
150              cscope).
151
152       ^l     Redraw the screen.
153
154       ?      Give help information about gtags-cscope commands.
155
156       ^d     Exit gtags-cscope.
157
158       NOTE: If the first character of the text to be searched for matches one
159       of the above commands, escape it by typing a ´\' (backslash) first.
160
161       Substituting new text for old text
162
163       After  the  text to be changed has been typed, gtags-cscope will prompt
164       for the new text, and then it will display the lines containing the old
165       text.  Select  the lines to be changed with these single-character com‐
166       mands:
167
168       0-9a-zA-Z
169              Mark or unmark the line to be changed.
170
171       *      Mark or unmark all displayed lines to be changed.
172
173       <Space>
174              Display next set of lines.
175
176       +      Display next set of lines.
177
178       -      Display previous set of lines.
179
180       ^a     Mark or unmark all lines to be changed.
181
182       ^d     Change the marked lines and exit.
183
184       <Esc>  Exit without changing the marked lines.
185
186       !      Start an interactive  shell  (type  ´^d´  to  return  to  gtags-
187              cscope).
188
189       ^l     Redraw the screen.
190
191       ?      Give help information about gtags-cscope commands.
192
193       Special keys
194              If  your  terminal  has  arrow keys that work in vi, you can use
195              them to move around the input fields. The up-arrow key is useful
196              to  move  to the previous input field instead of using the <Tab>
197              key repeatedly. If you have <CLEAR>, <NEXT>, or <PREV> keys they
198              will act as the ´^l´, ´+´, and ´-´ commands, respectively.
199

Line-Oriented interface

201       The  -l option lets you use gtags-cscope where a screen-oriented inter‐
202       face would not be useful, for  example,  from  another  screen-oriented
203       program.
204
205       gtags-cscope  will prompt with ´>>´ when it is ready for an input line,
206       which starts with the field number (counting from 0), immediately  fol‐
207       lowed  by the search pattern. For example, ´1main´ finds the definition
208       of the ´main´ function.
209
210       If you just want a single search, instead of the -l option use  the  -L
211       and -num pattern options, and you won't get the ´>>´ prompt.
212
213       For -l, gtags-cscope outputs the number of reference lines:
214       cscope: 2 lines
215
216       For each reference found, gtags-cscope outputs a line consisting of the
217       file name, function name, line number, and line text, separated by spa‐
218       ces.  For example:
219       main.c main 161 main(argc, argv)
220
221       Note  that  the  editor  is  not  called to display a single reference,
222       unlike the screen-oriented interface.
223
224       You can use the ´c´ command  to  toggle  ignore/use  letter  case  when
225       searching.  (When  ignoring letter case, a search for ´FILE´ will match
226       ´File´ and ´file´.)
227
228       You can use the ´r´ command to rebuild the database.
229
230       gtags-cscope will quit when it detects end-of-file, or when  the  first
231       character of an input line is ´^d´ or ´q´.
232

ENVIRONMENT VARIABLES

234       The following environment variables are of cscope origin.
235
236       CSCOPE_EDITOR
237              Overrides the EDITOR and VIEWER variables.  Use this if you wish
238              to use a different editor with cscope  than  that  specified  by
239              your EDITOR/VIEWER variables.
240
241       CSCOPE_LINEFLAG
242              Format  of  the  line  number flag for your editor.  By default,
243              cscope invokes your editor via  the  equivalent  of  ´editor  +N
244              file´,  where  N  is the line number that the editor should jump
245              to.  This format is used by both emacs and vi.  If  your  editor
246              needs  something  different,  specify  it in this variable, with
247              ´%s´ as a placeholder for the line number.  Eg: if  your  editor
248              needs  to  be  invoked as ´editor -#103 file´ to go to line 103,
249              set this variable to ´-#%s´.
250
251       CSCOPE_LINEFLAG_AFTER_FILE
252              Set this variable to ´yes´ if your editor needs  to  be  invoked
253              with  the line number option after the filename to be edited. To
254              continue the example from CSCOPE_LINEFLAG, above: if your editor
255              needs  to see ´editor file -#number´, set this environment vari‐
256              able.  Users of most standard editors (vi, emacs) do not need to
257              set this variable.
258
259       EDITOR Preferred editor, which defaults to vi.
260
261       HOME   Home directory, which is automatically set at login.
262
263       SHELL  Preferred shell, which defaults to sh.
264
265       TERM   Terminal type, which must be a screen terminal.
266
267       TERMINFO
268              Terminal  information directory full path name. If your terminal
269              is not in the standard terminfo directory, see curses  and  ter‐
270              minfo for how to make your own terminal description.
271
272       TMPDIR Temporary file directory, which defaults to ´/tmp´.
273
274       VIEWER Preferred  file  display program (such as less), which overrides
275              EDITOR (see above).
276
277       The following environment variables are of GLOBAL origin.
278
279       GTAGSCONF
280              Configuration file.
281
282       GTAGSGLOBAL
283              If this variable is set, ´$GTAGSGLOBAL´ is used as the  name  of
284              global(1). The default is global.
285
286       GTAGSGTAGS
287              If  this  variable  is set, ´$GTAGSGTAGS´ is used as the name of
288              gtags(1). The default is gtags.
289
290       GTAGSDBPATH
291              The directory in which the  tag  files  exist.   This  value  is
292              ignored when GTAGSROOT is not defined.
293
294       GTAGSLABEL
295              Configuration label. The default is ´default´.
296
297       GTAGSLIBPATH
298              If  this  variable  is set, it is used as the path to search for
299              library functions. If the specified tags is  not  found  in  the
300              project,  global  also  searches  in  these  paths.   Since only
301              ´GTAGS´ is targeted in the retrieval, this variable  is  ignored
302              when -r or -s is specified.
303
304       GTAGSROOT
305              The root directory of the project.
306
307       MAKEOBJDIR
308              If  this  variable  is set, ´$MAKEOBJDIR´ is used as the name of
309              BSD-style objdir. The default is ´obj´.
310
311       MAKEOBJDIRPREFIX
312              If this variable is set, ´$MAKEOBJDIRPREFIX´ is used as the pre‐
313              fix of BSD-style objdir. The default is ´/usr/obj´.
314

FILES

316       ´GTAGS´
317              Tag file for definitions.
318
319       ´GRTAGS´
320              Tag file for references.
321
322       ´GPATH´
323              Tag file for source files.
324
325       ´GTAGSROOT´
326              If  environment  variable  GTAGSROOT is not set and file ´GTAGS‐
327              ROOT´ exists in the same directory as ´GTAGS´ then  global  sets
328              GTAGSROOT to the contents of the file.
329
330       ´gtags.conf´, ´$HOME/.globalrc´
331              Configuration data for GNU GLOBAL.  See gtags.conf(5).
332

SEE ALSO

334       gtags(1), global(1), htags(1).
335
336       GNU GLOBAL source code tag system
337       (http://www.gnu.org/software/global/).
338

BUG

340       The  function  field  of  the  display is almost <unknown> since GLOBAL
341       doesn't recognize it.
342
343       ´Find functions called by this function´ is not implemented.
344

AUTHOR

346       Joe Steffen (original author) and others.
347

HISTORY

349       Cscope was originally developed at Bell Labs in the  early  1980s,  and
350       was  released  as  free  software  under the BSD license in April 2000.
351       Gtags-cscope is a derivative of cscope to use GLOBAL as  the  back-end.
352       Its line-oriented interface was originally written in 2006, and was re-
353       implemented in 2011 using cscope itself.
354
355
356
357GNU Project                       March 2011                   GTAGS-CSCOPE(1)
Impressum