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