Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4972 → Rev 4973

/programs/develop/libraries/menuetlibc/src/libc/compat/string/Makefile
0,0 → 1,4
THIS_SRCS = ffs.s memccpy.c stpcpy.c strcasec.s strdup.c stricmp.c \
strlwr.c strncase.s strnicmp.c strsep.c strupr.c
 
include $(MENUET_LIBC_TOPDIR)/Make.rules
/programs/develop/libraries/menuetlibc/src/libc/compat/string/ffs.s
0,0 → 1,8
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include<libc/asm.h>
MK_C_SYM(ffs)
bsfl 4(%esp), %eax
jnz .Lzero
movl $0,%eax
.Lzero:
ret
/programs/develop/libraries/menuetlibc/src/libc/compat/string/memccpy.c
0,0 → 1,19
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
 
void *
memccpy(void *t, const void *f, int c, size_t n)
{
c &= 0xff;
if (n)
{
unsigned char *tt = (unsigned char *)t;
const unsigned char *ff = (const unsigned char *)f;
 
do {
if ((*tt++ = *ff++) == c)
return tt;
} while (--n != 0);
}
return 0;
}
/programs/develop/libraries/menuetlibc/src/libc/compat/string/stpcpy.c
0,0 → 1,11
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
 
char *
stpcpy(char *_dest, const char *_src)
{
if (!_dest || !_src)
return 0;
while ((*_dest++ = *_src++));
return --_dest;
}
/programs/develop/libraries/menuetlibc/src/libc/compat/string/strcasec.s
0,0 → 1,5
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include<libc/asm.h>
MK_C_SYM(strcasecmp)
jmp C_SYM(stricmp)
 
/programs/develop/libraries/menuetlibc/src/libc/compat/string/strdup.c
0,0 → 1,16
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
#include <stdlib.h>
 
char *
strdup(const char *_s)
{
char *rv;
if (_s == 0)
return 0;
rv = (char *)malloc(strlen(_s) + 1);
if (rv == 0)
return 0;
strcpy(rv, _s);
return rv;
}
/programs/develop/libraries/menuetlibc/src/libc/compat/string/stricmp.c
0,0 → 1,16
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
#include <ctype.h>
 
int
stricmp(const char *s1, const char *s2)
{
while (tolower(*s1) == tolower(*s2))
{
if (*s1 == 0)
return 0;
s1++;
s2++;
}
return (int)tolower(*s1) - (int)tolower(*s2);
}
/programs/develop/libraries/menuetlibc/src/libc/compat/string/strlwr.c
0,0 → 1,15
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <string.h>
 
char *
strlwr(char *_s)
{
char *rv = _s;
while (*_s)
{
*_s = tolower(*_s);
_s++;
}
return rv;
}
/programs/develop/libraries/menuetlibc/src/libc/compat/string/strncase.s
0,0 → 1,5
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include<libc/asm.h>
MK_C_SYM(strncasecmp)
jmp C_SYM(strnicmp)
 
/programs/develop/libraries/menuetlibc/src/libc/compat/string/strnicmp.c
0,0 → 1,18
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
#include <ctype.h>
 
int
strnicmp(const char *s1, const char *s2, size_t n)
{
 
if (n == 0)
return 0;
do {
if (tolower(*s1) != tolower(*s2++))
return (int)tolower(*s1) - (int)tolower(*--s2);
if (*s1++ == 0)
break;
} while (--n != 0);
return 0;
}
/programs/develop/libraries/menuetlibc/src/libc/compat/string/strsep.c
0,0 → 1,32
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
 
char *
strsep(char **stringp, const char *delim)
{
char *s;
const char *spanp;
int c, sc;
char *tok;
 
if ((s = *stringp) == 0)
return 0;
 
tok = s;
while (1)
{
c = *s++;
spanp = delim;
do {
if ((sc = *spanp++) == c)
{
if (c == 0)
s = 0;
else
s[-1] = 0;
*stringp = s;
return tok;
}
} while (sc != 0);
}
}
/programs/develop/libraries/menuetlibc/src/libc/compat/string/strupr.c
0,0 → 1,15
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <string.h>
 
char *
strupr(char *_s)
{
char *rv = _s;
while (*_s)
{
*_s = toupper(*_s);
_s++;
}
return rv;
}