manual page distributed with 4.1BSD
[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.\"
5.\" @(#)ctags.1 4.1 (Berkeley) %G%
6.\"
7.TH CTAGS 1 4/1/81
8.UC 4
9.SH NAME
10ctags \- create a tags file
11.SH SYNOPSIS
12.B ctags
13[
14.B \-u
15] [
16.B \-v
17] [
18.B \-w
19] [
20.B \-x
21]
22name ...
23.SH DESCRIPTION
24.I Ctags
25makes a tags file for
26.IR ex (1)
27from the specified C, Pascal and Fortran sources.
28A tags file gives the locations of specified objects (in this case
29functions) in a group of files.
30Each line of the tags file contains the function name,
31the file in which it is defined, and a scanning pattern used to find
32the function definition. These are given in separate fields on the line,
33separated by blanks or tabs.
34Using the
35.I tags
36file,
37.I ex
38can quickly find these function definitions.
39.PP
40If the
41.B \-x
42flag is given,
43.I ctags
44produces a list of function names, the line number and file
45name on which each is defined, as well as the text of that line
46and prints this on the standard output. This is a simple index
47which can be printed out as an off-line readable function index.
48.PP
49If the
50.B \-v
51flag is given,
52an index of the form expected by
53.IR vgrind (1)
54is produced on the standard output.
55This listing contains the function name,
56file name, and page number
57(assuming 64 line pages).
58Since the output will be sorted into lexicographic order,
59it may be desired to run the output through
60.BR "sort \-f" .
61Sample use:
62.nf
63 ctags \-v files | sort \-f > index
64 vgrind \-x index
65.fi
66.PP
67Files whose name ends in
68.B \.c
69or
70.B \.h
71are assumed to be C source files and are searched for C routine and
72macro definitions.
73Others are first examined to see if they contain any Pascal or
74Fortran routine definitions; if not, they are processed again
75looking for C definitions.
76.PP
77Other options are:
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.
113.SH BUGS
114Recognition of \fBfunctions\fR, \fBsubroutines\fR and \fBprocedures\fR
115for FORTRAN and Pascal is done is a very simpleminded way.
116No attempt is made to deal with block structure; if you have two
117Pascal procedures in different blocks with the same name you lose.
118.PP
119The method of deciding whether to look for C or Pascal and FORTRAN
120functions is a hack.