home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
BDSC
/
BDSC-4
/
BDSLIB.ARK
/
STRING.C
< prev
next >
Wrap
Text File
|
1983-07-15
|
1KB
|
87 lines
/*
* string
* This file includes some string functions taken largely from the
* BDS C Standard Library. Some of the functions have been modified
* to force compatibilty with the macros in ctype.h.
* Last Edit 6/6/83
*/
atoi(n)
char *n;
{
int val;
char c;
int sign;
val=0;
sign=1;
while ((c = *n) == '\t' || c== ' ') ++n;
if (c== '-') {
sign = -1;
n++;
}
c = *n;
while (isdigit(c)) {
val = val * 10 + c - '0';
c = *++n;
}
return sign*val;
}
char *
strcat(s1,s2)
char *s1, *s2;
{
char *temp;
temp=s1;
while(*s1) s1++;
do *s1++ = *s2; while (*s2++);
return temp;
}
strcmp(s,t)
char s[], t[];
{
int i;
i = 0;
while (s[i] == t[i])
if (s[i++] == '\0')
return 0;
return s[i] - t[i];
}
char *
strcpy(s1,s2)
char *s1, *s2;
{
char *temp;
temp=s1;
while (*s1++ = *s2++);
return temp;
}
strlen(s)
char *s;
{
int len;
len=0;
while (*s++) len++;
return len;
}
char *
strncpy(s1,s2,n)
char *s1, *s2;
unsigned n;
{
unsigned count;
char *ptr;
ptr = s1;
for (count = 0; count < n; count++)
*s1++ = *s2++;
return ptr;
}