diff -r 51b1ba3776b1 -r ee9333c91dda scanner.c --- a/scanner.c Fri Sep 16 09:59:20 2011 +0200 +++ b/scanner.c Fri Sep 16 10:36:45 2011 +0200 @@ -27,15 +27,16 @@ entryname[spaces] = 0; strcat(entryname, entry->d_name); + char filename[(1+strlen(currdir)+strlen(entry->d_name))]; + strcpy(filename, currdir); + strncat(filename, &settings->fileSeparator, 1); + strcat(filename, entry->d_name); + // Check for subdirectory - char subdirname[(1+strlen(currdir)+strlen(entry->d_name))]; - strcpy(subdirname, currdir); - strncat(subdirname, &settings->fileSeparator, 1); - strcat(subdirname, entry->d_name); - if ((subdir = opendir(subdirname)) != NULL) { + if ((subdir = opendir(filename)) != NULL) { printf("%-60s\n", entryname); if (settings->recursive) { - lineSum += scanDirectory(subdir, spaces+1, subdirname, settings); + lineSum += scanDirectory(subdir, spaces+1, filename, settings); } closedir(subdir); continue; @@ -43,10 +44,10 @@ // Count lines lines = 0; - char filename[(1+strlen(currdir)+strlen(entry->d_name))]; + /* char filename[(1+strlen(currdir)+strlen(entry->d_name))]; strcpy(filename, currdir); strncat(filename, &settings->fileSeparator, 1); - strcat(filename, entry->d_name); + strcat(filename, entry->d_name); */ if (testSuffix(filename, settings)) { FILE *file = fopen(filename, "r"); if (file == NULL) {