[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.2

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