summaryrefslogtreecommitdiff
path: root/src/cutfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cutfile.c')
-rw-r--r--src/cutfile.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/cutfile.c b/src/cutfile.c
deleted file mode 100644
index a2c87dc..0000000
--- a/src/cutfile.c
+++ /dev/null
@@ -1,33 +0,0 @@
1#include "mystdlib.h"
2#include <unistd.h>
3
4int main( int argc, char **argv )
5{
6 MAP file = NULL;
7 unsigned long i = 0;
8
9 if( !(file = map_file( argv[1], 0 ) ) ) exit( 1 );
10
11 if( file->size & 15 )
12 puts( "WARNING: File size not multiple of 16" );
13
14 while( i < file->size && *(unsigned long*)(file->addr+i) < 2911418625UL )
15 i+= 16;
16
17 if( i < file->size)
18 {
19 if( i ) {
20 off_t newsize = (off_t)i;
21 printf( "%s reduced by %8d bytes. (Offending offset: %09lu)\n", argv[1], (unsigned long)(file->size - i ), *(unsigned long*)(file->addr+i) );
22 ftruncate( file->fh, newsize );
23 } else {
24 printf( "%s removed. (Offending offset: %09lu)\n", argv[1], *(unsigned long*)(file->addr+i) );
25 unlink( argv[1] );
26 }
27 }
28
29 unmap_file( &file );
30
31
32 return 0;
33}