[BACK]Return to ctags.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / ctags

Annotation of src/usr.bin/ctags/ctags.1, Revision 1.14

1.14    ! jmc         1: .\"    $OpenBSD: ctags.1,v 1.13 2003/06/10 09:12:10 jmc Exp $
1.1       deraadt     2: .\"    $NetBSD: ctags.1,v 1.4 1995/03/26 20:14:04 glass Exp $
                      3: .\"
                      4: .\" Copyright (c) 1987, 1990, 1993
                      5: .\"    The Regents of the University of California.  All rights reserved.
                      6: .\"
                      7: .\" Redistribution and use in source and binary forms, with or without
                      8: .\" modification, are permitted provided that the following conditions
                      9: .\" are met:
                     10: .\" 1. Redistributions of source code must retain the above copyright
                     11: .\"    notice, this list of conditions and the following disclaimer.
                     12: .\" 2. Redistributions in binary form must reproduce the above copyright
                     13: .\"    notice, this list of conditions and the following disclaimer in the
                     14: .\"    documentation and/or other materials provided with the distribution.
1.12      millert    15: .\" 3. Neither the name of the University nor the names of its contributors
1.1       deraadt    16: .\"    may be used to endorse or promote products derived from this software
                     17: .\"    without specific prior written permission.
                     18: .\"
                     19: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     20: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     21: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     22: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     23: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     24: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     25: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     26: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     27: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     28: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     29: .\" SUCH DAMAGE.
                     30: .\"
                     31: .\"     @(#)ctags.1    8.1 (Berkeley) 6/6/93
                     32: .\"
                     33: .Dd June 6, 1993
                     34: .Dt CTAGS 1
1.5       aaron      35: .Os
1.1       deraadt    36: .Sh NAME
                     37: .Nm ctags
                     38: .Nd create a tags file
                     39: .Sh SYNOPSIS
                     40: .Nm ctags
1.14    ! jmc        41: .Op Fl aBdFtuvwx
1.1       deraadt    42: .Op Fl f Ar tagsfile
1.14    ! jmc        43: .Ar
1.1       deraadt    44: .Sh DESCRIPTION
1.6       aaron      45: .Nm
1.1       deraadt    46: makes a tags file for
                     47: .Xr ex 1
                     48: from the specified C,
                     49: Pascal, Fortran,
                     50: .Tn YACC ,
                     51: lex, and lisp sources.
                     52: A tags file gives the locations of specified objects in a group of files.
                     53: Each line of the tags file contains the object name, the file in which it
                     54: is defined, and a search pattern for the object definition, separated by
1.8       aaron      55: whitespace.
1.9       aaron      56: .Pp
1.1       deraadt    57: Using the
                     58: .Ar tags
                     59: file,
                     60: .Xr ex 1
                     61: can quickly locate these object definitions.
                     62: Depending upon the options provided to
                     63: .Nm ctags ,
                     64: objects will consist of subroutines, typedefs, defines, structs,
1.3       aaron      65: enums, and unions.
1.9       aaron      66: .Pp
                     67: The options are as follows:
1.1       deraadt    68: .Bl -tag -width Ds
                     69: .It Fl a
1.3       aaron      70: Append to
1.1       deraadt    71: .Ar tags
                     72: file.
1.14    ! jmc        73: .It Fl B
        !            74: Use backward searching patterns
        !            75: .Pq Li ?...? .
1.1       deraadt    76: .It Fl d
1.3       aaron      77: Create tags for
1.1       deraadt    78: .Li #defines
                     79: that don't take arguments;
                     80: .Li #defines
                     81: that take arguments are tagged automatically.
1.14    ! jmc        82: .It Fl F
        !            83: Use forward searching patterns
        !            84: .Pq Li /.../
        !            85: (the default).
1.7       deraadt    86: .It Fl f Ar tagsfile
1.1       deraadt    87: Places the tag descriptions in a file called
                     88: .Ar tagsfile .
                     89: The default behaviour is to place them in a file called
                     90: .Ar tags .
                     91: .It Fl t
1.3       aaron      92: Create tags for typedefs, structs, unions, and enums.
1.1       deraadt    93: .It Fl u
1.3       aaron      94: Update the specified files in the
1.1       deraadt    95: .Ar tags
                     96: file, that is, all
                     97: references to them are deleted, and the new values are appended to the
1.9       aaron      98: file.
                     99: (Beware: this option is implemented in a way which is rather
1.1       deraadt   100: slow; it is usually faster to simply rebuild the
                    101: .Ar tags
                    102: file.)
                    103: .It Fl v
                    104: An index of the form expected by
                    105: .Xr vgrind 1
1.9       aaron     106: is produced on the standard output.
                    107: This listing contains the object name, file name, and page number (assuming
                    108: 64 line pages).
                    109: Since the output will be sorted into lexicographic order,
