DragonFly BSD
DragonFly kernel List (threaded) for 2004-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: learning dragonfly or C...


From: Max Okumoto <okumoto@home>
Date: Thu, 11 Nov 2004 04:32:24 -0800

George Georgalis wrote:
[stuff deleted]
When jumping into a block of code that has functions and
declarations, what is an efficient way to to find those definition
amidst all the includes, paths and Makefiles of the whole tree,
without completely losing your place? (eg I'd like to reference
O_RDONLY and fp_close)
[stuff deleted]

If you use vi as your editor you can navigate code using a
tags file, other editors have similar functionality (for
example emacs uses etags).

% man 1 vi
. ..
   -t     Start editing at the specified tag.  (See ctags(1)).
. ..
. ..
   <control-]>
        Push a tag reference onto the tag stack.  In  gtagsmode, if  at
        the  first  column of line, locate function references otherwise
        function definitions.

   <control-^>
        Switch to the most recently edited file.
. ..

The following command will open the file containing the function
definition for JobCondPassSig.

% vi -t JobCondPassSig

Or when the cursor is on the first character of a function name,
type <ctrl-]>, this should causes the editor to open the file
containing the definition of the function. Typing <ctrl-6> will
return you to the previous file and location.

The tags file is created by running ctags on your source files.
There is also a target in Makefiles that includes 'bsd.prog.mk'
or 'bsd.lib.mk' called ctags.

	% cd /usr/src/usr.bin/make
	% setenv CTAGS ctags
	% make tags
	Duplicate entry in file job.c, line 243: MESSAGE
	Second entry ignored
	Duplicate entry in file job.c, line 262: KILL
	Second entry ignored
	Duplicate entry in file job.c, line 264: KILL
	Second entry ignored
	Duplicate entry in file targ.c, line 493: PRINTBIT
	Second entry ignored
	Duplicate entry in file targ.c, line 494: PRINTDBIT
	Second entry ignored

takai.home-2924% vi -t JobCondPassSig

If you are interested in the kernel source then there is a
target in /usr/src/sys/i386/Makefile which will create a tags
file for the whole kernel.

Max




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]