Wait 11 minutes before deciding a machine is down (same as ruptime).
[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.\"
1d61bde9 5.\" @(#)ctags.1 6.1 (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
cab8f024
KM
15]
16name ...
17.SH DESCRIPTION
18.I Ctags
19makes a tags file for
20.IR ex (1)
1d61bde9 21from the specified C, Pascal, Fortran, YACC, lex, and lisp sources.
cab8f024 22A tags file gives the locations of specified objects (in this case
5d15751e
KM
23functions and typedefs) in a group of files. Each line of the tags
24file contains the object name, the file in which it is defined, and
25an address specification for the object definition. Functions are
26searched with a pattern, typedefs with a line number. Specifiers are
27given in separate fields on the line, separated by blanks or tabs.
cab8f024
KM
28Using the
29.I tags
30file,
31.I ex
5d15751e 32can quickly find these objects definitions.
cab8f024
KM
33.PP
34If the
35.B \-x
36flag is given,
37.I ctags
5d15751e 38produces a list of object names, the line number and file
cab8f024
KM
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
1d61bde9 61Files whose names end in
cab8f024
KM
62.B \.c
63or
64.B \.h
65are assumed to be C source files and are searched for C routine and
66macro definitions.
1d61bde9
KM
67Files whose names end in
68.B \.y
69are assumed to be YACC source files.
70Files whose names end in
71.B \.l
72are assumed to be either lisp files
73if their first non-blank character is `;', `(', or `[',
74or lex files otherwise.
75Other files are first examined to see if they contain any Pascal or
cab8f024
KM
76Fortran routine definitions; if not, they are processed again
77looking for C definitions.
78.PP
79Other options are:
80.TP 5
5d15751e
KM
81.B \-F
82use forward searching patterns (/.../) (default).
83.TP 5
84.B \-B
85use backward searching patterns (?...?).
86.TP 5
87.B \-a
88append to tags file.
89.TP 5
90.B \-t
91create tags for typedefs.
92.TP 5
cab8f024
KM
93.B \-w
94suppressing warning diagnostics.
95.TP 5
96.B \-u
97causing the specified files to be
98.I updated
99in tags, that is, all references to them are deleted,
100and the new values are appended to the file.
101(Beware: this option is implemented in a way which is rather slow;
102it is usually faster to simply rebuild the
103.I tags
104file.)
105.PP
106The tag
107.I main
108is treated specially in C programs.
109The tag formed is created by prepending
110.I M
111to the name of the file, with a trailing .c removed, if
112any, and leading pathname components also removed.
113This makes use of
114.I ctags
115practical in directories with more than one program.
116.SH FILES
117.DT
118tags output tags file
119.SH SEE ALSO
120ex(1), vi(1)
121.SH AUTHOR
122Ken Arnold; FORTRAN added by Jim Kleckner; Bill Joy
123added Pascal and
124.B \-x,
125replacing
5d15751e
KM
126.I cxref;
127C typedefs added by Ed Pelegri-Llopart.
cab8f024
KM
128.SH BUGS
129Recognition of \fBfunctions\fR, \fBsubroutines\fR and \fBprocedures\fR
130for FORTRAN and Pascal is done is a very simpleminded way.
131No attempt is made to deal with block structure; if you have two
132Pascal procedures in different blocks with the same name you lose.
133.PP
134The method of deciding whether to look for C or Pascal and FORTRAN
135functions is a hack.
5d15751e
KM
136.PP
137Does not know about #ifdefs.
138.PP
139Should know about Pascal types.
140Relies on the input being well formed to detect typedefs.
141Use of -tx shows only the last line of typedefs.
1d61bde9 142