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