Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ctags(1) — OSF/1 3.0 αXP

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ex(1)

lex(1)

sort(1)

vi(1)

/vedit(1)

/view(1)

yacc(1)

ctags(1)  —  Commands

NAME

ctags − Makes a tags file for source file objects. 

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

−aAdds item(s) to the tags file.  This option can be very slow for large tags files. 

−f tags_file
Creates a tags file with the name specified by tags_file. 

−BUses backward searching pattern (?...?). 

−dCreates tags for #define directives that do not take arguments.  #define directives that take arguments are tagged automatically. 

−FUses forward searching pattern (/.../) (default). 

−tCreates tags for type definitions (typedef), and for struct, union, and enum declarations. 

−uUpdates the specified files in tags; that is, all references to them are deleted, and the new values are added to the file. The tags file is sorted. This flag may be slow, so it is usually faster to simply rebuild the tags file. 

−vProduces 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 desirable to run the output through sort -f.  Sample use:

ctags -v files | sort -f > index
vgrind -x index

−wSuppresses warning diagnostics. 

−xCauses 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 definitions.  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 components.  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 different blocks with the same name. 

The ctags command does not know about ifdefs. 

FILES

tagsDefault tags file.  Use the -f flag to specify another filename. 

RELATED INFORMATION

Commands:  ex(1), lex(1), sort(1) vi(1)/vedit(1)/view(1), yacc(1). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026