Download this file

unactest1.c    498 lines (303 with data), 13.0 kB

  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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
/*
* Copyright (C) 2000, 2001, 2002 Loic Dachary <loic@senga.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* Run unac_string on an input large enough to trigger re-allocation.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "unac.h"
static char* longstr_expected = "
Senga - Catalog software
senga.org
December 28, 2000
January 27, 2000
Catalog-1.02
is available.
The dmoz loading process has been dramatically simplified. It is
now only available as a command. No more fancy web interface that
confuses everyone. In addition the convert_dmoz script now generates
text files that can be directly loaded into Catalog instead of the
intermediate XML file. The whole loading process now takes from
one to two hours depending on your machine. It took around 10 hours
with the previous version.
The -exclude option was added to convert_dmoz to get rid of
a whole branch of the catalog at load time. Typical usage would
be convert_dmoz -exclude '^/Adult' -what content content.rdf.gz.
A lot more sanity checks and repair have been added to deal with
duplicates, category id conflicts and the like.
Hopefully this new method will also be more understandable and
generate less traffic on the mailing list. There is room for
improvements and contributors are welcome.
A new set of software is available in the
download directory under the RedHat-6.1 section. These
are the most up to date versions on which Catalog depends. Although the
binaries depend on RedHat-6.1 the perl modules are source and can be
used on any platform.
September 7, 1999
Catalog-1.01
is available.
This is a maintainance release.
Various bug fixes. All easy
to fix bugs have been fixed. Take a look at Bug Track to see what hasn't been fixed.
The _PATHTEXT_ and _PATHFILE_
tags syntax has been extended to specify a range of path component.
Graham Barr added a recursive
template feature for a catalog root page. This allows to show sub-categories
of the root categories in the root page of a catalog.
Don't hesitate to submit bugs
or ideas to bug track. Hopefully the next version of Catalog will have
a fast full text indexing mechanism and I'll be able to implement new
functionalities.
Have fun !
July 3, 1999
Catalog-1.00
is available.
This release includes PHP3
code to display a catalog. The author is Weston Bustraan (weston@infinityteldata.net).
The main motivation to jump directly to version 1.00 is to avoid version
number problems on CPAN.
July 2, 1999
Catalog-0.19
is available.
This is a minor release. The
most noticeable addition is the new search mechanism.
Searching : two search modes
are now available. AltaVista simple syntax and AltaVista advanced syntax.
Both use the Text-Query and Text-Query-SQL perl modules.
Dmoz loading is much more
fault tolerant. In addition it can handle compressed versions of content.rdf
and structure.rdf. The comments are now stored in text fields instead
of char(255).
The template system was
extended with the pre_fill and post_fill parameters.
Searching associated to
a catalog dumped to static pages is now possible using the 'static'
mode.
Fixed two security weakness
in confedit and recursive cgi handling.
Many sql queries have been
optimized.
The configuration was changed
a bit to fix bugs and to isolate database dependencies.
The tests were updated to
isolate database dependencies.
Fixed numerous minor bugs,
check ChangeLog if you're interested in details.
Many thanks to Tim Bunce for
his numerous contributions and ideas. He is the architect of the Text-Query
and Text-Query-SQL modules, Eric Bohlman and Loic Dachary did the programming.
Thanks to Eric Bohlman for
his help on the Text-Query module. He was very busy but managed to spend
the time needed to release it.
There is not yet anything usable
for full text indexing but we keep working on it. The storage management
is now handled by the reiserfs file system thanks to Hans Reiser who is
working full time on this. Loic Dachary does his best to get something
working, if you're interested go to http://www.senga.org/mifluz/.
For some mysterious reason
CPAN lost track of Catalog name. In order to install catalog you should
use perl -MCPAN -e 'install Catalog::db'. Weird but temporary.
Have fun !
The Senga Team
Ecila
100 Av. du General Leclerc
93 500 Pantin
Tel: 33 1 56 96 09 80
Fax: 33 1 56 96 09 81
WEB: http://www.senga.org/
Mail: senga@senga.org
[
Catalog |
webbase |
mifluz |
unac |
Search-Mifluz |
Text-Query |
uri |
Statistics |
News
]
";
static char* longstr = "
Senga - Catalog software
senga.org
December 28, 2000
January 27, 2000
Catalog-1.02
is available.
The dmoz loading process has been dramatically simplified. It is
now only available as a command. No more fancy web interface that
confuses everyone. In addition the convert_dmoz script now generates
text files that can be directly loaded into Catalog instead of the
intermediate XML file. The whole loading process now takes from
one to two hours depending on your machine. It took around 10 hours
with the previous version.
The -exclude option was added to convert_dmoz to get rid of
a whole branch of the catalog at load time. Typical usage would
be convert_dmoz -exclude '^/Adult' -what content content.rdf.gz.
A lot more sanity checks and repair have been added to deal with
duplicates, category id conflicts and the like.
Hopefully this new method will also be more understandable and
generate less traffic on the mailing list. There is room for
improvements and contributors are welcome.
A new set of software is available in the
download directory under the RedHat-6.1 section. These
are the most up to date versions on which Catalog depends. Although the
binaries depend on RedHat-6.1 the perl modules are source and can be
used on any platform.
September 7, 1999
Catalog-1.01
is available.
This is a maintainance release.
Various bug fixes. All easy
to fix bugs have been fixed. Take a look at Bug Track to see what hasn't been fixed.
The _PATHTEXT_ and _PATHFILE_
tags syntax has been extended to specify a range of path component.
Graham Barr added a recursive
template feature for a catalog root page. This allows to show sub-categories
of the root categories in the root page of a catalog.
Don't hesitate to submit bugs
or ideas to bug track. Hopefully the next version of Catalog will have
a fast full text indexing mechanism and I'll be able to implement new
functionalities.
Have fun !
July 3, 1999
Catalog-1.00
is available.
This release includes PHP3
code to display a catalog. The author is Weston Bustraan (weston@infinityteldata.net).
The main motivation to jump directly to version 1.00 is to avoid version
number problems on CPAN.
July 2, 1999
Catalog-0.19
is available.
This is a minor release. The
most noticeable addition is the new search mechanism.
Searching : two search modes
are now available. AltaVista simple syntax and AltaVista advanced syntax.
Both use the Text-Query and Text-Query-SQL perl modules.
Dmoz loading is much more
fault tolerant. In addition it can handle compressed versions of content.rdf
and structure.rdf. The comments are now stored in text fields instead
of char(255).
The template system was
extended with the pre_fill and post_fill parameters.
Searching associated to
a catalog dumped to static pages is now possible using the 'static'
mode.
Fixed two security weakness
in confedit and recursive cgi handling.
Many sql queries have been
optimized.
The configuration was changed
a bit to fix bugs and to isolate database dependencies.
The tests were updated to
isolate database dependencies.
Fixed numerous minor bugs,
check ChangeLog if you're interested in details.
Many thanks to Tim Bunce for
his numerous contributions and ideas. He is the architect of the Text-Query
and Text-Query-SQL modules, Eric Bohlman and Loic Dachary did the programming.
Thanks to Eric Bohlman for
his help on the Text-Query module. He was very busy but managed to spend
the time needed to release it.
There is not yet anything usable
for full text indexing but we keep working on it. The storage management
is now handled by the reiserfs file system thanks to Hans Reiser who is
working full time on this. Loic Dachary does his best to get something
working, if you're interested go to http://www.senga.org/mifluz/.
For some mysterious reason
CPAN lost track of Catalog name. In order to install catalog you should
use perl -MCPAN -e 'install Catalog::db'. Weird but temporary.
Have fun !
The Senga Team
Ecila
100 Av. du Gnral Leclerc
93 500 Pantin
Tel: 33 1 56 96 09 80
Fax: 33 1 56 96 09 81
WEB: http://www.senga.org/
Mail: senga@senga.org
[
Catalog |
webbase |
mifluz |
unac |
Search-Mifluz |
Text-Query |
uri |
Statistics |
News
]
";
int main() {
int i;
char* out = 0;
size_t out_length = 0;
{
if(unac_string("ISO-8859-1", "�t�", 3, &out, &out_length) < 0) {
perror("unac �t�");
exit(1);
}
if(out_length != 3) {
fprintf(stderr, "out_length == %d instead of 3\n", (int)out_length);
exit(1);
}
if(memcmp("ete", out, out_length)) {
fprintf(stderr, "out == %.*s instead of ete\n", (int)out_length, out);
exit(1);
}
}
{
char tmp[10];
sprintf(tmp, "%c", 0xBC);
if(unac_string("ISO-8859-1", tmp, 1, &out, &out_length) < 0) {
perror("unac 0xBC (1/4)");
exit(1);
}
if(out_length != 3) {
fprintf(stderr, "out_length == %d instead of 3\n", (int)out_length);
exit(1);
}
if(memcmp("1 4", out, out_length)) {
fprintf(stderr, "out == %.*s instead of '1 4'\n", (int)out_length, out);
exit(1);
}
}
for(i = 0; i < 3; i++) {
int longstr_length = strlen(longstr);
if(unac_string("ISO-8859-1", longstr, longstr_length, &out, &out_length) == -1) {
perror("unac_string longstr failed");
exit(1);
}
if(out_length != longstr_length) {
fprintf(stderr, "out_length == %d instead of %d\n", (int)out_length, longstr_length);
exit(1);
}
if(memcmp(longstr_expected, out, out_length)) {
fprintf(stderr, "out == %.*s instead of ete\n", (int)out_length, out);
exit(1);
}
}
free(out);
return 0;
}