ctagsproduce tags file for ex, more and vi |
Command |
ctags
[-aBFwx
]
[-f
tagfile]
sourcefile...
ctags
generates a file named tags
in the current directory which summarizes the locations of various objects in
the C or FORTRAN sourcefiles named on the command line. All files with a
.c
or .h
suffix are treated as C source files, while
files with a .f
suffix are treated as FORTRAN source files. For C
source code, ctags
summarizes function, macro and
typedef
definitions. For FORTRAN source code, it summarizes
function and subroutine definitions. See tags for a description of the format of
the tags
file.
You can access the tags
file with the -t
name option in ex
,
more
, and
vi
, the command
in:tag \fIname\fP
ex
and
vi
, and the command
in:t\fIname\fP
more
. The idea is that you tell
the utility which function you want to look at and it checks the
tags
file to determine which source file contains the function.
ctags
makes special provision for the function
main()
which may occur in several C source files. The
tags
file contains an entry for the first main()
routine found. For all occurrences of main()
(including the first),
the tags
file also contains an entry for M
name,
where name is the name of the input sourcefile, with the
.c
suffix and any leading path name components removed. For example,
a tags
file created for a C source code file named
file.c
would contain an entry for Mfile
which
represents the main()
routine in file.c
.
ctags
uses sort
to sort the file by tag name, according to the POSIX locale's collation sequence.
-a
appends output to the existing tags
file rather than
overwriting the file.
-B
produces a tags
file that searches backward from the
current position to find the pattern matching the tag.
-F
searches for tag patterns in the forward direction (default).
-f
tagfilegenerates a file named tagfile rather than the default
tags
.
-w
suppresses warning messages.
-x
produces a human-readable report on the standard output. The report
gives the definition name, the line number of where it appears in the file,
the name of the file in which it appears and the text of that line.
ctags
arranges this output in columns and sorts it in
order by tag name according to the current locale's collation sequence.
This option does not produce a tags
file.
tags
output tags file
0
Successful completion.
1
Failure due to any of the following:
-B
, -F
and -w
options are extensions to the POSIX and XPG standards.
ctags
does not know which C preprocessor symbols are
defined, there may be some misplaced function definition information if
sections of code within #if...#endif
are not complete blocks.
ctags
invokes the
sort
command internally.
tags