home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
fish
/
languages
/
northc_384
/
script
/
unpack.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-10
|
2KB
|
87 lines
/* (c) 1990 S.Hawtin.
Permission is granted to copy this file provided
1) It is not used for commercial gain
2) This notice is included in all copies
3) Altered copies are marked as such
No liability is accepted for the contents of the file.
*/
#include "script.h"
/* Unpack file for NorthC */
#define NAME_LEN 128
char ThisDir[NAME_LEN];
char ThisDisk[NAME_LEN];
char *_WBConsole="con:20/20/600/80/Unpack NorthC 1.2";
void
Unpack(dir,name,dest)
char *dir;
char *name;
char *dest;
{/* Unpack a compressed file */
char str[128];
sprintf(str,"\"%sc/lharc\" -x -m -a x \"%s%s\" \"%s\"",
ThisDisk,dir,name,dest);
system(str);
}
void
UnpackSingle(name,dest)
char *name;
char *dest;
{/* Unpack the file "name" on a single drive system */
char from[128];
char to[128];
sprintf(from,"%s%s",ThisDir,name);
sprintf(to,"t:%s",name);
if(copy(from,to)==-1)
{echo("Copy failed");
getchar();
exit(20);
}
Unpack("t:",name,dest);
remove(to);
}
void
main(argc,argv)
int argc;
char **argv;
{/* Unpack the NorthC disks */
int secondDrive;
/* Work out the name of the disk and the directory */
findDirs(ThisDir,ThisDisk,NAME_LEN);
/* Now work out if we have got a second drive */
secondDrive = ask("Have you got a second drive? ");
type("warning");
if(!ask("Do you want to continue? "))
exit(20);
if(secondDrive)
{/* OK do the unpack on a single drive */
Unpack(ThisDir,"NorthC1.lzh","NorthC:");
Unpack(ThisDir,"NorthC2.lzh","NorthC:");
Unpack(ThisDir,"Example1.lzh","NorthC Examples:");
Unpack(ThisDir,"Example2.lzh","NorthC Examples:");
}
else
{
UnpackSingle("NorthC1.lzh","NorthC:");
UnpackSingle("NorthC2.lzh","NorthC:");
UnpackSingle("Example1.lzh","NorthC Examples:");
UnpackSingle("Example2.lzh","NorthC Examples:");
}
echo("All done, please hit <Enter>");
getchar();
}