home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / dm14.lzh / listarc.c < prev    next >
Text File  |  1996-08-31  |  2KB  |  117 lines

  1. /* list an archive's contents */
  2.  
  3. #include <stdio.h>
  4. #include <errno.h>
  5. #include <module.h>
  6. #include "diskmaster.h"
  7.  
  8. int
  9. listarc(filename, outpath)
  10. char *filename;
  11. char *outpath;
  12. {
  13.     char *ext, *rindex();
  14.     mod_exec *modp, *modloadp();
  15.     char pipecmd[32];
  16.     
  17.     ext = rindex(filename,'.');
  18.     
  19.     if ((strucmp(ext,".lzh") == 0) || (strucmp(ext,".lha") == 0)) {
  20.         if ((modp = modloadp("lha",0,NULL)) == NULL) {
  21.             error("Can't load command","LHA",errno);
  22.             return(FAIL);
  23.         }
  24.         
  25.         strcpy(pipecmd,"lha -l ");
  26.         strcat(pipecmd,filename);
  27.         strcat(pipecmd," >>>");
  28.         strcat(pipecmd,outpath);
  29.         strcat(pipecmd,"&");
  30.         system(pipecmd);
  31.         munload("lha",0);
  32.         return(PASS);
  33.     }
  34.     
  35.     if (strucmp(ext,".arc") == 0) {
  36.         if ((modp = modloadp("arc",0,NULL)) == NULL) {
  37.             error("Can't load command","ARC",errno);
  38.             return(FAIL);
  39.         }
  40.         
  41.         strcpy(pipecmd,"arc -l ");
  42.         strcat(pipecmd,filename);
  43.         strcat(pipecmd," >>>");
  44.         strcat(pipecmd,outpath);
  45.         strcat(pipecmd,"&");
  46.         system(pipecmd);
  47.         munload("arc",0);
  48.         return(PASS);
  49.     }
  50.     
  51.     if (strucmp(ext,".zoo") == 0) {
  52.         if ((modp = modloadp("zoo",0,NULL)) == NULL) {
  53.             error("Can't load command","ZOO",errno);
  54.             return(FAIL);
  55.         }
  56.         
  57.         strcpy(pipecmd,"zoo l ");
  58.         strcat(pipecmd,filename);
  59.         strcat(pipecmd," >>>");
  60.         strcat(pipecmd,outpath);
  61.         strcat(pipecmd,"&");
  62.         system(pipecmd);
  63.         munload("zoo",0);
  64.         return(PASS);
  65.     }
  66.     
  67.     if (strucmp(ext,".ar") == 0) {
  68.         if ((modp = modloadp("ar2",0,NULL)) == NULL) {
  69.             error("Can't load command","AR2",errno);
  70.             return(FAIL);
  71.         }
  72.         
  73.         strcpy(pipecmd,"ar2 -t ");
  74.         strcat(pipecmd,filename);
  75.         strcat(pipecmd," >>>");
  76.         strcat(pipecmd,outpath);
  77.         strcat(pipecmd,"&");
  78.         system(pipecmd);
  79.         munload("ar2",0);
  80.         return(PASS);
  81.     }
  82.     
  83.     if (strucmp(ext,".zip") == 0) {
  84.         if ((modp = modloadp("unzip",0,NULL)) == NULL) {
  85.             error("Can't load command","UNZIP",errno);
  86.             return(FAIL);
  87.         }
  88.         
  89.         strcpy(pipecmd,"unzip -l ");
  90.         strcat(pipecmd,filename);
  91.         strcat(pipecmd," >>>");
  92.         strcat(pipecmd,outpath);
  93.         strcat(pipecmd,"&");
  94.         system(pipecmd);
  95.         munload("unzip",0);
  96.         return(PASS);
  97.     }
  98.     
  99.     if (strucmp(ext,".gz") == 0) {
  100.         if ((modp = modloadp("gzip",0,NULL)) == NULL) {
  101.             error("Can't load command","GZIP",errno);
  102.             return(FAIL);
  103.         }
  104.         
  105.         strcpy(pipecmd,"gzip -l ");
  106.         strcat(pipecmd,filename);
  107.         strcat(pipecmd," >>>");
  108.         strcat(pipecmd,outpath);
  109.         strcat(pipecmd,"&");
  110.         system(pipecmd);
  111.         munload("gzip",0);
  112.         return(PASS);
  113.     }
  114. }
  115.  
  116. /* EOF listarc.c */
  117.