HuntnGather – Diff between revs 19 and 22
?pathlinks?
Rev 19 | Rev 22 | |||
---|---|---|---|---|
Line 13... | Line 13... | |||
13 | #include <sys/stat.h> |
13 | #include <sys/stat.h> |
|
Line 14... | Line 14... | |||
14 | |
14 | |
|
15 | #include <proto/dos.h> |
15 | #include <proto/dos.h> |
|
Line -... | Line 16... | |||
- | 16 | #include <proto/exec.h> |
||
- | 17 | |
||
- | 18 | #if defined ___AsyncIO___ |
||
- | 19 | #include <asyncio.h> |
||
16 | #include <proto/exec.h> |
20 | #endif |
|
17 | |
21 | |
|
18 | #if !defined ___HAVE_GETOPT___ |
22 | #if !defined ___HAVE_GETOPT___ |
|
Line 19... | Line 23... | |||
19 | #include "getopt.h" |
23 | #include "getopt.h" |
|
Line 20... | Line 24... | |||
20 | #endif |
24 | #endif |
|
21 | |
25 | |
|
22 | #define PROGRAM_VERSION "1.7.2" |
26 | #define PROGRAM_VERSION "1.7.3" |
|
23 | |
27 | |
|
Line 35... | Line 39... | |||
35 | |
39 | |
|
36 | #if !defined FALSE |
40 | #if !defined FALSE |
|
37 | #define FALSE 0; |
41 | #define FALSE 0; |
|
Line -... | Line 42... | |||
- | 42 | #endif |
||
38 | #endif |
43 | |
|
39 | |
44 | #define ASYNC_BUF 8192 |
|
40 | #define NAME_BUF 32 |
45 | #define NAME_BUF 32 |
|
Line 41... | Line 46... | |||
41 | #define PATH_BUF 128 |
46 | #define PATH_BUF 128 |
|
Line 107... | Line 112... | |||
107 | /* |
112 | /* |
|
108 | * |
113 | * |
|
109 | * Search the database for a matching string. |
114 | * Search the database for a matching string. |
|
110 | */ |
115 | */ |
|
111 | void SearchDatabase(char *dbFile, char* need) { |
116 | void SearchDatabase(char *dbFile, char* need) { |
|
- | 117 | #if defined ___AsyncIO___ |
||
- | 118 | struct AsyncFile *fp; |
||
- | 119 | LONG c; |
||
- | 120 | #else |
||
112 | FILE *fp; |
121 | FILE *fp; |
|
- | 122 | char c; |
||
- | 123 | #endif |
||
113 | char *name; |
124 | char *name; |
|
114 | int name_size; |
125 | int name_size; |
|
115 | char *path; |
126 | char *path; |
|
116 | int path_size; |
127 | int path_size; |
|
117 | char c; |
- | ||
118 | int i; |
128 | int i; |
|
119 | int side; |
129 | int side; |
|
120 | int match; |
130 | int match; |
|
121 | int total; |
131 | int total; |
|
Line -... | Line 132... | |||
- | 132 | |
||
- | 133 | #if defined ___AsyncIO___ |
||
- | 134 | if((fp = OpenAsync(dbFile, MODE_READ, ASYNC_BUF)) == NULL) { |
||
122 | |
135 | #else |
|
- | 136 | if((fp = fopen(dbFile, "r")) == NULL) { |
||
123 | if((fp = fopen(dbFile, "r")) == NULL) { |
137 | #endif |
|
124 | fprintf(stderr, "Unable to open gather database for reading.\n"); |
138 | fprintf(stderr, "Unable to open gather database for reading.\n"); |
|
125 | return; |
139 | return; |
|
Line 126... | Line 140... | |||
126 | } |
140 | } |
|
Line 133... | Line 147... | |||
133 | i = 0; |
147 | i = 0; |
|
134 | side = 0; |
148 | side = 0; |
|
135 | match = FALSE; |
149 | match = FALSE; |
|
136 | total = 0; |
150 | total = 0; |
|
Line -... | Line 151... | |||
- | 151 | |
||
- | 152 | #if defined ___AsyncIO___ |
||
- | 153 | while(run && (c = ReadCharAsync(fp)) != -1) { |
||
137 | |
154 | #else |
|
- | 155 | while(run && fscanf(fp, "%c", &c) == 1) { |
||
138 | while(run && fscanf(fp, "%c", &c) == 1) { |
156 | #endif |
|
139 | #if defined ___AmigaOS___ |
157 | #if defined ___AmigaOS___ |
|
140 | // Check if CTRL+C was pressed and abort the program. |
158 | // Check if CTRL+C was pressed and abort the program. |
|
141 | if(SetSignal(0L, SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) { |
159 | if(SetSignal(0L, SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) { |
|
142 | run = FALSE; |
160 | run = FALSE; |
|
Line 202... | Line 220... | |||
202 | } |
220 | } |
|
Line 203... | Line 221... | |||
203 | |
221 | |
|
204 | free(name); |
222 | free(name); |
|
Line -... | Line 223... | |||
- | 223 | free(path); |
||
- | 224 | |
||
- | 225 | #if defined ___AsyncIO___ |
||
205 | free(path); |
226 | CloseAsync(fp); |
|
- | 227 | #else |
||
206 | |
228 | fclose(fp); |
|
Line 207... | Line 229... | |||
207 | fclose(fp); |
229 | #endif |
|
208 | } |
230 | } |
|
209 | |
231 | |