1GLOBAL(1)                   General Commands Manual                  GLOBAL(1)
2
3
4

NAME

6       global - print the locations of specified object.
7

SYNOPSIS

9       global [-aGilnqrstTvx][-e] pattern
10       global -c[qsv] prefix
11       global -f[anqrstvx] files
12       global -g[aGilnoOqtvx][-e] pattern
13       global -I[ailnqtvx][-e] pattern
14       global -p[qrv]
15       global -P[aGilnoOqtvx][-e] pattern
16       global -u[qv]
17

DESCRIPTION

19       Global  find  the  locations of specified object in C, C++, Yacc, Java,
20       PHP and Assembly source files.  Global can treat a  source  tree,  that
21       is,  a directory that has subdirectories and source files.  You can get
22       the relative path of objects from anywhere within the tree.  Global can
23       locate not only object definitions but also object references and other
24       symbols.  Duplicate entries are allowed.
25
26       In advance of using this command, you must execute gtags(1) at the root
27       directory  of  the source tree to make tag files.  Then you can execute
28       at anywhere in the source tree.
29

COMMANDS

31       The following commands are available:
32
33       pattern
34              Print object which  match  to  the  pattern.   Extended  regular
35              expressions which are the same as those accepted by egrep(1) are
36              available.
37
38       -c, --completion [prefix]
39              Print candidate definition names which start with specified pre‐
40              fix. Prefix is not specified, print all definition names.
41
42       -f, --file files
43              Print all tags in the files.  This option implies -x option.
44
45       -g, --grep
46              Print all lines which match to the pattern.
47
48       -I, --idutils
49              Print  all  lines which match to the pattern.  This function use
50              idutils(1) as a search engine.  To use this command, you need to
51              install  idutils(1) in your system and you must execute gtags(1)
52              with -I option.
53
54       -p, --print-dbpath
55              Print the location of ´GTAGS´.
56
57       -P, --path [pattern]
58              Print the path which match to the pattern.  If no pattern speci‐
59              fied, print all.
60
61       -u, --update
62              Locate tag files and update them incrementally.
63
64       --version
65              Show version number.
66
67       --help Show help.
68

OPTIONS

70       The following options are available:
71
72       -a, --absolute
73              Print absolute path name. By default, print relative path name.
74
75       -e, --regexp pattern
76              Use  pattern  as the pattern; useful to protect  patterns begin‐
77              ning with -.
78
79       -G, --basic-regexp
80              Interpret pattern as a  basic regular expression.   The  default
81              is extended regular expression.  This option is valid for the -g
82              and -P command.
83
84       -i, --ignore-case
85              ignore case distinctions in pattern.
86
87       -l, --local
88              Print just objects which exist under the current directory.
89
90       -n, --nofilter
91              Suppress sort filter and path conversion filter.
92
93       -o, --other
94              Search pattern in not only source files  but  also  other  files
95              like ´README´.  This option is valid only with -g or -P command.
96
97       -O, --only-other
98              Search  pattern  only in other files like ´README´.  This option
99              is valid only with -g or -P command.  This option  override  the
100              -o option.
101
102       -q, --quiet
103              Quiet mode.
104
105       -r, --reference, --rootdir
106              Print  the  locations  of  object references.  By default, print
107              object definitions.  With the -p option, print the  root  direc‐
108              tory of source tree.
109
110       --result format
111              format  may  be  'path', `ctags', `ctags-x', `grep' or 'cscope'.
112              The --result=ctags and --result=ctags-x are equivalent to the -t
113              and  -x  respectively.  The -t and -x are given to priority more
114              than the --result option.
115
116       -s, --symbol
117              Print the locations of specified symbol other than definitions.
118
119       -t, --tags
120              Print with standard ctags format.
121
122       -T, --through
123              Go through  all  the  tag  files  listed  in  GTAGSLIBPATH.   By
124              default,  stop  searching  when  tag  is  found.  This option is
125              ignored when either -s, -r or -l option is specified.
126
127       -v, --verbose
128              Verbose mode.
129
130       -x, --cxref
131              In addition to the default output, produce the line  number  and
132              the line contents.
133

EXAMPLES

135            $ ls -F
136            Makefile      src/    lib/
137            $ gtags
138            $ global main
139            src/main.c
140            $ global -x main
141            main              10 src/main.c  main (argc, argv) {
142            $ global -x '^[sg]et'
143            set_num           20 lib/util.c  set_num(values)
144            get_num           30 lib/util.c  get_num() {
145            $ global -rx '^[sg]et'
146            set_num          113 src/op.c            set_num(32);
147            set_num          225 src/opop.c               if (set_num(0) > 0) {
148            get_num           90 src/op.c            while (get_num() > 0) {
149            $ cd lib
150            $ global -rx '^[sg]et'
151            set_num          113 ../src/op.c            set_num(32);
152            set_num          225 ../src/opop.c               if (set_num(0) > 0) {
153            get_num           90 ../src/op.c            while (get_num() > 0) {
154            $ global strlen
155            $ (cd /usr/src/sys; gtags)
156            $ export GTAGSLIBPATH=/usr/src/sys
157            $ global strlen
158            ../../../usr/src/sys/libkern/strlen.c
159            $ (cd /usr/src/lib; gtags)
160            $ GTAGSLIBPATH=/usr/src/lib:/usr/src/sys
161            $ global strlen
162            ../../../usr/src/lib/libc/string/strlen.c
163

FILES

165       ´GTAGS´
166              Tag file for object definitions.
167
168       ´GRTAGS´
169              Tag file for object references.
170
171       ´GSYMS´
172              Tag file for other symbols.
173
174       ´GPATH´
175              Tag file for path of source files.
176
177       ´GTAGSROOT´
178              If  environment  variable  GTAGSROOT  is not set and ´GTAGSROOT´
179              exist in the same directory with ´GTAGS´ then use the  value  as
180              GTAGSROOT.
181
182       ´/etc/gtags.conf´, ´$HOME/.globalrc´
183              Configuration file.
184

ENVIRONMENT

186       The following environment variables affect the execution of global:
187
188       GTAGSROOT
189              The directory which is the root of source tree.
190
191       GTAGSDBPATH
192              The  directory  on  which  gtags  database exist.  This value is
193              ignored when GTAGSROOT is not defined.
194
195       GTAGSLIBPATH
196              If this variable is set, it is used as the path  to  search  for
197              library  functions.  If the specified function is not found in a
198              source tree, global also search in these paths.
199
200       GTAGSLABEL
201              If this variable is set, its value is used as the label of  con‐
202              figuration file. The default is default.
203

CONFIGURATION

205       The following configuration variables affect the execution of global:
206
207       icase_path(boolean)
208              Ignore case distinctions in the pattern.
209

DIAGNOSTICS

211       Global exits with a non 0 value if an error occurred, 0 otherwise.
212

SEE ALSO

214       gtags-parser(1), gtags(1), htags(1), less(1).
215
216       GNU GLOBAL source code tag system
217       (http://www.gnu.org/software/global/).
218

AUTHOR

220       Tama Communications Corporation.
221

HISTORY

223       The global command appeared in FreeBSD 2.2.2.
224
225
226
227GNU Project                       April 2006                         GLOBAL(1)
Impressum