1.1       deraadt   110: it may be desired to run the output through
                    111: .Xr sort 1 .
                    112: Sample use:
                    113: .Bd -literal -offset indent
1.11      mpech     114: $ ctags \-v files \&| sort \-f > index
                    115: $ vgrind \-x index
1.1       deraadt   116: .Ed
                    117: .It Fl w
1.3       aaron     118: Suppress warning diagnostics.
1.1       deraadt   119: .It Fl x
1.6       aaron     120: .Nm
1.1       deraadt   121: produces a list of object
                    122: names, the line number and file name on which each is defined, as well
1.9       aaron     123: as the text of that line and prints this on the standard output.
                    124: This is a simple index which can be printed out as an off-line readable
1.1       deraadt   125: function index.
                    126: .El
                    127: .Pp
                    128: Files whose names end in
1.9       aaron     129: .Dq \&.c
1.1       deraadt   130: or
1.9       aaron     131: .Dq \&.h
1.1       deraadt   132: are assumed to be C
                    133: source files and are searched for C style routine and macro definitions.
                    134: Files whose names end in
1.9       aaron     135: .Dq \&.y
1.1       deraadt   136: are assumed to be
                    137: .Tn YACC
                    138: source files.
                    139: Files whose names end in
1.9       aaron     140: .Dq \&.l
1.1       deraadt   141: are assumed to be lisp files if their
1.9       aaron     142: first non-blank character is
                    143: .Ql \&; ,
                    144: .Ql ( ,
                    145: or
                    146: .Ql [ ,
1.1       deraadt   147: otherwise, they are
1.9       aaron     148: treated as lex files.
                    149: Other files are first examined to see if they
1.1       deraadt   150: contain any Pascal or Fortran routine definitions, and, if not, are
                    151: searched for C style definitions.
                    152: .Pp
                    153: The tag
                    154: .Li main
1.9       aaron     155: is treated specially in C programs.
                    156: The tag formed is created by prepending
                    157: .Sq M
1.1       deraadt   158: to the name of the file, with the
                    159: trailing
1.9       aaron     160: .Dq \&.c
                    161: and any leading pathname components removed.
                    162: This makes use of
1.6       aaron     163: .Nm
1.9       aaron     164: practical in directories with more than one program.
1.1       deraadt   165: .Pp
                    166: Yacc and lex files each have a special tag.
                    167: .Ar Yyparse
                    168: is the start
                    169: of the second section of the yacc file, and
                    170: .Ar yylex
                    171: is the start of
                    172: the second section of the lex file.
                    173: .Sh FILES
                    174: .Bl -tag -width tags -compact
                    175: .It Pa tags
                    176: default output tags file
                    177: .El
1.13      jmc       178: .Sh DIAGNOSTICS
                    179: .Nm
                    180: exits with a value of 1 if an error occurred, 0 otherwise.
                    181: Duplicate objects are not considered errors.
1.1       deraadt   182: .Sh SEE ALSO
                    183: .Xr ex 1 ,
                    184: .Xr vi 1
1.10      aaron     185: .Sh HISTORY
                    186: The
                    187: .Nm
                    188: command appeared in
                    189: .Bx 3.0 .
1.1       deraadt   190: .Sh BUGS
                    191: Recognition of
1.6       aaron     192: .Nm functions ,
1.10      aaron     193: .Nm subroutines ,
1.1       deraadt   194: and
                    195: .Nm procedures
                    196: for
                    197: .Tn FORTRAN
1.9       aaron     198: and Pascal is done in a very simple-minded way.
                    199: No attempt
1.1       deraadt   200: is made to deal with block structure; if you have two Pascal procedures
                    201: in different blocks with the same name you lose.
1.6       aaron     202: .Nm
1.1       deraadt   203: doesn't
                    204: understand about Pascal types.
                    205: .Pp
                    206: The method of deciding whether to look for C, Pascal or
                    207: .Tn FORTRAN
                    208: functions is a hack.
                    209: .Pp
1.6       aaron     210: .Nm
1.1       deraadt   211: relies on the input being well formed, and any syntactical
1.9       aaron     212: errors will completely confuse it.
                    213: It also finds some legal syntax confusing; for example,
                    214: since it doesn't understand
1.1       deraadt   215: .Li #ifdef Ns 's
                    216: (incidentally, that's a feature, not a bug), any code with unbalanced
                    217: braces inside
                    218: .Li #ifdef Ns 's
                    219: will cause it to become somewhat disoriented.
                    220: In a similar fashion, multiple line changes within a definition will
                    221: cause it to enter the last line of the object, rather than the first, as
1.9       aaron     222: the searching pattern.
                    223: The last line of multiple line
1.1       deraadt   224: .Li typedef Ns 's
                    225: will similarly be noted.