[9] | 1 | .TH CTAGS 1
|
---|
| 2 | .SH NAME
|
---|
| 3 | ctags - Generates "tags" and (optionally) "refs" files
|
---|
| 4 | .SH SYNOPSIS
|
---|
| 5 | \fBctags\fP [\fB-stvra\fP] \fIfilesnames\fP...
|
---|
| 6 | .SH DESCRIPTION
|
---|
| 7 | \fIctags\fP generates the "tags" and "refs" files
|
---|
| 8 | from a group of C source files.
|
---|
| 9 | The "tags" file is used by Elvis' ":tag" command,
|
---|
| 10 | control-] command,
|
---|
| 11 | and -t option.
|
---|
| 12 | The "refs" file is sometimes used by the \fIref(1)\fP program.
|
---|
| 13 | .PP
|
---|
| 14 | Each C source file is scanned for #define statements and
|
---|
| 15 | global function definitions.
|
---|
| 16 | The name of the macro or function becomes the name of a tag.
|
---|
| 17 | For each tag, a line is added to the "tags" file which contains:
|
---|
| 18 | .RS
|
---|
| 19 | .nf
|
---|
| 20 | - the name of the tag
|
---|
| 21 | - a tab character
|
---|
| 22 | - the name of the file containing the tag
|
---|
| 23 | - a tab character
|
---|
| 24 | - a way to find the particular line within the file.
|
---|
| 25 | .RE
|
---|
| 26 | .fi
|
---|
| 27 | .PP
|
---|
| 28 | The filenames list will typically be the names of all C source
|
---|
| 29 | files in the current directory, like this:
|
---|
| 30 | .RS
|
---|
| 31 | .nf
|
---|
| 32 | $ ctags -stv *.[ch]
|
---|
| 33 | .RE
|
---|
| 34 | .fi
|
---|
| 35 | .SH OPTIONS
|
---|
| 36 | .IP \fB-t\fR
|
---|
| 37 | Include typedefs.
|
---|
| 38 | A tag will be generated for each user-defined type.
|
---|
| 39 | Also tags will be generated for struct and enum names.
|
---|
| 40 | Types are considered to be global if they are defined in a header file,
|
---|
| 41 | and static if they are defined in a C source file.
|
---|
| 42 | .IP \fB-v\fR
|
---|
| 43 | Include variable declarations.
|
---|
| 44 | A tag will be generated for each variable, except for those that are declared
|
---|
| 45 | inside the body of a function.
|
---|
| 46 | .IP \fB-s\fR
|
---|
| 47 | Include static tags.
|
---|
| 48 | \fICtags\fR will normally put global tags in the "tags" file, and silently ignore
|
---|
| 49 | the static tags.
|
---|
| 50 | This flag causes both global and static tags to be added.
|
---|
| 51 | The name of a static tag is generated by prefixing the name of the declared
|
---|
| 52 | item with the name of the file where it is defined, with a colon in between.
|
---|
| 53 | For example, "static foo(){}" in "bar.c" results in a tag named "bar.c:foo".
|
---|
| 54 | .IP \fB-r\fP
|
---|
| 55 | This causes \fIctags\fP to generate both "tags" and "refs".
|
---|
| 56 | Without \fB-r\fP, it would only generate "tags".
|
---|
| 57 | .IP \fB-a\fR
|
---|
| 58 | Append to "tags", and maybe "refs".
|
---|
| 59 | Normally, \fIctags\fR overwrites these files each time it is invoked.
|
---|
| 60 | This flag is useful when you have to many files in the current directory
|
---|
| 61 | for you to list them on a single command-line;
|
---|
| 62 | it allows you to split the arguments among several invocations.
|
---|
| 63 | .SH FILES
|
---|
| 64 | .IP tags
|
---|
| 65 | A cross-reference that lists each tag name, the name of the source file that
|
---|
| 66 | contains it, and a way to locate a particular line in the source file.
|
---|
| 67 | .IP refs
|
---|
| 68 | The "refs" file contains the definitions for each tag in the "tags" file,
|
---|
| 69 | and very little else.
|
---|
| 70 | This file can be useful, for example, when licensing restrictions prevent
|
---|
| 71 | you from making the source code to the standard C library readable by everybody,
|
---|
| 72 | but you still everybody to know what arguments the library functions need.
|
---|
| 73 | .SH BUGS
|
---|
| 74 | .PP
|
---|
| 75 | \fIctags\fR is sensitive to indenting and line breaks.
|
---|
| 76 | Consequently, it might not discover all of the tags in a file that
|
---|
| 77 | is formatted in an unusual way.
|
---|
| 78 | .SH "SEE ALSO"
|
---|
| 79 | elvis(1), refs(1)
|
---|
| 80 | .SH AUTHOR
|
---|
| 81 | .nf
|
---|
| 82 | Steve Kirkendall
|
---|
| 83 | kirkenda@cs.pdx.edu
|
---|
| 84 | .fi
|
---|