GLOBAL(1)

NAME
global - print the locations of specified function.

SYNOPSIS
global [-acrx] name

DESCRIPTION
Global find the locations of specified function in C and Yacc source files. Global can treat a source tree, that is, a directory that has subdirectories and source files. You can get the relative path of objects from anywhere within the tree. Global can locate not only function definitions but also function references and allow duplicate entries too.

In advance of using this command, you must execute gtags(1) at the root directory of the source tree.

The following options are available:

-a  print absolute path name. By default, print relative path name.

-c  print candidate function names which start with specified string. If string is not specified, print all function names.

-r  print the locations of function references. By default, print function definitions.

-x  In addition to the default output, produce the line number and the line contents.

name
    function name. It can include perl's regular expression.

FILES
GTAGS
    tags file for function definitions.
GRTAGS
    tags file for function references.

ENVIRONMENT
The following environment variables affect the execution of global.

GTAGSROOT
    The directory which is the root of source tree.

GTAGSDBPATH
    The directory on which gtags database exist. This value is ignored when GTAGSROOT is not defined.

GTAGSLIBPATH
    If this variable is set, its value is used as the path to search for library functions. If specified function is not found in a source tree, global search in these path too.

EXAMPLES
% ls -F Makefile src/ lib/ % gtags % global main src/main.c % global -x main main 10 src/main.c main (argc, argv) { % global -x '^[sg]et' set_num 20 lib/util.c set_num(values) get_num 30 lib/util.c get_num() { % global -rx '^[sg]et' set_num 113 src/op.c set_num(32); set_num 225 src/opop.c if (set_num(0) > 0) { get_num 90 src/op.c while (get_num() > 0) { % cd lib % global -rx '^[sg]et' set_num 113 ../src/op.c set_num(32); set_num 225 ../src/opop.c if (set_num(0) > 0) { get_num 90 ../src/op.c while (get_num() > 0) { % global strlen % (cd /usr/src/sys; gtags) % setenv GTAGSLIBPATH /usr/src/sys % global strlen ../../../usr/src/sys/libkern/strlen.c % (cd /usr/src/lib; gtags) % setenv GTAGSLIBPATH /usr/src/lib:/usr/src/sys % global strlen ../../../usr/src/lib/libc/string/strlen.c

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

SEE ALSO
btreeop(1), gctags(1), gtags(1), htags(1).

AUTHORS
Shigio Yamaguchi (shigio@wafu.netgate.net)

HISTORY
The global command appeared in FreeBSD 2.2.