diff options
author | Dirk Engling <erdgeist@erdgeist.org> | 2014-02-20 02:46:41 +0100 |
---|---|---|
committer | Dirk Engling <erdgeist@erdgeist.org> | 2014-02-20 02:46:41 +0100 |
commit | 64c85dfc1d3b546dd4b5f84168e9256817f3a741 (patch) | |
tree | e3de2e7a99362bfa1dfcde3d4bad3e76af179c61 /src/dumpindex2.c | |
parent | 632c350fcf2021620afd032994e6e32c34c6dbfb (diff) |
clean up source directory
Diffstat (limited to 'src/dumpindex2.c')
-rw-r--r-- | src/dumpindex2.c | 33 |
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 | |||
5 | static int indexed = -1; | ||
6 | |||
7 | int 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 | } | ||