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