Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
GLOBAL(1)		    General Commands Manual		     GLOBAL(1)

NAME
       global -	print the locations of specified object.

SYNOPSIS
       global [-aGilnqrstTvx][-e] pattern
       global -c[qsv] prefix
       global -f[anqrstvx] files
       global -g[aGilnoqtvx][-e] pattern
       global -I[ailnqtvx][-e] pattern
       global -p[qrv]
       global -P[aGilnoqtvx][-e] pattern
       global -u[qv]

DESCRIPTION
       Global  find  the  locations of specified object	in C, C++, Yacc, Java,
       PHP and Assembly	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
       other symbols.  Duplicate entries are allowed.

       In advance of using this	command, you must execute gtags(1) at the root
       directory  of  the source tree to make tag files.  Then you can execute
       at anywhere in the source tree.

COMMANDS
       The following commands are available:

       pattern
	      Print object which match to the pattern.	Extended  regular  ex-
	      pressions	 which	are the	same as	those accepted by egrep(1) are
	      available.

       -c, --completion	[prefix]
	      Print candidate function names which start with  specified  pre-
	      fix. Prefix is not specified, print all function names.

       -f, --file files
	      Print  all  function  definitions	in the files.  This option im-
	      plies -x option.

       -g, --grep
	      Print all	lines which match to the pattern.

       -I, --idutils
	      Print all	lines which match to the pattern.  This	 function  use
	      id-utils(1)  as  a search	engine.	 To use	this command, you need
	      to install id-utils(1) in	 your  system  and  you	 must  execute
	      gtags(1) with -I option.

       -p, --print-dbpath
	      Print the	location of 'GTAGS'.

       -P, --path [pattern]
	      Print the	path which match to the	pattern.  If no	pattern	speci-
	      fied, print all.

       -u, --update
	      Locate tag files and update them incrementally.

       --version
	      Show version number.

       --help Show help.

OPTIONS
       The following options are available:

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

       -e, --regexp pattern
	      Use pattern as the pattern; useful to protect   patterns	begin-
	      ning with	-.

       -G, --basic-regexp
	      Interpret	 pattern  as a	basic regular expression.  The default
	      is extended regular expression.  This option is valid for	the -g
	      and -P command.

       -i, --ignore-case
	      ignore case distinctions in pattern.

       -l, --local
	      Print just objects which exist under the current directory.

       -n, --nofilter
	      Suppress sort filter and path conversion filter.

       -o, --other
	      Search  pattern  in  not	only source files but also other files
	      like 'README'.  This option is valid only	with -g	or -P command.

       -q, --quiet
	      Quiet mode.

       -r, --reference,	--rootdir
	      Print the	locations of object references.	 By default, print ob-
	      ject  definitions.  With the -p option, print the	root directory
	      of source	tree.

       -s, --symbol
	      Print the	locations of  specified	 symbol	 other	than  function
	      names.  You need 'GSYMS' tags file. See gtags(1).

       -t, --tags
	      Print with standard ctags	format.

       -T, --through
	      Go  through  all	the  tag files listed in GTAGSLIBPATH.	By de-
	      fault, stop searching when tag is	found.	This option is ignored
	      when either -s, -r or -l option is specified.

       -v, --verbose
	      Verbose mode.

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

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

FILES
       'GTAGS'
	      Tag file for function definitions.

       'GRTAGS'
	      Tag file for function references.

       'GSYMS'
	      Tag file for other symbols.

       'GPATH'
	      Tag file for path	of source files.

       'GTAGSROOT'
	      If environment variable GTAGSROOT	is not set and 'GTAGSROOT' ex-
	      ist  in  the  same  directory with 'GTAGS' then use the value as
	      GTAGSROOT.

       '/etc/gtags.conf', '$HOME/.globalrc'
	      Configuration file.

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  ig-
	      nored when GTAGSROOT is not defined.

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

       GTAGSLABEL
	      If  this variable	is set,	its value is used as the label of con-
	      figuration file. The default is default.

CONFIGURATION
       The following configuration variables affect the	execution of global:

       icase_path(boolean)
	      Ignore case distinctions in the pattern.

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

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

       GNU GLOBAL source code tag system
       (http://www.gnu.org/software/global/).

AUTHOR
       Tama Communications Corporation.

HISTORY
       The global command appeared in FreeBSD 2.2.2.

GNU Project			   Nov 2004			     GLOBAL(1)

NAME | SYNOPSIS | DESCRIPTION | COMMANDS | OPTIONS | EXAMPLES | FILES | ENVIRONMENT | CONFIGURATION | DIAGNOSTICS | SEE ALSO | AUTHOR | HISTORY

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=global&sektion=1&manpath=FreeBSD+6.0-RELEASE+and+Ports>

home | help