Update of /cvsroot/cscope/cscope/src
In directory usw-pr-cvs1:/tmp/cvs-serv30773/src
Modified Files:
dir.c
Log Message:
Quoted filenames in namelist files
Index: dir.c
===================================================================
RCS file: /cvsroot/cscope/cscope/src/dir.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** dir.c 2001/10/10 16:47:20 1.14
--- dir.c 2002/01/02 17:25:48 1.15
***************
*** 352,355 ****
--- 352,387 ----
}
}
+ else if (*path == '"') {
+ /* handle quoted filenames... */
+ size_t in = 1, out = 0;
+ char *newpath = mymalloc(PATHLEN + 1);
+
+ while (in < PATHLEN && path[in] != '\0') {
+ if (path[in] == '"') {
+ newpath[out] = '\0';
+ break; /* found end of quoted string */
+ }
+ else if (path[in] == '\\' && in < PATHLEN - 1
+ && (path[in + 1]== '"' || path[in + 1] == '\\')) {
+ /* un-escape \" or \\ sequence */
+ newpath[out++] = path[in + 1];
+ in += 2;
+ }
+ else {
+ newpath[out++] = path[in++];
+ }
+ } /* while */
+ if (i >= PATHLEN) { /* safeguard against almost-overflow */
+ newpath[out]='\0';
+ }
+ if ((s = inviewpath(newpath)) != NULL) {
+ addsrcfile(s);
+ }
+ else {
+ (void) fprintf(stderr, "cscope: cannot find file %s\n",
+ newpath);
+ errorsfound = YES;
+ }
+ } /* if (quoted entry) */
else if ((s = inviewpath(path)) != NULL) {
addsrcfile(s);
|