forked from Lephenixnoir/gint
Fix Makefile installation + add some common std functions + add size_t type
This commit is contained in:
parent
01f5f883e7
commit
48709c72e4
|
@ -16,7 +16,8 @@
|
|||
typedef unsigned int uint;
|
||||
/* Signed size_t */
|
||||
typedef signed int ssize_t;
|
||||
|
||||
/* Offset */
|
||||
typedef unsigned int off_t;
|
||||
//---
|
||||
// Structure elements
|
||||
//----
|
||||
|
|
|
@ -157,8 +157,7 @@ install: $(target)
|
|||
install $(target) $(m644) $(PREFIX)
|
||||
install ../$(CONFIG.TARGET.LONG).ld $(m644) $(PREFIX)
|
||||
install -d $(PREFIX)/include/gint
|
||||
cp ../include/gint/*.h $(PREFIX)/include/gint/
|
||||
cp include/gint/*.h $(PREFIX)/include/gint/
|
||||
cp -r ../include/gint/* $(PREFIX)/include/gint/
|
||||
|
||||
uninstall:
|
||||
rm -f $(PREFIX)/$(target)
|
||||
|
|
|
@ -33,3 +33,35 @@ GWEAK int strcmp(char const *s1, char const *s2)
|
|||
while(*s1 && *s1 == *s2) s1++, s2++;
|
||||
return *s1 - *s2;
|
||||
}
|
||||
|
||||
GWEAK char *strchr(const char *s1, int c)
|
||||
{
|
||||
void *ret;
|
||||
int i;
|
||||
|
||||
i = -1;
|
||||
while (s1[++i] != '\0' && s1[i] != c);
|
||||
ret = NULL;
|
||||
if (s1[i] != '\0')
|
||||
ret = (void *)&s1[i];
|
||||
return (ret);
|
||||
}
|
||||
|
||||
GWEAK char *strchrnul(const char *s1, int c)
|
||||
{
|
||||
int i = -1;
|
||||
while (s1[++i] != '\0' && s1[i] != c) ;
|
||||
return ((void *)&s1[i]);
|
||||
}
|
||||
|
||||
GWEAK char *strrchr(const char *s1, int c)
|
||||
{
|
||||
void *saved;
|
||||
|
||||
saved = NULL;
|
||||
for (int i = 0; s1[i] != '\0'; i++) {
|
||||
if (s1[i] == c)
|
||||
saved = (void *)&s1[i];
|
||||
}
|
||||
return (saved);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue