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/cutfile.c | |
| parent | 632c350fcf2021620afd032994e6e32c34c6dbfb (diff) | |
clean up source directory
Diffstat (limited to 'src/cutfile.c')
| -rw-r--r-- | src/cutfile.c | 33 |
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 | |||
| 4 | int 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 | } | ||
