HuntnGather – Diff between revs 26 and 27
?pathlinks?
Rev 26 | Rev 27 | |||
---|---|---|---|---|
Line 4... | Line 4... | |||
4 | |
4 | |
|
5 | #include <stdio.h> |
5 | #include <stdio.h> |
|
6 | #include <stdlib.h> |
6 | #include <stdlib.h> |
|
7 | #include <string.h> |
7 | #include <string.h> |
|
8 | #include <dirent.h> |
- | ||
9 | #include <signal.h> |
8 | #include <dirent.h> |
|
- | 9 | #include <ctype.h> |
||
- | 10 | #if !defined ___AmigaOS___ |
||
- | 11 | #include <signal.h> |
||
- | 12 | #endif |
||
Line 10... | Line 13... | |||
10 | #include <ctype.h> |
13 | |
|
11 | |
14 | |
|
Line 12... | Line 15... | |||
12 | #include <sys/types.h> |
15 | #include <sys/types.h> |
|
Line 55... | Line 58... | |||
55 | // Toggle the run flag to stop execution. |
58 | // Toggle the run flag to stop execution. |
|
56 | run = FALSE; |
59 | run = FALSE; |
|
57 | } |
60 | } |
|
Line 58... | Line 61... | |||
58 | |
61 | |
|
- | 62 | /* |
||
- | 63 | * |
||
- | 64 | * Returns largest of strings. |
||
- | 65 | */ |
||
- | 66 | #if defined ___AmigaOS___ |
||
- | 67 | LONG StringLenMax(char *a, char *b) { |
||
- | 68 | LONG p = strlen(a); |
||
- | 69 | LONG q = strlen(b); |
||
- | 70 | #else |
||
- | 71 | int StrlenMax(char *a, char *b) { |
||
- | 72 | int q = strlen(a); |
||
- | 73 | int p = strien(b); |
||
- | 74 | #endif |
||
- | 75 | return p > q ? p : q; |
||
- | 76 | } |
||
- | 77 | |
||
59 | /* |
78 | /* |
|
60 | * Compare two strings. |
79 | * Compare two strings. |
|
- | 80 | */ |
||
- | 81 | #if defined ___AmigaOS___ |
||
- | 82 | BOOL compare(char *a, char *b) { |
||
61 | */ |
83 | #else |
|
- | 84 | int compare(char *a, char *b) { |
||
62 | int compare(char *a, char *b) { |
85 | #endif |
|
63 | #if defined ___AmigaOS___ |
86 | #if defined ___AmigaOS___ |
|
64 | ULONG size; |
87 | ULONG size; |
|
65 | int success; |
88 | BOOL success; |
|
66 | UBYTE *pattern; |
- | ||
67 | char *e = a; |
- | ||
Line 68... | Line 89... | |||
68 | char *n = b; |
89 | UBYTE *pattern; |
|
69 | |
90 | |
|
Line 70... | Line 91... | |||
70 | // "must be at least 2 times as large plus 2 bytes" |
91 | // "must be at least 2 times as large plus 2 bytes" |
|
Line 71... | Line 92... | |||
71 | size = strlen(n) * 2 + 2; |
92 | size = strlen(b) * 2 + 2; |
|
72 | |
93 | |
|
73 | success = FALSE; |
94 | success = FALSE; |
|
74 | |
95 | |
|
Line 75... | Line 96... | |||
75 | if(pattern = AllocVec(size, MEMF_ANY|MEMF_CLEAR)) { |
96 | if(pattern = AllocVec(size, MEMF_ANY|MEMF_CLEAR)) { |
|
76 | switch(ParsePatternNoCase(n, pattern, (LONG)size)) { |
97 | switch(ParsePatternNoCase(b, pattern, (LONG)size)) { |
|
77 | case 1: // the pattern contains wildcards |
98 | case 1: // the pattern contains wildcards |
|
78 | success = MatchPatternNoCase(pattern, e); |
99 | success = MatchPatternNoCase(pattern, a); |
|
79 | |
100 | |
|
80 | break; |
101 | break; |
|
81 | case 0: // no wildcards so fall back to exact name match |
102 | case 0: // no wildcards so fall back to exact name match |
|
Line 82... | Line 103... | |||
82 | #if defined ___NOCASE_FS___ |
103 | #if defined ___NOCASE_FS___ |
|
83 | success = Strnicmp(e, n, (LONG)strlen(n)) == 0; |
104 | success = (Strnicmp(a, b, StringLenMax(a, b)) == 0); |