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