1 .\" Copyright (c) 1987, 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)ctags.1 8.1 (Berkeley) 6/6/93
40 .Nd create a tags file
53 lex, and lisp sources.
54 A tags file gives the locations of specified objects in a group of files.
55 Each line of the tags file contains the object name, the file in which it
56 is defined, and a search pattern for the object definition, separated by
62 can quickly locate these object definitions.
63 Depending upon the options provided to
65 objects will consist of subroutines, typedefs, defines, structs,
69 use backward searching patterns
72 use forward searching patterns
82 that don't take arguments;
84 that take arguments are tagged automatically.
86 Places the tag descriptions in a file called
88 The default behaviour is to place them in a file called
91 create tags for typedefs, structs, unions, and enums.
93 update the specified files in the
96 references to them are deleted, and the new values are appended to the
97 file. (Beware: this option is implemented in a way which is rather
98 slow; it is usually faster to simply rebuild the
102 An index of the form expected by
104 is produced on the standard output. This listing
105 contains the object name, file name, and page number (assuming 64
106 line pages). Since the output will be sorted into lexicographic order,
107 it may be desired to run the output through
110 .Bd -literal -offset indent
111 ctags \-v files \&| sort \-f > index
115 suppress warning diagnostics.
118 produces a list of object
119 names, the line number and file name on which each is defined, as well
120 as the text of that line and prints this on the standard output. This
121 is a simple index which can be printed out as an off-line readable
125 Files whose names end in
130 source files and are searched for C style routine and macro definitions.
131 Files whose names end in
136 Files whose names end in
138 are assumed to be lisp files if their
139 first non-blank character is `;', `(', or `[',
141 treated as lex files. Other files are first examined to see if they
142 contain any Pascal or Fortran routine definitions, and, if not, are
143 searched for C style definitions.
147 is treated specially in C programs. The tag formed
148 is created by prepending
150 to the name of the file, with the
153 and any leading pathname components removed. This
156 practical in directories with more than one
159 Yacc and lex files each have a special tag.
162 of the second section of the yacc file, and
165 the second section of the lex file.
167 .Bl -tag -width tags -compact
169 default output tags file
173 exits with a value of 1 if an error occurred, 0 otherwise.
174 Duplicate objects are not considered errors.
186 and Pascal is done is a very simpleminded way. No attempt
187 is made to deal with block structure; if you have two Pascal procedures
188 in different blocks with the same name you lose.
191 understand about Pascal types.
193 The method of deciding whether to look for C, Pascal or
198 relies on the input being well formed, and any syntactical
199 errors will completely confuse it. It also finds some legal syntax
200 confusing; for example, since it doesn't understand
202 (incidentally, that's a feature, not a bug), any code with unbalanced
205 will cause it to become somewhat disoriented.
206 In a similar fashion, multiple line changes within a definition will
207 cause it to enter the last line of the object, rather than the first, as
208 the searching pattern. The last line of multiple line
210 will similarly be noted.