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 >
Wrap
Text File
|
1996-08-31
|
2KB
|
117 lines
/* list an archive's contents */
#include <stdio.h>
#include <errno.h>
#include <module.h>
#include "diskmaster.h"
int
listarc(filename, outpath)
char *filename;
char *outpath;
{
char *ext, *rindex();
mod_exec *modp, *modloadp();
char pipecmd[32];
ext = rindex(filename,'.');
if ((strucmp(ext,".lzh") == 0) || (strucmp(ext,".lha") == 0)) {
if ((modp = modloadp("lha",0,NULL)) == NULL) {
error("Can't load command","LHA",errno);
return(FAIL);
}
strcpy(pipecmd,"lha -l ");
strcat(pipecmd,filename);
strcat(pipecmd," >>>");
strcat(pipecmd,outpath);
strcat(pipecmd,"&");
system(pipecmd);
munload("lha",0);
return(PASS);
}
if (strucmp(ext,".arc") == 0) {
if ((modp = modloadp("arc",0,NULL)) == NULL) {
error("Can't load command","ARC",errno);
return(FAIL);
}
strcpy(pipecmd,"arc -l ");
strcat(pipecmd,filename);
strcat(pipecmd," >>>");
strcat(pipecmd,outpath);
strcat(pipecmd,"&");
system(pipecmd);
munload("arc",0);
return(PASS);
}
if (strucmp(ext,".zoo") == 0) {
if ((modp = modloadp("zoo",0,NULL)) == NULL) {
error("Can't load command","ZOO",errno);
return(FAIL);
}
strcpy(pipecmd,"zoo l ");
strcat(pipecmd,filename);
strcat(pipecmd," >>>");
strcat(pipecmd,outpath);
strcat(pipecmd,"&");
system(pipecmd);
munload("zoo",0);
return(PASS);
}
if (strucmp(ext,".ar") == 0) {
if ((modp = modloadp("ar2",0,NULL)) == NULL) {
error("Can't load command","AR2",errno);
return(FAIL);
}
strcpy(pipecmd,"ar2 -t ");
strcat(pipecmd,filename);
strcat(pipecmd," >>>");
strcat(pipecmd,outpath);
strcat(pipecmd,"&");
system(pipecmd);
munload("ar2",0);
return(PASS);
}
if (strucmp(ext,".zip") == 0) {
if ((modp = modloadp("unzip",0,NULL)) == NULL) {
error("Can't load command","UNZIP",errno);
return(FAIL);
}
strcpy(pipecmd,"unzip -l ");
strcat(pipecmd,filename);
strcat(pipecmd," >>>");
strcat(pipecmd,outpath);
strcat(pipecmd,"&");
system(pipecmd);
munload("unzip",0);
return(PASS);
}
if (strucmp(ext,".gz") == 0) {
if ((modp = modloadp("gzip",0,NULL)) == NULL) {
error("Can't load command","GZIP",errno);
return(FAIL);
}
strcpy(pipecmd,"gzip -l ");
strcat(pipecmd,filename);
strcat(pipecmd," >>>");
strcat(pipecmd,outpath);
strcat(pipecmd,"&");
system(pipecmd);
munload("gzip",0);
return(PASS);
}
}
/* EOF listarc.c */