/***************************************************************************
* Copyright (C) 2008 by Lorenzo La Porta *
* lorelapo@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include "BitStream.h"
#include "RedundancyTree.h"
#include "Compress.h"
int main(int, char **);
void usage(char *);
void usage(char *name)
{
printf("Welcome to %s\n\n", name
);
printf("%s -[c|d] [input] [output]\n\n", name
);
}
int main(int argc, char *argv[])
{
if(argc<4)
usage(argv[0]);
else
{
switch(argv[1][1])
{
case 'c':
switch(compress(argv[2], argv[3]))
{
case -1:
perror("Problem opening input file : ");
break;
case -2:
perror("Problem opening output file : ");
break;
}
break;
case 'd':
switch(decompress(argv[2], argv[3]))
{
case -1:
perror("Problem opening input file : ");
break;
case -2:
perror("Problem opening output file : ");
break;
}
break;
default:
printf("Undefined option `%s'\n",argv
[1
]);
}
}
return EXIT_SUCCESS;
}