ctags(1)ctags(1)NAMEctags - create a tags file
SYNOPSIS
files ...
DESCRIPTION
makes a tags file for ex(1) (or vi(1)) from the specified C, Pascal and
FORTRAN sources. A tags file gives the locations of specified objects
(for C, functions, macros with argments, and typedefs; Pascal, proce‐
dures, programs and functions; FORTRAN, subroutines, programs and func‐
tions) in a group of files. Each line of the tags file contains the
object name, the file in which it is defined, and an address specifica‐
tion for the object definition. Output is sorted in ascending colla‐
tion order (see Environment Variables below). All objects except C
typedefs are searched with a pattern, typedefs with a line number.
Specifiers are given in separate fields on the line, separated by spa‐
ces or tabs. Using the tags file, can quickly find these objects' def‐
initions.
Cause to print a simple function index. This is done by
assembling a list of function names, file names on which
each function is defined, the line numbers where each
function name occurs, and the text of each line. The
list is then printed on the standard output. No tags
file is created or changed.
Produce a page index on the standard output.
This listing contains the function name, file name, and
page number within that file (assuming 56-line pages to
match pr(1)).
Files whose name ends in or are assumed to be C source files and are
searched for C routine and macro definitions. Others are first exam‐
ined to see if they contain any Pascal or FORTRAN routine definitions;
if not, they are processed again looking for C definitions.
Other options are:
Use forward searching patterns
(default).
Use backward searching patterns
Add the information from the files to the
tags file. Unlike re-building the tags file from the
original files, this can cause the same symbol to be
entered twice in the tags file. This option should be
used with caution and then only in very special circum‐
stances.
Create tags for typedefs.
Suppress warning diagnostics.
Update the specified files in
tags; that is, all references to those files are
deleted, and the new values are added to the file as in
above. (Beware: this option is implemented in a way
which is rather slow; it is usually faster to simply
rebuild the tags file.)
The tag is treated specially in C programs. The tag formed is created
by adding to the beginning of name of the file, with any trailing
removed, and leading pathname components also removed. This makes use
of practical in directories with more than one program.
EXTERNAL INFLUENCES
Environment Variables
determines the order in which the output is sorted.
determines the interpretation of the single- and/or multi-byte charac‐
ters within comments and string literals.
If or is not specified in the environment or is set to the empty
string, the value of is used as a default for each unspecified or empty
variable. If is not specified or is set to the empty string, a default
of ``C'' (see lang(5)) is used instead of If any internationalization
variable contains an invalid setting, behaves as if all international‐
ization variables are set to ``C''. See environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported with the
exception that multi-byte character file names are not supported.
DIAGNOSTICS
An attempt to get additional heap space failed;
the sort could not be performed.
The tags file may be incorrect.
A character was found unexpectedly in the first column. This
can lead to incorrect entries in the tags file.
The same name was detected twice in the same file.
A tags entry was made only for the first name found.
The same name was detected in two different files.
A tags entry was made only for the first name found.
EXAMPLES
Create a tags file named in the current directory for all C source
files and all header files in the current directory:
Once the tags file exists in the current directory, it can be used with
commands that support tag files (such as (see vi(1)).
Use the tags file with to edit a particular function located in one of
the source files:
While editing a C source file using use the tag command to edit func‐
tion
Use to find in file
While using find in file (does not have to be the file currently being
edited):
WARNINGS
Recognition of and for FORTRAN and Pascal is done in a very simple way.
No attempt is made to deal with block structure; if there are two Pas‐
cal procedures in different blocks with the same name, a warning mes‐
sage is generated.
The method of deciding whether to look for C or Pascal and FORTRAN
functions is an approximation, and can be fooled by unusual programs.
does not know about and Pascal types.
It relies on the input being well formed to detect typedefs.
Use of shows only the last line of typedefs.
is naive about tags files with several identical tags; it simply
chooses the first entry its (non-linear) search finds with that tag.
Such files can be created with either the or options or by editing a
tags file.
If more than one (function) definition appears on a single line, only
the first definition is indexed.
AUTHOR
was developed by the University of California, Berkeley.
FILES
output tags file
temporary file used by
SEE ALSOex(1), vi(1).
STANDARDS CONFORMANCEctags(1)