home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d09xx
/
d0995.lha
/
WhatIs
/
c
/
BaseName.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-04-05
|
970b
|
43 lines
/*
* BaseName.c - Copyright ⌐ 1992 by Devil's child.
*
* Created: 11 Sep 1992 18:00:25
* Modified: 16 Mar 1993 23:03:31
*
* Make>> sc <file>.c
* Make>> slink <file>.o SC SD ND BATCH NOICONS TO <file>
*/
long BaseName(void)
{
struct ExecBase *SysBase = *((struct ExecBase **)4L);
struct DosLibrary *DOSBase;
APTR UtilityBase;
struct RDArgs *RA;
char *Argv[] = { NULL, NULL, NULL };
UBYTE *s, *suffix;
long suflen, namelen, rc=20;
if (DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 37)) {
UtilityBase = DOSBase->dl_UtilityBase;
if (RA = ReadArgs("Path/A,Suffix", (long *)Argv, NULL)) {
s = FilePart(Argv[0]);
if (Argv[1] && (suflen = strlen(Argv[1])) < (namelen = strlen(s))) {
suffix = &s[namelen - suflen];
if (!Stricmp(suffix, Argv[1]))
*suffix = 0;
}
Printf("%s\n", s);
FreeArgs(RA);
rc = 0;
}
else
PrintFault(IoErr(), "BaseName");
CloseLibrary((struct Library *)DOSBase);
}
return rc;
}