*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> ctags (1)              


 ctags(1)                                                           ctags(1)

 NAME    [Toc]    [Back]
      ctags - create a tags file

 SYNOPSIS    [Toc]    [Back]
      ctags [-xvFBatwu] files ...

 DESCRIPTION    [Toc]    [Back]
      ctags makes a tags file for ex(1) (or vi(1)) from the specified C,
      Pascal and FORTRAN sources.  A tags file gives the locations of
      specified objects (for C, functions, macros with argments, and
      typedefs; Pascal, procedures, programs and functions; FORTRAN,
      subroutines, programs 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.
      Output is sorted in ascending collation order (see Environment
      Variables below).  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 spaces or tabs.  Using the
      tags file, ex can quickly find these objects' definitions.

           -x      Cause 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      Produce a page index on the standard output.  This
                   listing contains the function name, file name, and page
                   number within that file (assuming 56-line pages to match

      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

      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.

 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003

 ctags(1)                                                           ctags(1)

           -t      Create tags for typedefs.

           -w      Suppress warning diagnostics.

           -u      Update the specified files 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 adding M to the beginning of name of the file, with any
      trailing .c removed, and leading pathname components also removed.
      This makes use of ctags practical in directories with more than one

    Environment Variables
      LC_COLLATE determines the order in which the output is sorted.

      LC_CTYPE determines the interpretation of the single- and/or multibyte
 characters within comments and string literals.

      If LC_COLLATE or LC_CTYPE is not specified in the environment or is
      set to the empty string, the value of LANG is used as a default for
      each unspecified or empty variable.  If LANG is not specified or is
      set to the empty string, a default of ``C'' (see lang(5)) is used
      instead of LANG.  If any internationalization variable contains an
      invalid setting, ctags behaves as if all internationalization
      variables are set to ``C''.  See environ(5).

    International Code Set Support    [Toc]    [Back]
      Single- and multi-byte character code sets are supported with the
      exception that multi-byte character file names are not supported.

 DIAGNOSTICS    [Toc]    [Back]
      Too many entries to sort.
           An attempt to get additional heap space failed; the sort could
           not be performed.

      Unexpected end of function in file file, line line.
           The tags file may be incorrect.

           A } character was found unexpectedly in the first column.  This
           can lead to incorrect entries in the tags file.

      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.

 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003

 ctags(1)                                                           ctags(1)

      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.

 EXAMPLES    [Toc]    [Back]
      Create a tags file named tags in the current directory for all C
      source (*.c) files and all header (*.h) files in the current

           ctags *.[ch]

      Once the tags file exists in the current directory, it can be used
      with commands that support tag files (such as vi (see vi(1)).

      Use the tags file with vi to edit a particular function myfunc()
      located in one of the source files:

           vi -t myfunc

      While editing a C source file using vi, use the ex-mode tag command to
      edit function myfunc():

           :tag myfunc

      Use vi to find main() in file myprog.c:

           vi -t Mmyprog

      While using vi, find main() in file myprog.c (does not have to be the
      file currently being edited):

           :tag Mmyprog

 WARNINGS    [Toc]    [Back]
      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 there are two Pascal procedures in different
      blocks with the same name, a warning message is 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.

      ctags 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 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

 Hewlett-Packard Company            - 3 -   HP-UX 11i Version 2: August 2003

 ctags(1)                                                           ctags(1)

      editing a tags file.

      If more than one (function) definition appears on a single line, only
      the first definition is indexed.

 AUTHOR    [Toc]    [Back]
      ctags was developed by the University of California, Berkeley.

 FILES    [Toc]    [Back]
      tags           output tags file
      OTAGS          temporary file used by -u

 SEE ALSO    [Toc]    [Back]
      ex(1), vi(1).

      ctags: XPG4

 Hewlett-Packard Company            - 4 -   HP-UX 11i Version 2: August 2003
[ Back ]
 Similar pages
Name OS Title
ctags Tru64 Makes a tags file for source file objects.
etags Tru64 Generates a tags file for the emacs or mule editor
XmRenderTableGetTags HP-UX A convenience function that gets rendition tags
XmRenderTableGetRenditions HP-UX A convenience function that matches rendition tags
link Tru64 Create a hard link to an existing file on the local file system
mvOptimize IRIX optimize a movie file for playback after editing operations, or create a flattened movie file
creat OpenBSD create a new file
mkfile IRIX create a file
VOP_LINK FreeBSD create a new name for a file
creat NetBSD create a new file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service