From e461123401fa043b7593faf78bc546e94ef58545 Mon Sep 17 00:00:00 2001 From: Silverwizard Date: Thu, 4 Jul 2013 17:23:54 -0400 Subject: [PATCH] upload main project files! --- Progect Goals | 4 ++++ dpu.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ undpu.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100755 Progect Goals create mode 100755 dpu.c create mode 100755 undpu.c diff --git a/Progect Goals b/Progect Goals new file mode 100755 index 0000000..a17dc0c --- /dev/null +++ b/Progect Goals @@ -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. diff --git a/dpu.c b/dpu.c new file mode 100755 index 0000000..aa6fc80 --- /dev/null +++ b/dpu.c @@ -0,0 +1,48 @@ +#include +#include +#include + +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 +#include +#include +#include + +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