summaryrefslogtreecommitdiff
path: root/src/postprocess/cleanindex.c
blob: fb15bedb65ae25bcf051a54b51823347b1113755 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "mystdlib.h"
#include <sys/mman.h>
#include <fcntl.h>

static int indexed = -1;

int main( int argc, char **argv ) {
  MAP  index   = NULL;
  int  i;

  if( argc != 2 )
  { fputs( "Syntax: cleanindex <indexfile>", stderr); exit( 1 ); }

  if( !(index = map_file( argv[1], 0 ) ) ) exit( 1 );

  for( i = 0; i < index->size; i+= 16 )
    *((unsigned long*)(index->addr + i)) += *((unsigned char*)index->addr + i + 4);
    
  unmap_file( &index );
  close( indexed );

  return 0;
}