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[qrsv] prefix
11       global -f[anqrstvx] files
12       global -g[aGilnoOqtvx][-e] pattern
13       global -I[ailnqtvx][-e] pattern
14       global -P[aGilnoOqtvx][-e] pattern
15       global -p[qrv]
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 sub-directories and source files as a project.
22       You can get the relative path  of  objects  from  anywhere  within  the
23       project.  Global can locate not only object definitions but also object
24       references and other symbols.
25
26       In advance of using this command, you must execute gtags(1) at the root
27       directory  of the project to make tag files.  Then you can execute this
28       command at anywhere in the project.
29

COMMANDS

31       The following commands are available:
32
33       <no command> 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 the candidates of object names which start with the speci‐
40              fied prefix. Prefix is not specified, print all object names.
41
42       -f, --file files
43              Print all tags in the files.  This option implies the -x option.
44
45       -g, --grep pattern
46              Print all lines which match to the pattern.
47
48       --help Show help.
49
50       -I, --idutils pattern
51              Print  all  lines which match to the pattern.  This function use
52              idutils(1) as a search engine.  To use this command, you need to
53              install  idutils(1) in your system and you must execute gtags(1)
54              with the -I option.
55
56       -P, --path [pattern]
57              Print the paths which match to the pattern.  If no pattern spec‐
58              ified, print all paths in the project.
59
60       -p, --print-dbpath
61              Print the location of ´GTAGS´.
62
63       -u, --update
64              Locate tag files and update them incrementally.
65
66       --version
67              Show version number.
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       --from-here context
76              Decide   tag   type   by   the  context.  The  context  must  be
77              'lineno:path'.  If this option is specified then the -s  and  -r
78              are  ignored.  Regular expression is not allowed in the pattern.
79              This option assumes use in conversational environments  such  as
80              editors and IDEs.
81
82       -e, --regexp pattern
83              Use  pattern  as the pattern; useful to protect  patterns begin‐
84              ning with ´-´.
85
86       -G, --basic-regexp
87              Interpret pattern as a  basic regular expression.   The  default
88              is extended regular expression.
89
90       -i, --ignore-case
91              ignore case distinctions in pattern.
92
93       -l, --local
94              Print just objects which exist under the current directory.
95
96       -n, --nofilter
97              Suppress sort filter and path conversion filter.
98
99       -O, --only-other
100              Search  pattern  only  in other than source files like ´README´.
101              This option is valid only with -g or -P  command.   This  option
102              override the -o option.
103
104       -o, --other
105              Search  pattern  in  not  only source files but also other files
106              like ´README´.  This option is valid only with -g or -P command.
107
108       -q, --quiet
109              Quiet mode.
110
111       -r, --reference, --rootdir
112              Print the locations of object  references.   By  default,  print
113              object  definitions.   With the -p option, print the root direc‐
114              tory of source tree.
115
116       --result format
117              format may be 'path', `ctags', `ctags-x',  `grep'  or  'cscope'.
118              The --result=ctags and --result=ctags-x are equivalent to the -t
119              and -x respectively.  The --result option is given  to  priority
120              more than the -t and -x option.
121
122       -s, --symbol
123              Print the locations of specified symbol other than definitions.
124
125       -T, --through
126              Go  through  all  the  tag  files  listed  in  GTAGSLIBPATH.  By
127              default, stop searching when  tag  is  found.   This  option  is
128              ignored when either -s, -r or -l option is specified.
129
130       -t, --tags
131              Print with standard ctags format.
132
133       -v, --verbose
134              Verbose mode.
135
136       -x, --cxref
137              In  addition  to the default output, produce the line number and
138              the line contents.
139

EXAMPLES

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

FILES

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

ENVIRONMENT

192       The following environment variables affect the execution of global:
193
194       GTAGSROOT
195              The directory which is the root of source code.
196
197       GTAGSDBPATH
198              The directory on which gtags  database  exist.   This  value  is
199              ignored when GTAGSROOT is not defined.
200
201       GTAGSLIBPATH
202              If  this  variable  is set, it is used as the path to search for
203              library functions. If the specified object is not found  in  the
204              source  project,  global also search in these paths.  Since only
205              ´GTAGS´ is targeted in the retrieval, this variable  is  ignored
206              when the -r or -s is specified.
207
208       GTAGSLABEL
209              If  this variable is set, its value is used as the label of con‐
210              figuration file. The default is default.
211
212       MAKEOBJDIRPREFIX
213              If this variable is set, ´$MAKEOBJDIRPREFIX<current  directory>´
214              is  used  as the candidate directory for tag files.  The default
215              is ´/usr/obj´.
216

CONFIGURATION

218       The following configuration variables affect the execution of global:
219
220       icase_path(boolean)
221              Ignore case distinctions in the pattern.
222

DIAGNOSTICS

224       Global exits with a non 0 value if an error occurred, 0 otherwise.
225

SEE ALSO

227       gtags-parser(1), gtags(1), htags(1), less(1).
228
229       GNU GLOBAL source code tag system
230       (http://www.gnu.org/software/global/).
231

AUTHOR

233       Tama Communications Corporation.
234

HISTORY

236       The global command appeared in FreeBSD 2.2.2.
237
238
239
240GNU Project                      February 2009                       GLOBAL(1)
Impressum