@(#)vctags.1 8.2 20/10/31 Copyright 2020 J. Schilling
Copyright (c) 1987 The Regents of the University of California.
All rights reserved.
Redistribution and use in source and binary forms are permitted
provided that the above copyright notice and this paragraph are
duplicated in all such forms and that any documentation,
advertising materials, and other materials related to such
distribution and use acknowledge that the software was developed
by the University of California, Berkeley. The name of the
University may not be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@(#)vctags.1 8.2 (Berkeley) 10/31/20
Yacc and lex files each have a special tag. Yyparse is the start of the second section of the yacc file, and yylex is the start of the second section of the lex file.
If the -x flag is given, ctags produces a list of object names, the line number and file name 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.
If the -v flag is given, an index of the form expected by vgrind(1) is produced on the standard output. This listing contains the object name, file name, 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. Sample use:
ctags -v files | sort -f > index vgrind -x index
Normally ctags places the tag descriptions in a file called tags; this may be overridden with the -f option.
Files whose names end in .c or .h are assumed to be C source files and are searched for C style routine and macro definitions. Files whose names end in .y are assumed to be YACC source files. Files whose names end in .l are assumed to be lisp files if their first non-blank character is `;', `(', or `[', otherwise, they are treated as lex files. Other files are first examined to see if they contain any Pascal or Fortran routine definitions, and, if not, are searched for C style definitions.
Other options are:
5 -F use forward searching patterns (/.../) (the default).
5 -B use backward searching patterns (?...?).
5 -a append to tags file.
5 -d create tags for #defines that don't take arguments; #defines that take arguments are tagged automatically. ..
5 -t create tags for typedefs, structs, unions, and enums.
5 -w suppress warning diagnostics.
5 -u update the specified files in the tags file, 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.)
The tag main is treated specially in C programs. The tag formed is created by prepending M to the name of the file, with the trailing .c and any leading pathname components removed. This makes use of ctags practical in directories with more than one program.
The method of deciding whether to look for C, Pascal or FORTRAN functions is a hack.
Ctags relies on the input being well formed, and any syntactical errors will completely confuse it. It also finds some legal syntax confusing; for example, as it doesn't understand #ifdef's, (incidentally, that's a feature, not a bug) any code with unbalanced braces inside #ifdef's will cause it to become somewhat disoriented. In a similar fashion, multiple line changes within a definition will cause it to enter the last line of the object, rather than the first, as the searching pattern. The last line of multiple line typedef's will similarly be noted.