#include <assert.h>#include <string.h>#include "ram.h"#include "dirtree-common.h"Go to the source code of this file.
Functions | |
| char * | DuplicateString (const char *String) |
| const char * | GetNextDir (const char *Path, char *Buff) |
| geBoolean | MatchPattern (const char *Source, const char *Pattern) |
| geBoolean | PathHasDir (const char *Path) |
|
|
Definition at line 29 of file dirtree-common.c. References geRam_Allocate. Referenced by DirTree_AddFile(), DirTree_Create(), and DirTree_CreateFinder().
00030 {
00031 int Length;
00032 char * NewString;
00033
00034 Length = strlen(String) + 1;
00035 NewString = geRam_Allocate(Length);
00036 if (NewString)
00037 memcpy(NewString, String, Length);
00038 return NewString;
00039 }
|
|
||||||||||||
|
Definition at line 41 of file dirtree-common.c. Referenced by DirTree_FindExact(), and DirTree_FindPartial().
00042 {
00043 while (*Path && *Path != '\\')
00044 *Buff++ = *Path++;
00045 *Buff = '\0';
00046
00047 if (*Path == '\\')
00048 Path++;
00049
00050 return Path;
00051 }
|
|
||||||||||||
|
Definition at line 53 of file dirtree-common.c. References GE_FALSE, GE_TRUE, geBoolean, and Source. Referenced by DirTree_FinderGetNextFile().
00054 {
00055 assert(Source);
00056 assert(Pattern);
00057
00058 switch (*Pattern)
00059 {
00060 case '\0':
00061 if (*Source)
00062 return GE_FALSE;
00063 break;
00064
00065 case '*':
00066 if (*(Pattern + 1) != '\0')
00067 {
00068 Pattern++;
00069 while (*Source)
00070 {
00071 if (MatchPattern(Source, Pattern) == GE_TRUE)
00072 return GE_TRUE;
00073 Source++;
00074 }
00075 return GE_FALSE;
00076 }
00077 break;
00078
00079 case '?':
00080 return MatchPattern(Source + 1, Pattern + 1);
00081
00082 default:
00083 if (*Source == *Pattern)
00084 return MatchPattern(Source + 1, Pattern + 1);
00085 else
00086 return GE_FALSE;
00087 }
00088
00089 return GE_TRUE;
00090 }
|
|
|
Definition at line 92 of file dirtree-common.c. References GE_FALSE, GE_TRUE, and geBoolean. Referenced by DirTree_AddFile().
|
1.3.2