parent
1ad4f22b8c
commit
e461123401
@ -0,0 +1,4 @@ |
||||
The goals of the doubleplus unzip program are simple: |
||||
First - to fix the problem of a growing amount of disk space available to the user, more than they need. |
||||
Second - the make sure that Harddrive Manufactuerers will always have a purpose so they will reduce pressure on companies to make larger programs. |
||||
Thirdly - To cause Timothy James Robotham to slap his forehead. |
@ -0,0 +1,48 @@ |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
|
||||
int main (int argc, char **argv){ |
||||
char name[FILENAME_MAX]; |
||||
FILE *bob,*joe,*moe; |
||||
int thing, factor, arg; |
||||
if(argc >= 3){ |
||||
factor = atoi (argv[1]); |
||||
arg = 2; |
||||
}else{ |
||||
factor = 9; |
||||
arg = 1; |
||||
} |
||||
if(argc<2){ |
||||
fputs("I pity the fool who don't have an input file!\n",stderr); |
||||
return EXIT_FAILURE; |
||||
} |
||||
strcpy(name,argv[arg]); |
||||
strcat(name,".dpu");
|
||||
if((bob = fopen(argv[arg],"r"))==NULL){ |
||||
fputs("NO YOU FOOL, A REAL ONE!\n",stderr); |
||||
return EXIT_FAILURE; |
||||
} |
||||
if((joe = fopen(name,"w"))==NULL){ |
||||
fputs("Ummm, you seem to have an unwritable file or directory or something silly called the output file, this is dumb. Please stop.\n",stderr); |
||||
return EXIT_FAILURE; |
||||
}
|
||||
if((moe = fopen("/dev/urandom","r"))==NULL){ |
||||
fputs("So, you aren't random enough. Annoying.\n",stderr); |
||||
return EXIT_FAILURE; |
||||
} |
||||
fprintf(joe,"DOUBLEPLUS UNZIP, FACTOR=%d;",factor); |
||||
while((thing=fgetc(bob))!=EOF){ |
||||
int i; |
||||
if((fputc(thing,joe))==EOF){ |
||||
perror("fputc(thing,joe)"); |
||||
fputs("problematic\n",stderr); |
||||
return EXIT_FAILURE; |
||||
} |
||||
for(i=0;i<factor;i++){ |
||||
thing=fgetc(moe); |
||||
fputc(thing,joe); |
||||
} |
||||
} |
||||
return 0; |
||||
} |
@ -0,0 +1,46 @@ |
||||
#include <ctype.h> |
||||
#include <stdlib.h> |
||||
#include <stdio.h> |
||||
#include <string.h> |
||||
|
||||
int main (int argc, char **argv){ |
||||
char name[FILENAME_MAX]; |
||||
FILE *bob, *joe; |
||||
int factor, thing; |
||||
char output[FILENAME_MAX]; |
||||
if((bob = fopen(argv[1],"r"))==NULL){ |
||||
fputs("That's no input file, THAT'S A SPACE STATION!\n",stderr); |
||||
return EXIT_FAILURE; |
||||
} |
||||
while(thing != '='){ |
||||
thing=fgetc(bob); |
||||
if(thing==EOF){ |
||||
fputs("You suck! That's not a DPU file!\n",stderr); |
||||
return EXIT_FAILURE; |
||||
} |
||||
} |
||||
factor=0; |
||||
for(;;){ |
||||
thing=fgetc(bob); |
||||
if(isdigit(thing)){ |
||||
factor=(factor*10)+(thing-'0'); |
||||
}else if(thing==';'){ |
||||
break; |
||||
}else{ |
||||
fputs("You should make it work!\n",stderr); |
||||
return EXIT_FAILURE; |
||||
} |
||||
} |
||||
strncpy(output,argv[1],strlen(argv[1])-4); |
||||
if((joe = fopen(output,"w"))==NULL){ |
||||
fputs("Ummm, the output file doesn't work.\n",stderr); |
||||
return EXIT_FAILURE; |
||||
} |
||||
while((thing=fgetc(bob))!=EOF){ |
||||
fputc(thing,joe); |
||||
int i; |
||||
for(i=0;i<factor;i++){ |
||||
thing = fgetc(bob); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue