BSD 4_2 development
[unix-history] / usr / man / man1 / ctags.1
CommitLineData
08adbbab
C
1.TH CTAGS 1 "25 August 1982"
2.UC 4
3.SH NAME
4ctags \- create a tags file
5.SH SYNOPSIS
6.B ctags
7[
8.B \-BFatuwvx
9]
10name ...
11.SH DESCRIPTION
12.I Ctags
13makes a tags file for
14.IR ex (1)
15from the specified C, Pascal and Fortran sources.
16A tags file gives the locations of specified objects (in this case
17functions and typedefs) in a group of files. Each line of the tags
18file contains the object name, the file in which it is defined, and
19an address specification for the object definition. Functions are
20searched with a pattern, typedefs with a line number. Specifiers are
21given in separate fields on the line, separated by blanks or tabs.
22Using the
23.I tags
24file,
25.I ex
26can quickly find these objects definitions.
27.PP
28If the
29.B \-x
30flag is given,
31.I ctags
32produces a list of object names, the line number and file
33name on which each is defined, as well as the text of that line
34and prints this on the standard output. This is a simple index
35which can be printed out as an off-line readable function index.
36.PP
37If the
38.B \-v
39flag is given,
40an index of the form expected by
41.IR vgrind (1)
42is produced on the standard output.
43This listing contains the function name,
44file name, and page number
45(assuming 64 line pages).
46Since the output will be sorted into lexicographic order,
47it may be desired to run the output through
48.BR "sort \-f" .
49Sample use:
50.nf
51 ctags \-v files | sort \-f > index
52 vgrind \-x index
53.fi
54.PP
55Files whose name ends in
56.B \.c
57or
58.B \.h
59are assumed to be C source files and are searched for C routine and
60macro definitions.
61Others are first examined to see if they contain any Pascal or
62Fortran routine definitions; if not, they are processed again
63looking for C definitions.
64.PP
65Other options are:
66.TP 5
67.B \-F
68use forward searching patterns (/.../) (default).
69.TP 5
70.B \-B
71use backward searching patterns (?...?).
72.TP 5
73.B \-a
74append to tags file.
75.TP 5
76.B \-t
77create tags for typedefs.
78.TP 5
79.B \-w
80suppressing warning diagnostics.
81.TP 5
82.B \-u
83causing the specified files to be
84.I updated
85in tags, that is, all references to them are deleted,
86and the new values are appended to the file.
87(Beware: this option is implemented in a way which is rather slow;
88it is usually faster to simply rebuild the
89.I tags
90file.)
91.PP
92The tag
93.I main
94is treated specially in C programs.
95The tag formed is created by prepending
96.I M
97to the name of the file, with a trailing .c removed, if
98any, and leading pathname components also removed.
99This makes use of
100.I ctags
101practical in directories with more than one program.
102.SH FILES
103.DT
104tags output tags file
105.SH SEE ALSO
106ex(1), vi(1)
107.SH AUTHOR
108Ken Arnold; FORTRAN added by Jim Kleckner; Bill Joy
109added Pascal and
110.B \-x,
111replacing
112.I cxref;
113C typedefs added by Ed Pelegri-Llopart.
114.SH BUGS
115Recognition of \fBfunctions\fR, \fBsubroutines\fR and \fBprocedures\fR
116for FORTRAN and Pascal is done is a very simpleminded way.
117No attempt is made to deal with block structure; if you have two
118Pascal procedures in different blocks with the same name you lose.
119.PP
120The method of deciding whether to look for C or Pascal and FORTRAN
121functions is a hack.
122.PP
123Does not know about #ifdefs.
124.PP
125Should know about Pascal types.
126Relies on the input being well formed to detect typedefs.
127Use of -tx shows only the last line of typedefs.