CTAGS(1) COMMAND REFERENCE CTAGS(1)
NAME
ctags - create a tags file
SYNOPSIS
ctags [ -B ] [ -F ] [ -a ] [ -t ] [ -u ] [ -v ] [ -w ] [ -x
]
filename ...
DESCRIPTION
Ctags makes a tags file for ex(1) from the specified C,
Pascal, and FORTRAN sources. A tags file gives the
locations of specified objects (in this case functions and
typedefs) 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 specification for the object definition.
Functions are searched with a pattern, typedefs with a line
number. Specifiers are given in separate fields on the line,
separated by blanks or tabs. Using the tags file, the
editting system ex can quickly find these object
definitions.
Files whose name ends in .c or .h or have no suffix are
assumed to be C source files and are searched for C routine
and macro definitions. Others are first examined to see if
they contain any Pascal or FORTRAN routine definitions; if
not, they are processed again looking for C definitions.
The tag main is treated specially in C programs. The tag
formed is created by prepending M to the name of the file,
with a trailing .c removed, if any, and leading pathname
components also removed. This makes use of ctags practical
in directories with more than one program.
OPTIONS
-a Append to tags file.
-t Create tags for typedefs.
-u Causes the specified files to be updated in tags; that
is, all references to them are deleted, and the new
values are appended to the file. (Beware: this option
is implemented in a way which is rather slow; it is
usually faster to simply rebuild the tags file.)
-v An index of the form expected by vgrind (see CAVEATS) is
produced on the standard output. This listing contains
the function name, filename, and page number (assuming
64 line pages). Since the output will be sorted into
lexicographic order, it may be desired to run the output
through sort -f (see EXAMPLES).
-w Suppresses warning diagnostics.
Printed 10/17/86 1
CTAGS(1) COMMAND REFERENCE CTAGS(1)
-x Ctags produces a list of object names, the line number
and filename on which each is defined, as well as the
text of that line and prints this on the standard
output. This is a simple index which can be printed out
as an off-line readable function index.
-B Use backward searching patterns (?...?).
-F Use forward searching patterns (/.../) (default).
EXAMPLES
This example produces a tags file for a program made up of
the source files example.c and extras.c. The entries in the
tags file will have backward search for patterns:
ctags -B example.c extras.c
Executing the command vi -t main will edit the file
containing the routine main( ), and place the cursor at the
definition of that routine by searching backwards.
The following command set prints a sorted cross reference
listing for the files using vgrind (see CAVEATS):
ctags -v files | sort -f > index
vgrind -x index
FILES
tags Tags file for use with ex(1).
RETURN VALUE
[NO_ERRS] Command completed without error.
[USAGE] Incorrect command line syntax. Execution
terminated.
[NP_WARN] An error warranting a warning message
occurred. Execution continues.
[P_WARN] A system error occurred. Execution continues.
See intro(2) for more information on system
errors.
[P_ERR] A system error occurred. Execution
terminated. See intro(2) for more
information on system errors.
Printed 10/17/86 2
CTAGS(1) COMMAND REFERENCE CTAGS(1)
CAVEATS
Recognition of functions, subroutines, and procedures for
FORTRAN and Pascal is done in a very simple way. No attempt
is made to deal with block structure; if you have two Pascal
procedures in different blocks with the same name, only the
first is tagged.
The method of deciding whether to look for C or Pascal and
FORTRAN functions uses the prefix of the file, and may not
always decide on the correct language.
Does not process #ifdefs (used by the preprocessor).
Should know about Pascal types. Relies on the input being
well formed to detect typedefs. Use of -tx shows only the
last line of typedefs.
The -v option is supported for completeness. The utility
vgrind may not be available on your system.
SEE ALSO
cflow(1), cxref(1), ex(1), sort(1), vi(1).
Printed 10/17/86 3
%%index%%
na:72,70;
sy:142,290;
de:432,1451;
op:1883,973;3000,478;
ex:3478,761;
fi:4239,119;
rv:4358,680;
ca:5182,900;
se:6082,175;
%%index%%000000000155