Hi all, I am a long time cscope user but this is the first time I think I have found a potential issue. I have built cscope from an anonymous CVS checkout from an hour ago. The first thing I notice is that I can no longer do
cscope -Rbq I must do cscope -R -b -q Also, when I try to use the cscope/vim integration, it fails on the vim command, 'cs add cscope.out', with this message. cs_read_prompt EOF: No such file or directory E609: Cscope error: Usage: cscope [-bcCdehklLqRTuUvV] [-f file] [-F file] [-i file] [-I dir] [-s dir] [-p number] [-P path] [-[0-8] pattern] [source files] Vim is clearly doing something with the command line cscope suspects. Why the command line changes? The previous version of cscope that works fine with vim integration is 15.7a (latest for Ubuntu 10.04LTS). Also, I have a patch suggestion (inlined below). The motivation for the patch is that I sometimes want to bring in code from a library that isn't under the current working directory. In vim, I do 'cs add /path/to/other/cscope.out'. If that cscope.out is generated from /path/to/other using a simple 'cscope -Rbq', then it will have relative paths. When vim finds a match for a cscope search from that remote cscope.out, it will not be able to find the file because the relative path isn't valid. This patch adds a flag (-a) to cause the database to contain absolute paths which will allow remote cscope.out files to be added and used easily. Kind regards, Ken Index: dir.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/dir.c,v retrieving revision 1.32 diff -u -r1.32 dir.c --- dir.c 4 Mar 2010 21:11:43 -0000 1.32 +++ dir.c 16 Feb 2011 19:30:36 -0000 @@ -44,6 +44,7 @@ #include <sys/types.h> /* needed by stat.h and dirent.h */ #include <dirent.h> #include <sys/stat.h> /* stat */ +#include <unistd.h> static char const rcsid[] = "$Id: dir.c,v 1.32 2010/03/04 21:11:43 broeker Exp $"; @@ -482,6 +483,16 @@ { DIR *dirfile; int adir_len = strlen(adir); + char abs_path[PATHLEN + 1]; + + abs_path[0] = '\0'; + if (use_abs_paths + && adir_len > 0 + && adir[0] != '/') + { + (void) getcwd(abs_path, PATHLEN + 1); + (void) strcat(abs_path, "/"); + } /* FIXME: no guards against adir_len > PATHLEN, yet */ @@ -495,7 +506,7 @@ && (strcmp("..",entry->d_name) != 0)) { struct stat buf; - snprintf(path, sizeof(path), "%s/%.*s", adir, + snprintf(path, sizeof(path), "%s%s/%.*s", abs_path, adir, PATHLEN - 2 - adir_len, entry->d_name); Index: global.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/global.h,v retrieving revision 1.37 diff -u -r1.37 global.h --- global.h 10 Apr 2009 13:39:23 -0000 1.37 +++ global.h 16 Feb 2011 19:30:36 -0000 @@ -256,6 +256,7 @@ extern BOOL linemode; /* use line oriented user interface */ extern BOOL verbosemode; /* print extra information on line mode */ extern BOOL recurse_dir; /* recurse dirs when searching for src files */ +extern BOOL use_abs_paths; /* recurse dirs when searching for src files */ extern char *namefile; /* file of file names */ extern BOOL ogs; /* display OGS book and subsystem names */ extern char *prependpath; /* prepend path to file names */ Index: main.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/main.c,v retrieving revision 1.52 diff -u -r1.52 main.c --- main.c 30 Sep 2010 14:29:19 -0000 1.52 +++ main.c 16 Feb 2011 19:30:36 -0000 @@ -98,6 +98,7 @@ BOOL linemode = NO; /* use line oriented user interface */ BOOL verbosemode = NO; /* print extra information on line mode */ BOOL recurse_dir = NO; /* recurse dirs when searching for src files */ +BOOL use_abs_paths = NO; /* use absolute pathnames in recursive searches */ char *namefile; /* file of file names */ BOOL ogs; /* display OGS book and subsystem names */ char *prependpath; /* prepend path to file names */ @@ -233,6 +234,9 @@ case 'R': recurse_dir = YES; break; + case 'a': + use_abs_paths = YES; + break; case 'f': /* alternate cross-reference file */ reffile = optarg; if (strlen(reffile) > sizeof(path) - 3) { @@ -405,6 +409,9 @@ case 'R': recurse_dir = YES; break; + case 'a': + use_abs_paths = YES; + break; case 'f': /* alternate cross-reference file */ case 'F': /* symbol reference lines file */ case 'i': /* file containing file names */ ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Cscope-devel mailing list Cscope-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cscope-devel