Subject: cscope: to support file name with space character Package: cscope Version: 15.7a-1 Severity: wishlist
I do not have any idea about whatever reason cscope not to support file
name with whitespace,
but I really need this feature in emacs environment with xcscope.el.
I had some workaround to make it happened, as following patch.
cscope-indexer, xcscope.el and cscope are made some changes.
However, respect to xcscope.el, I do not have enough confidence, that needs
some expert to review.
Astone.
==================
diff -r -u cscope-15.7a/contrib/xcscope/cscope-indexer
change/cscope-15.7a/contrib/xcscope/cscope-indexer
--- cscope-15.7a/contrib/xcscope/cscope-indexer 2001-06-28
12:39:48.000000000 +0800
+++ change/cscope-15.7a/contrib/xcscope/cscope-indexer 2010-04-28
17:46:02.000000000 +0800
@@ -139,7 +139,8 @@
) | \
egrep -i '\.([chly](xx|pp)*|cc|hh)$' | \
sed -e '/\/CVS\//d' -e '/\/RCS\//d' -e 's/^\.\///' | \
- sort > $LIST_FILE
+ sort | \
+ sed -e 's/.* .*/\"&\"/' > $LIST_FILE
if [ "X$VERBOSE" != "X" ]
then
diff -r -u cscope-15.7a/contrib/xcscope/xcscope.el
change/cscope-15.7a/contrib/xcscope/xcscope.el
--- cscope-15.7a/contrib/xcscope/xcscope.el 2002-04-11
00:59:00.000000000 +0800
+++ change/cscope-15.7a/contrib/xcscope/xcscope.el 2010-04-28
17:47:45.000000000 +0800
@@ -1750,7 +1750,7 @@
;; This should always match.
(if (string-match
- "^\\([^ \t]+\\)[ \t]+\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+
\\(.*\\)\n"
+ "^\\([^\t]+\\)[ \t]+\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+
\\(.*\\)\n"
line)
(progn
(let (str)
diff -r -u cscope-15.7a/src/command.c change/cscope-15.7a/src/command.c
--- cscope-15.7a/src/command.c 2009-04-10 21:40:36.000000000 +0800
+++ change/cscope-15.7a/src/command.c 2010-04-28 17:39:19.000000000
+0800
@@ -728,7 +728,7 @@
*oldfile = '\0';
seekline(1);
for (i = 0;
- fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s%*[^\n]",
newfile, linenum) == 2;
+ fscanf(refsfound, "%" PATHLEN_STR "[^\t]\t%*s%" NUMLEN_STR "s%*[^
\n]\n", newfile, linenum) == 2;
++i) {
/* see if the line is to be changed */
if (change[i] == YES) {
@@ -884,8 +884,9 @@
filelen = 4; /* strlen("File") */
fcnlen = 8; /* strlen("Function") */
numlen = 0;
- while ((i = fscanf(refsfound, "%250s%250s%5s %5000[^\n]", file,
- function, linenum, tempstring)) != EOF) {
+
+ while ((i = fscanf(refsfound, "%250[^\t]\t%250s %5s %5000[^\n]\n",
file,
+ function, linenum, tempstring)) != EOF) {
if (i != 4 ||
!isgraph((unsigned char) *file) ||
!isgraph((unsigned char) *function) ||
diff -r -u cscope-15.7a/src/display.c change/cscope-15.7a/src/display.c
--- cscope-15.7a/src/display.c 2009-04-10 21:40:36.000000000 +0800
+++ change/cscope-15.7a/src/display.c 2010-04-28 17:21:24.000000000
+0800
@@ -224,7 +224,7 @@
disprefs < mdisprefs && screenline <= lastdispline;
++disprefs, ++screenline) {
/* read the reference line */
- if (fscanf(refsfound, "%" PATHLEN_STR "s%" PATHLEN_STR "s%"
NUMLEN_STR "s %" TEMPSTRING_LEN_STR "[^\n]", file, function,
+ if (fscanf(refsfound, "%" PATHLEN_STR "[^\t]\t%" PATLEN_STR "s%"
NUMLEN_STR "s %" TEMPSTRING_LEN_STR "[^\n]\n", file, function,
linenum, tempstring) < 4) {
break;
}
diff -r -u cscope-15.7a/src/edit.c change/cscope-15.7a/src/edit.c
--- cscope-15.7a/src/edit.c 2009-04-10 21:40:36.000000000 +0800
+++ change/cscope-15.7a/src/edit.c 2010-04-28 14:49:06.000000000 +0800
@@ -60,7 +60,7 @@
seekline(i + topline);
/* get the file name and line number */
- if (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s", file,
linenum) == 2) {
+ if (fscanf(refsfound, "%" PATHLEN_STR "[^\t]\t%*s%" NUMLEN_STR "s",
file, linenum) == 2) {
edit(file, linenum); /* edit it */
}
seekline(topline); /* restore the line pointer */
@@ -83,7 +83,7 @@
seekline(1);
/* get each file name and line number */
- while (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s%*[^
\n]", file, linenum) == 2) {
+ while (fscanf(refsfound, "%" PATHLEN_STR "[^\t]\t%*s%" NUMLEN_STR
"s%*[^\n]\n", file, linenum) == 2) {
edit(file, linenum); /* edit it */
if (editallprompt == YES) {
addstr("Type ^D to stop editing all lines, or any other
character to continue: ");
diff -r -u cscope-15.7a/src/find.c change/cscope-15.7a/src/find.c
--- cscope-15.7a/src/find.c 2009-04-10 21:40:36.000000000 +0800
+++ change/cscope-15.7a/src/find.c 2010-04-28 17:18:06.000000000 +0800
@@ -506,7 +506,7 @@
char *file = filepath(srcfiles[i]);
progress("Search", searchcount, nsrcfiles);
- if (egrep(file, refsfound, "%s <unknown> %ld ") < 0) {
+ if (egrep(file, refsfound, "%s\t<unknown> %ld ") < 0) {
posterr ("Cannot open file %s", file);
}
}
@@ -532,7 +532,7 @@
s = srcfiles[i];
}
if (regexec (®exp, s, (size_t)0, NULL, 0) == 0) {
- (void) fprintf(refsfound, "%s <unknown> 1 <unknown>\n",
+ (void) fprintf(refsfound, "%s\t<unknown> 1 <unknown>\n",
srcfiles[i]);
}
}
@@ -765,7 +765,7 @@
else {
output = nonglobalrefs;
}
- (void) fprintf(output, "%s %s ", file, func);
+ (void) fprintf(output, "%s\t%s ", file, func);
putsource(seemore, output);
}
@@ -1185,7 +1185,7 @@
case FCNCALL: /* function call */
/* output the file name */
- (void) fprintf(refsfound, "%s ", file);
+ (void) fprintf(refsfound, "%s\t", file);
/* output the function name */
skiprefchar();
===============================
-- System Information:
Debian Release: squeeze/sid
APT prefers karmic-updates
APT policy: (500, 'karmic-updates'), (500, 'karmic-security'), (500,
'karmic-proposed'), (500, 'karmic-backports'), (500, 'karmic')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.31-17-server (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages cscope depends on:
ii libc6 2.10.1-0ubuntu16 GNU C Library: Shared
libraries
ii libncurses5 5.7+20090803-2ubuntu2 shared libraries for terminal
hand
cscope recommends no packages.
Versions of packages cscope suggests:
pn cbrowser <none> (no description available)
-- no debconf information
(See attached file: support_whitespace.diff)
support_whitespace.diff
Description: Binary data

