Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ctags(1) — HP-UX 5.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ex(1)

vi(1)

CTAGS(1)

NAME

ctags − create a tags file

SYNOPSIS

ctags [ −BFatuwvx ] files ... 

HP-UX COMPATIBILITY

Level: HP-UX/STANDARD

Origin: UCB

Remarks: Not supported on the Integral Personal Computer. 

DESCRIPTION

Ctags makes a tags file for ex(1) (or vi(1)) from the specified C, Pascal and Fortran source files. A tags file gives the locations of specified objects (for C, functions, macros with argments, and typedefs; Pascal, procedures, programs and functions; FORTRAN, subroutines, progams and functions) 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. 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 blanks or tabs.  Using the tags file, ex can quickly find these object’s definitions. 

−x causes ctags 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. 

−v A page index is produced 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)). 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
pr index files

Files whose name ends in .c or .h 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. 

Other options are:

−F use forward searching patterns (/.../) (default). 

−B use backward searching patterns (?...?). 

−a 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 circumstances. 

−t create tags for typedefs. 

−w suppressing warning diagnostics. 

−u causing the specified files to be updated in tags, that is, all references to those files are deleted, and the new values are added to the file as in -a 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 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. 

DIAGNOSTICS

Too many entries to sort. 

An attempt to get additional heap space failed; the sort could not be performed. 

Duplicate entry in file file, line line: name.
Second entry ignored.

The same name was detected twice in the same file.  A tags entry was made only for the first name found. 

Duplicate entry in files file1 and file2: name (Warning only). 

The same name was detected in two different files.  A tags entry was made only for the first name found. 

FILES

tagsoutput tags file
OTAGStemporary used by -u

SEE ALSO

ex(1), vi(1). 

BUGS

Recognition of functions, subroutines and procedures for FORTRAN and Pascal is done is a very simpleminded way.  No attempt is made to deal with block structure; if there are two Pascal procedures in different blocks with the same name a warning message will be 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.
It does not know about #ifdefs and Pascal types. 
It relies on the input being well formed to detect typedefs.
Use of -tx shows only the last line of typedefs.
Ex(1) 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 -u or -a options or by editing a tags file. 
If more than one (function) definition appears on a single line, only the first definition will be indexed.

Hewlett-Packard  —  last mod. May 11, 2021

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