summaryrefslogtreecommitdiff
path: root/src/dumpindex2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dumpindex2.c')
-rw-r--r--src/dumpindex2.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/dumpindex2.c b/src/dumpindex2.c
deleted file mode 100644
index f49a329..0000000
--- a/src/dumpindex2.c
+++ /dev/null
@@ -1,33 +0,0 @@
1#include "mystdlib.h"
2#include <sys/mman.h>
3#include <fcntl.h>
4
5static int indexed = -1;
6
7int main( int argc, char **argv ) {
8 MAP index = NULL;
9 int i,j;
10 char out[50];
11
12 if( argc != 3 )
13 { fputs( "Syntax: sortindex <indexedfile> <indexfile>", stderr); exit( 1 ); }
14
15 if( ( indexed = open( argv[1], O_RDONLY ) ) == -1 )
16 { fprintf( stderr, "Could not open file: %s\n", argv[1] ); exit( 1 ); }
17
18 if( !(index = map_file( argv[2], 0 ) ) ) exit( 1 );
19
20 for( i = 0; i < index->size; i+= 16 ) {
21 unsigned char *x = i + (unsigned char*)index->addr;
22 unsigned long p = *(unsigned long*)x;
23
24 pread( indexed, out, 40, (off_t)p );
25 for( j=0;j<40;++j) if( out[j] == '\t' || out[j] == '\n' ) out[j] = 0; out[j] = 0;
26 puts( out );
27 }
28
29 unmap_file( &index );
30 close( indexed );
31
32 return 0;
33}