home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / sarg1221.zip / decomp.c < prev    next >
C/C++ Source or Header  |  2002-06-13  |  1KB  |  62 lines

  1. #include "include/conf.h"
  2.  
  3. void decomp(char *arq, char *zip)
  4. {
  5.  
  6.    char cmd[1024];
  7.  
  8.    if(access(arq, R_OK) != 0) {
  9.       sprintf(cmd,"%s: %s",text[64],arq);
  10.       debuga(cmd);
  11.       exit(1);
  12.    }
  13.  
  14.    if(strstr(arq,".gz") != 0) {
  15.       sprintf(cmd,"%s: %s (gzip)",text[62],arq);
  16.       debuga(cmd);
  17.       sprintf(cmd,"gzip -d %s",arq);
  18.       system(cmd);
  19.       arq[strlen(arq)-3]='\0';
  20.       strcpy(zip,"gzip");
  21.       return;
  22.    }
  23.  
  24.    if(strstr(arq,".Z")) {
  25.       sprintf(cmd,"%s: %s (uncompress)",text[62],arq);
  26.       debuga(cmd);
  27.       sprintf(cmd,"uncompress %s",arq);
  28.       system(cmd);
  29.       arq[strlen(arq)-2]='\0';
  30.       strcpy(zip,"compress");
  31.    }
  32.  
  33.    return;
  34.  
  35. }
  36.  
  37.  
  38. void recomp(char *arq, char *zip) 
  39. {
  40.  
  41.    char cmd[1024];
  42.  
  43.    if(access(arq, R_OK) != 0) {
  44.       sprintf(cmd,"%s: %s",text[64],arq);
  45.       debuga(cmd);
  46.       exit(1);
  47.    }
  48.  
  49.    sprintf(cmd,"%s: %s",text[63],arq);
  50.    debuga(cmd);
  51.  
  52.    if(strcmp(zip,"gzip") == 0)
  53.       sprintf(cmd,"%s %s",zip,arq);    
  54.  
  55.    if(strcmp(zip,"compress") == 0)
  56.       sprintf(cmd,"%s %s",zip,arq);
  57.  
  58.    system(cmd);
  59.    return;
  60.  
  61. }
  62.