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