home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 9
/
FreshFishVol9-CD2.bin
/
bbs
/
util
/
browserii-3.0.lha
/
BrowserII
/
Sources
/
MakeLink.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-02
|
1KB
|
55 lines
/*
* MakeLink.c - Copyright © 1991 by Devil's child.
*
* Created: 26 Nov 1992 21:42:25
* Modified: 02 Oct 1994 11:09:30
*
* Make>> sc <file>.c
* Make>> slink <file>.o SC SD ND BATCH NOICONS TO <file>
*/
#define ARG_FROM 0
#define ARG_TO 1
long _main(void)
{
struct ExecBase *SysBase = *((struct ExecBase **)4L);
struct DosLibrary *DOSBase;
APTR UtilityBase;
char FromPath[256];
struct RDArgs *RA;
char *Argv[] = { NULL, NULL, NULL };
BPTR FromDir, L;
long rc=20;
if (DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 37)) {
UtilityBase = DOSBase->dl_UtilityBase;
if (RA = ReadArgs("From/A,To/A", (long *)Argv, NULL)) {
strcpy(FromPath, Argv[ARG_FROM]);
*PathPart(FromPath) = '\0';
if (FromDir = Lock(FromPath, ACCESS_READ)) {
if (L = Lock(Argv[ARG_TO], ACCESS_READ)) {
if (SameLock(FromDir, L) == LOCK_DIFFERENT) {
if (MakeLink(Argv[ARG_FROM], (long)Argv[ARG_TO], LINK_SOFT))
rc = 0;
}
else {
if (MakeLink(Argv[ARG_FROM], L, LINK_HARD))
rc = 0;
}
UnLock(L);
}
UnLock(FromDir);
}
FreeArgs(RA);
}
if (rc)
PrintFault(IoErr(), "MakeLink");
CloseLibrary((struct Library *)DOSBase);
}
return rc;
}
static const char Ver[] = "$VER:MakeLink 41.0 (01.10.94)";