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