eba69b10634496590c74e10c0da2ba8b813f01d9
[h316.git] / pc-tools / src-filters / zstrip.c
1 #include <stdio.h>
2 #include <fcntl.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <stdlib.h>
6
7 #define MAX_SIZE 1000000
8
9 int main(int argc, char ** argv){
10 int fd= open(argv[1], O_RDONLY );
11 if (fd<1) printf("Scheiße!\n");
12 char * buff=(char *) malloc(MAX_SIZE);
13
14 int sp=0;
15 int ep=read (fd, buff, MAX_SIZE)-1;
16 close (fd);
17
18 while(buff[sp]==0) sp++;
19 while(buff[ep]==0) ep--;
20
21 write(1,buff+sp,ep-sp+1);
22
23 }
24