|
Last change
on this file was
2,
checked in by phkim, 11 years ago
|
|
1.phkim
- revision copy newcon3sk r27
|
-
Property svn:executable set to
*
|
|
File size:
668 bytes
|
| Line | |
|---|
| 1 | #include <stdio.h> |
|---|
| 2 | #include <stdlib.h> |
|---|
| 3 | #include "tsindexer.h" |
|---|
| 4 | |
|---|
| 5 | int into_the_ether(char *buf, int n, int m, void *file) |
|---|
| 6 | { |
|---|
| 7 | } |
|---|
| 8 | |
|---|
| 9 | int main(int argc, char **argv) |
|---|
| 10 | { |
|---|
| 11 | sTsIndexer *indexer; |
|---|
| 12 | #define BUFSIZE 2 * 1024 * 1024 |
|---|
| 13 | char buf[BUFSIZE]; |
|---|
| 14 | FILE *f; |
|---|
| 15 | unsigned short pid; |
|---|
| 16 | int index; |
|---|
| 17 | |
|---|
| 18 | f = fopen(argv[1], "r"); |
|---|
| 19 | if (!f) {perror("fopen"); return -1;} |
|---|
| 20 | pid = strtoul(argv[2], NULL, 0); |
|---|
| 21 | index = atoi(argv[3]); |
|---|
| 22 | |
|---|
| 23 | indexer = tsindex_allocate((INDEX_WRITE_CB)into_the_ether, NULL, pid, -1); |
|---|
| 24 | while (!feof(f)) { |
|---|
| 25 | int n = fread(buf, 1, BUFSIZE, f); |
|---|
| 26 | if (index) tsindex_feed( indexer, buf, n); |
|---|
| 27 | printf("."); |
|---|
| 28 | fflush(stdout); |
|---|
| 29 | } |
|---|
| 30 | printf("\n"); |
|---|
| 31 | tsindex_free( indexer ); |
|---|
| 32 | return 0; |
|---|
| 33 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.