home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d1xx
/
d162
/
iffar.lha
/
Iffar
/
misc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1988-10-02
|
1KB
|
61 lines
/* iffar - IFF CAT archiver miscellaneous functions
By Karl Lehenbauer, version 1.2, release date 5/9/88.
This code is released to the public domain.
See the README file for more information.
*/
#include <ctype.h>
/* strnicmp - case-insensitive strncmp, not provided by manx, this one
* is like lattice's */
char *strnicmp(s1, s2, len)
char *s1, *s2;
int len;
{
char c1, c2;
c1 = *s1;
c2 = *s2;
while (len-->0 && *s1)
{
if (isupper(*s1))
c1 = tolower(*s1);
else
c1 = *s1;
s1++;
if (isupper(*s2))
c2 = tolower(*s2);
else
c2 = *s2;
s2++;
if (c1 != c2)
break;
}
return c1 - c2;
}
/* return the base portion of a file name - needs to be hacked in C style BWTF*/
char *basename(fname)
char *fname;
{
char *basename_ptr;
int i;
int fnamelen = strlen(fname);
basename_ptr = fname;
for (i = fnamelen - 1; i > 0; i--)
{
if (fname[i] == '/' || fname[i] == ':')
{
basename_ptr = &fname[i+1];
break;
}
}
return(basename_ptr);
}
/* end of misc.c */