|
From: Hans-Bernhard B. <br...@us...> - 2003-10-15 14:10:27
|
Update of /cvsroot/cscope/cscope/src
In directory sc8-pr-cvs1:/tmp/cvs-serv31057/src
Modified Files:
dir.c
Log Message:
Fix -R search for multi-letter filename extensions
Index: dir.c
===================================================================
RCS file: /cvsroot/cscope/cscope/src/dir.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** dir.c 2 Jun 2003 10:42:59 -0000 1.19
--- dir.c 15 Oct 2003 14:09:30 -0000 1.20
***************
*** 503,507 ****
entry->d_ino != 0
#endif
! && issrcfile(mybasename(path))
&& infilelist(path) == NO) {
addsrcfile(path);
--- 503,507 ----
entry->d_ino != 0
#endif
! && issrcfile(path)
&& infilelist(path) == NO) {
addsrcfile(path);
***************
*** 518,580 ****
static BOOL
! issrcfile(char *file)
{
struct stat statstruct;
! char *s;
! /* if there is a file suffix */
! if ((s = strrchr(file, '.')) != NULL && *++s != '\0') {
! /* if an SCCS or versioned file */
! if (file[1] == '.' && file + 2 != s) { /* 1 character prefix */
! switch (*file) {
! case 's':
! case 'S':
! return(NO);
! }
}
! if (s[1] == '\0') { /* 1 character suffix */
! switch (*s) {
! case 'c':
! case 'h':
! case 'l':
! case 'y':
! case 'C':
! case 'G':
! case 'H':
! case 'L':
! return(YES);
! }
}
! else if (s[2] == '\0') { /* 2 character suffix */
! if ((*s == 'b' && s[1] == 'p') || /* breakpoint listing */
! (*s == 'q' &&
! (s[1] == 'c' || s[1] == 'h')) || /* Ingres */
! (*s == 's' && s[1] == 'd') || /* SDL */
! (*s == 'c' && s[1] == 'c') || /* C++ source */
! (*s == 'h' && s[1] == 'h')) { /* C++ header */
! /* some directories have 2 character
! suffixes so make sure it is a file */
! if (lstat(file, &statstruct) == 0 &&
! S_ISREG(statstruct.st_mode)) {
! return(YES);
! }
! }
}
! else if( s[3] == '\0' ) { /* 3 char suffix */
! if(
! (*s == 't' && s[1] == 'c' && s[2] == 'c' ) ||
! /* C++ template source */
! 0) {
! /* make sure it is a file */
! if (lstat(file, &statstruct) == 0 &&
! S_ISREG(statstruct.st_mode)) {
! return(YES);
! }
! }
}
}
! return(NO);
}
--- 518,577 ----
static BOOL
! issrcfile(char *path)
{
struct stat statstruct;
! char *file = mybasename(path);
! char *s = strrchr(file, '.');
! /* ensure there is some file suffix */
! if (s == NULL || *++s == '\0')
! return NO;
! /* if an SCCS or versioned file */
! if (file[1] == '.' && file + 2 != s) { /* 1 character prefix */
! switch (*file) {
! case 's':
! case 'S':
! return(NO);
}
! }
!
! if (s[1] == '\0') { /* 1 character suffix */
! switch (*s) {
! case 'c':
! case 'h':
! case 'l':
! case 'y':
! case 'C':
! case 'G':
! case 'H':
! case 'L':
! return(YES);
}
! } else if ((s[2] == '\0') /* 2 char suffix */
! && ((s[0] == 'b' && s[1] == 'p') /* breakpoint listing */
! || (s[0] == 'q'
! && (s[1] == 'c' || s[1] == 'h')) /* Ingres */
! || (s[0] == 's' && s[1] == 'd') /* SDL */
! || (s[0] == 'c' && s[1] == 'c') /* C++ source */
! || (s[0] == 'h' && s[1] == 'h'))) { /* C++ header */
! /* some directories have 2 character
! suffixes so make sure it is a file */
! if (lstat(path, &statstruct) == 0 &&
! S_ISREG(statstruct.st_mode)) {
! return(YES);
}
! } else if((s[3] == '\0') /* 3 char suffix */
! /* C++ template source */
! && (s[0] == 't' && s[1] == 'c' && s[2] == 'c' )
! ) {
! /* make sure it is a file */
! if (lstat(path, &statstruct) == 0 &&
! S_ISREG(statstruct.st_mode)) {
! return(YES);
}
}
! return NO;
}
|