-
Notifications
You must be signed in to change notification settings - Fork 0
/
EXCLUDES.C
103 lines (88 loc) · 1.64 KB
/
EXCLUDES.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#define INCL_DOS
#define INCL_WIN
#define INCL_GPI
#define DATAS 1
#include <os2.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "msehook.h"
#include "mse.h"
#include "dialog.h"
void FreeExcludes (char ***ex,int *nex) {
int x;
if(ex && *ex) {
for(x = 0;(*ex)[x];x++)
free((*ex)[x]);
free(*ex);
_heapmin();
}
if(nex)
*nex = 0;
if(ex)
*ex = NULL;
}
void LoadExcludes (char ***ex,int *nex,char *filename) {
FILE *fp;
int x;
char **test;
static char s[CCHMAXPATHCOMP + 4];
BOOL temp = fSuspend;
if(!ex ||
!nex ||
!filename)
return;
fSuspend = TRUE;
if(*ex)
FreeExcludes(ex,
nex);
x = 0;
sprintf(s,
"%s%s",
mydir,
filename);
fp = fopen(s,"r");
if(fp) {
while(!feof(fp)) {
if(!fgets(s,
sizeof(s),
fp))
break;
s[sizeof(s) - 1] = 0;
stripcr(s);
lstrip(rstrip(s));
if(*s) {
if(x >= *nex - 1) {
test = realloc(*ex,
sizeof(char *) * (*nex + 2));
if(test)
*ex = test;
else
break;
}
(*ex)[*nex] = strdup(s);
if((*ex)[*nex]) {
(*nex)++;
(*ex)[*nex] = NULL;
}
else
break;
}
}
fclose(fp);
}
fSuspend = temp;
}
BOOL IsExcluded (char *titletext) {
int x;
if(excludes) {
for(x = 0;excludes[x];x++) {
if(!strnicmp(excludes[x],
titletext,
strlen(excludes[x])))
return TRUE;
}
}
return FALSE;
}