atch to allow config of default options
This patch enables cscope to use the file ~/.cscoperc
to define default options based on the current working
directory in which cscope is operating. Entries are
made into a users ~/.cscoperc in the format:
<directory string>:<options>;
with this patch, cscope scans each directory string and
attempts to make a substring match with it on the
current working directory. If a match is found the
corresponding options are added to the command line.
This allows for default options to be set on a per
directory basis. For example, consider the following
two entries in a .cscoperc file:
/usr/src/linux: -R -k;
/: -R;
This will cause cscope to add -R -k to any cscope
database built in a directory which contains the string
/usr/src/linux. Any other directory wll have the -R
option added
Logged In: YES
user_id=27517
I'm not quite convinced that a user-global ~/.cscoperc is
such a good idea, given the fact that there already is a
per-database implicit configuration option through
'config.files', which can also hold a number of cscope
options. It's not clear that a given user would always have
the same preferences for a given directory tree, regardless
of which project they're currently working on.
If options per subdirectory are needed, I think they should
go into either a local (not ~ directory) .cscope file, or
into cscope.files (or whatever is named by -i).
Logged In: YES
user_id=827328
Ok, that seems reasonable. Should the rc file have a
particular format, or do you think a space or comma
delimited list of command line options in the file would be
sufficient?
Logged In: YES
user_id=27517
[Sorry for the delay in answering this]
Space delimited should be best --- that way, it looks just like
the plain vanilla command line fragment it basically is.
I.e. the same format already used in cscope.files, just
without the side effect of disabling the search for source
files. Putting " -R" in a cscope.files would be pretty much
useless, but it will make sense if seen in .cscope. This
should also allow to keep or recycle most of the parsing
code already present to support options in cscope.files.
Logged In: YES
user_id=827328
No worries, I've been swamped myself :). Anywho, I'll have
some free time tonight, and will re-implement the patch
based on your recommendations. Thanks!
attempt 2 at patch for configuring default options
Logged In: YES
user_id=827328
I've made the changes we talked about. It actually makes
the whole mess a good bit simpler. Anywho, its attached for
your review as cscope-CVS-cscoperc-v2.patch. thanks!