Using the find tool

Needed to use the cscope tool
– required list of files

Couldn’t be bothered to RTFM. Should be header files be included in the cscope database?
– First example in [1] item (3) doesn’t help if both the ‘c’ and ‘h’ files are to be included.
– Second more complex example, last line gives clue.
– modified the regular expression in the option to:   -name “*.[ch]”

Cscope tool ran without a hitch on the gnucash source.
– where is main?
– multiple hits from the cscope database on sources with filenames “test*.*”; annoying test programs for functions need to be removed from database
–  needed to exclude the test files; same idea as example (3) in [1]
– => need to understand find

Deciphering what (3) does
– man find (yuck)
– the first few bits of [2] were useful, ignored the rest and went back to man and [1]
– what is an expression?
– expression = options + tests + actions
– tests
– -name pattern (won’t work for excluding directories?)
– -path pattern (use for inc/exc directories)
– actions
– -prune (ignore certain directories)
– -print
– operators
– !            (NOT)
– -o          (OR)
– soln: -name ‘*.[ch]’ ! -name ‘test*.*’

This seemed to work, reduced the number of hits on main after rebuilding the cscope database. Surprised by a number of mains still in the database. Found the actual gnucash main. The other mains appeared to be test mains surround by #IFDEF something something something, conditional compile.
[1] http://cscope.sourceforge.net/large_projects.html
[2] http://content.hccfl.edu/pollock/unix/findcmd.htm

Advertisements
Explore posts in the same categories: linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: