From 64c85dfc1d3b546dd4b5f84168e9256817f3a741 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Thu, 20 Feb 2014 02:46:41 +0100 Subject: clean up source directory --- src/postprocess/dumpindex2.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/postprocess/dumpindex2.c (limited to 'src/postprocess/dumpindex2.c') diff --git a/src/postprocess/dumpindex2.c b/src/postprocess/dumpindex2.c new file mode 100644 index 0000000..f49a329 --- /dev/null +++ b/src/postprocess/dumpindex2.c @@ -0,0 +1,33 @@ +#include "mystdlib.h" +#include +#include + +static int indexed = -1; + +int main( int argc, char **argv ) { + MAP index = NULL; + int i,j; + char out[50]; + + if( argc != 3 ) + { fputs( "Syntax: sortindex ", stderr); exit( 1 ); } + + if( ( indexed = open( argv[1], O_RDONLY ) ) == -1 ) + { fprintf( stderr, "Could not open file: %s\n", argv[1] ); exit( 1 ); } + + if( !(index = map_file( argv[2], 0 ) ) ) exit( 1 ); + + for( i = 0; i < index->size; i+= 16 ) { + unsigned char *x = i + (unsigned char*)index->addr; + unsigned long p = *(unsigned long*)x; + + pread( indexed, out, 40, (off_t)p ); + for( j=0;j<40;++j) if( out[j] == '\t' || out[j] == '\n' ) out[j] = 0; out[j] = 0; + puts( out ); + } + + unmap_file( &index ); + close( indexed ); + + return 0; +} -- cgit v1.2.3