NAME
ctags - Makes a file of tags to help locate objects in
source files
SYNOPSIS
ctags [-aBdFtuvw] [-x | -f tags_file] file ...
The ctags command makes a tags file for ex and vi editors
from the specified C, Pascal, FORTRAN, yacc, lex, and LISP
source files. A tags file gives the locations of specified
objects (in this case functions and type definitions) in a
group of files.
FLAGS
-a Appends to the tags file.
-f tags_file
Creates a tags file with the name specified by
tags_file.
-B Uses backward searching pattern (?...?).
-d Creates tags for #define directives that do not take
arguments. #define directives that take arguments are
tagged automatically.
-F Uses forward searching pattern (/.../) (default).
-t Creates tags for type definitions (typedef), and for
struct, union, and enum declarations.
-u Updates the specified files in tags; that is, all refer-
ences to them are deleted, and the new values are
appended to the file. This flag may be slow. (It is
usually faster to simply rebuild the tags file.)
-v Produces an index of the form expected by vgrind on the
standard output. This listing contains the function
name, filename, and page number (assuming 64-line
pages). Because the output will be sorted according to
the current collating sequence as defined by the value
of the LC_COLLATE environment variable, it may be desir-
able to run the output through sort -f. Sample use:
ctags -v files | sort -f > index
vgrind -x index
-w Suppresses warning diagnostics.
-x Causes ctags to display a list of object names, the line
number and filename on which each is defined, as well as
the text of that line. This provides a simple index,
which can be printed out as an offline readable function
index. If you specify this flag, ctags does not build a
tags file, but writes to standard output.
DESCRIPTION
Each line of the tags file contains the object name, the
file in which it is defined, and an address specification
for the object definition. Functions are searched with a
pattern and type definitions with a line number. 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.
If a filename ends in .c or .h, it is assumed to be a C
source file and is searched for C routine and macro defini-
tions. Files whose names end in .y are assumed to be yacc
source files. Files whose names end in .l are assumed to be
either LISP files (if their first nonspace character is ;
(semicolon), ( (open parenthesis), or [ (open bracket)) or
lex files otherwise. Others are first examined to see if
they contain any Pascal or FORTRAN routine definitions; if
not, they are processed again for C definitions.
The tag main is treated specially in C programs. The tag
formed is created by prefixing M to the filename, removing a
trailing .c (if any), and removing the leading pathname com-
ponents. This makes use of ctags practical in directories
with more than one program.
Restrictions
Recognition of functions, subroutines, and procedures for
FORTRAN and Pascal does not deal with block structure.
Therefore, you cannot have two Pascal procedures in dif-
ferent blocks with the same name.
The ctags command does not know about ifdefs.
FILES
tags Default tags file. Use the -f flag to specify
another filename.
RELATED INFORMATION
Commands: ex(1), lex(1), vi(1)/vedit(1)/view(1), yacc(1).
Acknowledgement and Disclaimer