*/
#include <windows.h>
#include <tchar.h>
-#include <stdio.h>
+#include <stdio.h>
typedef struct _EXTENSION_INFO
{
ExtInfo = (PEXTENSION_INFO) HeapAlloc (GetProcessHeap(), 0, sizeof (EXTENSION_INFO));
if (!ExtInfo)
return NULL;
-
+
for(t = ExtName; *t != _T('\0'); t += _tcslen(t) + 1);
ln = (DWORD)t - (DWORD)ExtName;
-
+
ZeroMemory (ExtInfo, sizeof (EXTENSION_INFO));
memcpy (ExtInfo->ExtName, ExtName, ln);
_tcscpy (ExtInfo->Description, Description);
-
+
for(t = ExtInfo->ExtName; *t != _T('\0'); t += _tcslen(t) + 1)
{
if(ExtInfo->nExtensions++ != 0)
_tcscat (ExtInfo->ExpandedExtName, _T("*."));
_tcscat (ExtInfo->ExpandedExtName, t);
}
-
+
if (ExtInfoList)
{
Info = ExtInfoList;
static char FileBuffer[1024];
char LastChar = '\0';
char *Current;
-
+
LineLen = 0;
while(ReadFile (FileHandle, FileBuffer, sizeof(FileBuffer), &ReadBytes, NULL) && ReadBytes >= sizeof(char))
{
LineLen++;
}
}
-
+
StatInfo->LineCount += (LineLen > 0);
StatInfo->EmptyLines += ((LastChar != '\0') && (LineLen == 0));
}
TotalLineCount = 0;
TotalEmptyLines = 0;
Info = ExtInfoList;
-
+
for (Info = ExtInfoList; Info != NULL; Info = Info->Next)
{
TotalFileCount += Info->FileCount;
TotalLineCount += Info->LineCount;
TotalEmptyLines += Info->EmptyLines;
}
-
+
TotalAvgLF = (TotalFileCount ? TotalLineCount / TotalFileCount : 0);
-
+
for (Info = ExtInfoList; Info != NULL; Info = Info->Next)
{
DWORD AvgLF;
if (LoadFile (FileName))
{
PFILE_INFO StatInfo;
-
+
StatInfo = AddFile (FindFile.cFileName, Info);
if (!StatInfo)
{
_tprintf (_T("Not enough free memory.\n"));
return FALSE;
}
-
+
ReadLines (StatInfo);
-
+
Info->FileCount++;
Info->LineCount += StatInfo->LineCount;
Info->EmptyLines += StatInfo->EmptyLines;
if ((FindFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
&& (_tcscmp (FindFile.cFileName, _T(".")) != 0)
&& (_tcscmp (FindFile.cFileName, _T("..")) != 0)
- && (_tcscmp (FindFile.cFileName, _T("CVS")) != 0))
+ && (_tcscmp (FindFile.cFileName, _T("CVS")) != 0)
+ && (_tcscmp (FindFile.cFileName, _T(".svn")) != 0))
{
_tcscpy (SearchPath, Path);
_tcscat (SearchPath, _T("\\"));
{
if(!Options[i])
continue;
-
+
if(!_tcscmp(Options[i], Option))
return TRUE;
}
AddExtension (_T("c\0\0"), _T("Ansi C Source files"));
AddExtension (_T("cpp\0cxx\0\0"), _T("C++ Source files"));
AddExtension (_T("h\0\0"), _T("Header files"));
-
+
for(a = 1; a < argc - 1; a++)
{
#if UNICODE
Options[a - 1] = argv[a];
#endif
}
-
+
SkipEmptyLines = IsOptionSet(_T("-e"));
BeSilent = IsOptionSet(_T("-s"));
-
+
#if UNICODE
ZeroMemory(Path, sizeof(Path));
if(MultiByteToWideChar(CP_ACP, 0, argv[argc - 1], -1, Path, MAX_PATH) > 0)