Compare commits

..

No commits in common. '3a3278f95b56f28679f34e588d1ca9daf333fc72' and 'b1973b15bb79c68e9df039ef38e70168331a1a37' have entirely different histories.

  1. 28
      undpu.c

@ -2,39 +2,23 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <getopt.h>
const char compare_string[] = "DOUBLEPLUS UNZIP, FACTOR=";
int main (int argc, char **argv){
FILE *bob, *joe;
int modifier, factor, thing, i;
int out = 0;
int factor, thing, i;
char output[FILENAME_MAX];
while((modifier=getopt(argc,argv,"c"))+1){
switch(modifier){
case 'c':
joe=stdout;
out = 1;
break;
default:
fprintf(stderr,"modifier=%d\n",modifier);
fputs("You're going to have to be clearer about what you want.\n",stderr);
return EXIT_FAILURE;
}
}
argc-=optind;
argv+=optind;
if(argc < 1){
if(argc < 2){
fputs("I pity the fool who don't have an input file!\n",stderr);
return EXIT_FAILURE;
}
if(strlen(argv[0]) <= 4 || strcmp(argv[0] + strlen(argv[0]) - 4, ".dpu"))
if(strlen(argv[1]) <= 4 || strcmp(argv[1] + strlen(argv[1]) - 4, ".dpu"))
{
fputs("Where's the rest of the filename?\n", stderr);
return EXIT_FAILURE;
}
if((bob = fopen(argv[0],"r"))==NULL){
if((bob = fopen(argv[1],"r"))==NULL){
fputs("That's no input file, THAT'S A SPACE STATION!\n",stderr);
return EXIT_FAILURE;
}
@ -57,13 +41,11 @@ int main (int argc, char **argv){
return EXIT_FAILURE;
}
}
if(!out){
strlcpy(output,argv[0],strlen(argv[0])-4);
strlcpy(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;

Loading…
Cancel
Save