Hzip - hzip.c
Cerca
 











hzip.c

Caricato da: Lorelapo
Scarica il programma completo

  1. /***************************************************************************
  2.  *   Copyright (C) 2008 by Lorenzo La Porta   *
  3.  *   lorelapo@gmail.com   *
  4.  *                                                                         *
  5.  *   This program is free software; you can redistribute it and/or modify  *
  6.  *   it under the terms of the GNU General Public License as published by  *
  7.  *   the Free Software Foundation; either version 2 of the License, or     *
  8.  *   (at your option) any later version.                                   *
  9.  *                                                                         *
  10.  *   This program is distributed in the hope that it will be useful,       *
  11.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
  12.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
  13.  *   GNU General Public License for more details.                          *
  14.  *                                                                         *
  15.  *   You should have received a copy of the GNU General Public License     *
  16.  *   along with this program; if not, write to the                         *
  17.  *   Free Software Foundation, Inc.,                                       *
  18.  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  19.  ***************************************************************************/
  20.  
  21.  
  22. #ifdef HAVE_CONFIG_H
  23. #include <config.h>
  24. #endif
  25.  
  26. #include <stdio.h>
  27. #include <stdlib.h>
  28. #include "BitStream.h"
  29. #include "RedundancyTree.h"
  30. #include "Compress.h"
  31.  
  32. int main(int, char **);
  33.  
  34. void usage(char *);
  35.  
  36. void usage(char *name)
  37. {
  38.         printf("Welcome to %s\n\n", name);
  39.         printf("%s -[c|d] [input] [output]\n\n", name);
  40. }
  41.  
  42. int main(int argc, char *argv[])
  43. {
  44.         if(argc<4)
  45.                 usage(argv[0]);
  46.         else
  47.         {
  48.                 switch(argv[1][1])
  49.                 {
  50.                         case 'c':
  51.                                 switch(compress(argv[2], argv[3]))
  52.                                 {
  53.                                         case -1:
  54.                                                 perror("Problem opening input file : ");
  55.                                                 break;
  56.                                         case -2:
  57.                                                 perror("Problem opening output file : ");
  58.                                                 break;
  59.                                 }
  60.                                 break;
  61.                         case 'd':
  62.                                 switch(decompress(argv[2], argv[3]))
  63.                                 {
  64.                                         case -1:
  65.                                                 perror("Problem opening input file : ");
  66.                                                 break;
  67.                                         case -2:
  68.                                                 perror("Problem opening output file : ");
  69.                                                 break;
  70.                                 }
  71.                                 break;
  72.                         default:
  73.                                 printf("Undefined option `%s'\n",argv[1]);
  74.                 }
  75.         }
  76.         return EXIT_SUCCESS;
  77. }
 

Creative Commons License
Il layout di questo sito è concesso sotto licenza Creative Commons.
Per maggiori informazioni sulle licenze dei contenuti del sito, clicca.