home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD1.img
/
d2xx
/
d225
/
amigatcp
/
src
/
misc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-24
|
671b
|
46 lines
/* Miscellaneous machine independent utilities */
#include "machdep.h"
bcmp(a,b,n)
register char *a,*b;
register int16 n;
{
while(n-- != 0){
if(*a++ != *b++)
return 1;
}
return 0;
}
bzero(buf,cnt)
register char *buf;
register int16 cnt;
{
while(cnt-- != 0)
*buf++ = '\0';
}
/* Convert hex-ascii to integer */
int
htoi(s)
char *s;
{
int i = 0;
char c;
while((c = *s++) != '\0'){
if(c == 'x')
continue; /* allow 0x notation */
if('0' <= c && c <= '9')
i = (i * 16) + (c - '0');
else if('a' <= c && c <= 'f')
i = (i * 16) + (c - 'a' + 10);
else if('A' <= c && c <= 'F')
i = (i * 16) + (c - 'A' + 10);
else
break;
}
return i;
}