cscope/cscope-15.6-vpath.patch

35 lines
701 B
Diff

--- src/vpinit.c
+++ src/vpinit.c
@@ -110,7 +110,13 @@
vpath = stralloc(vpath);
/* split the view path into nodes */
- for (i = 0, s = vpath; *s != '\0'; ++i) {
+ /* handle VPATH=":foo" */
+ i = 0;
+ s = vpath;
+ while (*s++ == ':') {
+ vpdirs[i++] = ".";
+ }
+ for (; *s != '\0'; ++i) {
vpdirs[i] = s;
while (*s != '\0' && *++s != ':') {
if (*s == '\n') {
@@ -118,6 +124,16 @@
}
}
if (*s != '\0') {
+ /* handle VPATH="foo:" and VPATH="foo::bar" */
+ if (s[1] == '\0' || s[1] == ':') {
+ while (s[1] != '\0' && s[1] == ':') {
+ vpdirs[++i] = ".";
+ *s++ = '\0';
+ }
+ if (s[1] == '\0') {
+ vpdirs[++i] = ".";
+ }
+ }
*s++ = '\0';
}
}