Makes a file of tags to help locate objects in source files.
ctags [ -u | -x ] [ -B | -F ] [ -a ] [ -m ] [ -o ] [ -t ] [ -v ] [ -w ] [ -f TagsFile ] File. ..
The ctags command creates a tags file for use with the ex and vi editors from the specified C, Pascal, FORTRAN, yacc, lex, and LISP source files. The tags file consists of locators of programming language specific objects (such as functions and type definitions) within the source files. A locator consists of the object name, the file in which it is defined, and either a basic regular expression or a line number that can be used in searching for the object definition. Specifiers are given in separate fields on the line, separated by spaces or tabs. Using the tags file, ex and vi can quickly find these object definitions.
The following file name suffixes
are supported by the ctags command:
File names ending with any other suffixes are first examined to see if they contain any Pascal or FORTRAN routine definitions. If not, they are processed again as C-language source code. Files without a . (dot) suffix are processed as C-language source code.
The main tag is treated specially in C programs. The tag formed is created by prefixing M to the file name, removing a trailing .c (if any), and removing the leading path name components. This makes use of ctags practical in directories with more than one program.
Notes:
- Recognition of the keywords function, an address specification for the subroutine, and procedure in FORTRAN and Pascal code ignores block structure. The ctags command may yield inadequate results if any two Pascal procedures have the same name, even though they are in different blocks.
- The ctags command does not recognize #if and #ifdef statements.
- If both the -B and -F options are specified, the last one specified will take precedence.
- The -x option takes precedence over any options (-a, -u, or -f) that would otherwise create a tags file.
- When the -v option is specified, the -x option is implied.
- The output of the ctags command is always sorted by object identifier.
ctags -x x.c y.c z.c
ctags -f foo_tags *
ctags -utf foo_tags zip.c
The following exit values are
returned:
0 | Successful completion. |
>0 | An error occurred. |
tags | Output tags file. |
The ex command, lex command, vgrind command, vi command, yacc command.