1CTAGS(1) General Commands Manual CTAGS(1)
2
3
4
6 ctags - create a tags file
7
9 ctags [ -BFatuwvx ] [ -f tagsfile ] name ...
10
12 Ctags makes a tags file for ex(1) from the specified C, Pascal, For‐
13 tran, YACC, lex, and lisp sources. A tags file gives the locations of
14 specified objects (in this case functions and typedefs) in a group of
15 files. Each line of the tags file contains the object name, the file
16 in which it is defined, and an address specification for the object
17 definition. Functions are searched with a pattern, typedefs with a line
18 number. Specifiers are given in separate fields on the line, separated
19 by blanks or tabs. Using the tags file, ex can quickly find these
20 objects definitions.
21
22 If the -x flag is given, ctags produces a list of object names, the
23 line number and file name on which each is defined, as well as the text
24 of that line and prints this on the standard output. This is a simple
25 index which can be printed out as an off-line readable function index.
26
27 If the -v flag is given, an index of the form expected by vgrind(1) is
28 produced on the standard output. This listing contains the function
29 name, file name, and page number (assuming 64 line pages). Since the
30 output will be sorted into lexicographic order, it may be desired to
31 run the output through sort -f. Sample use:
32 ctags -v files | sort -f > index
33 vgrind -x index
34
35 Normally ctags places the tag descriptions in a file called tags; this
36 may be overridden with the -f option.
37
38 Files whose names end in .c or .h are assumed to be C source files and
39 are searched for C routine and macro definitions. Files whose names
40 end in .y are assumed to be YACC source files. Files whose names end
41 in .l are assumed to be either lisp files if their first non-blank
42 character is `;', `(', or `[', or lex files otherwise. Other files are
43 first examined to see if they contain any Pascal or Fortran routine
44 definitions; if not, they are processed again looking for C defini‐
45 tions.
46
47 Other options are:
48
49 -F use forward searching patterns (/.../) (default).
50
51 -B use backward searching patterns (?...?).
52
53 -a append to tags file.
54
55 -t create tags for typedefs.
56
57 -w suppressing warning diagnostics.
58
59 -u causing the specified files to be updated in tags, that is, all
60 references to them are deleted, and the new values are appended to
61 the file. (Beware: this option is implemented in a way which is
62 rather slow; it is usually faster to simply rebuild the tags
63 file.)
64
65 The tag main is treated specially in C programs. The tag formed is
66 created by prepending M to the name of the file, with a trailing .c
67 removed, if any, and leading pathname components also removed. This
68 makes use of ctags practical in directories with more than one program.
69
71 tags output tags file
72
74 ex(1), vi(1)
75
77 Ken Arnold; FORTRAN added by Jim Kleckner; Bill Joy added Pascal and
78 -x, replacing cxref; C typedefs added by Ed Pelegri-Llopart.
79
81 Recognition of functions, subroutines and procedures for FORTRAN and
82 Pascal is done is a very simpleminded way. No attempt is made to deal
83 with block structure; if you have two Pascal procedures in different
84 blocks with the same name you lose.
85
86 The method of deciding whether to look for C or Pascal and FORTRAN
87 functions is a hack.
88
89 Does not know about #ifdefs.
90
91 Should know about Pascal types. Relies on the input being well formed
92 to detect typedefs. Use of -tx shows only the last line of typedefs.
93
94
95
96
974th Berkeley Distribution May 30, 1985 CTAGS(1)