pinebuds/utils/libc/libc_rom.c

129 lines
3.3 KiB
C
Raw Permalink Normal View History

2022-08-15 04:20:27 -05:00
/***************************************************************************
*
* Copyright 2015-2019 BES.
* All rights reserved. All unpublished rights reserved.
*
* No part of this work may be used or reproduced in any form or by any
* means, or stored in a database or retrieval system, without prior written
* permission of BES.
*
* Use of this work is governed by a license granted by BES.
* This work contains confidential and proprietary information of
* BES. which is protected by copyright, trade secret,
* trademark and other intellectual property rights.
*
****************************************************************************/
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
2022-08-15 04:20:27 -05:00
#include "export_fn_rom.h"
char *strsep(char **stringp, const char *delim) {
return __export_fn_rom.strsep(stringp, delim);
2022-08-15 04:20:27 -05:00
}
char *strtok(char *s, const char *delim) {
static char *lasts;
2022-08-15 04:20:27 -05:00
return strtok_r(s, delim, &lasts);
2022-08-15 04:20:27 -05:00
}
char *strtok_r(char *s, const char *delim, char **lasts) {
return __export_fn_rom.strtok_r(s, delim, lasts);
2022-08-15 04:20:27 -05:00
}
char *strncat(s1, s2, n) char *s1;
const char *s2;
size_t n;
{ return __export_fn_rom.strncat(s1, s2, n); }
2022-08-15 04:20:27 -05:00
int strnicmp(s1, s2, n) const char *s1;
const char *s2;
size_t n;
{ return __export_fn_rom.strnicmp(s1, s2, n); }
2022-08-15 04:20:27 -05:00
char *strstr(s, find) const char *s, *find;
{ return __export_fn_rom.strstr(s, find); }
2022-08-15 04:20:27 -05:00
void *memset(dst0, c0, length) void *dst0;
int c0;
size_t length;
{ return __export_fn_rom.memset(dst0, c0, length); }
2022-08-15 04:20:27 -05:00
void *memcpy(void *dst, const void *src, size_t length) {
return __export_fn_rom.memcpy(dst, src, length);
2022-08-15 04:20:27 -05:00
}
void *memmove(void *dst, const void *src, size_t length) {
return __export_fn_rom.memmove(dst, src, length);
2022-08-15 04:20:27 -05:00
}
int atoi(const char *s) { return __export_fn_rom.atoi(s); }
2022-08-15 04:20:27 -05:00
#ifndef NO_STRTOL
long strtol(const char *nptr, char **endptr, int base) {
return __export_fn_rom.strtol(nptr, endptr, base);
2022-08-15 04:20:27 -05:00
}
#endif
#ifndef NO_STRTOUL
unsigned long strtoul(const char *nptr, char **endptr, int base) {
return __export_fn_rom.strtoul(nptr, endptr, base);
2022-08-15 04:20:27 -05:00
}
#endif
void qsort(void *baseP, size_t nElem, size_t width,
int (*compar)(const void *, const void *)) {
return __export_fn_rom.qsort(baseP, nElem, width, compar);
2022-08-15 04:20:27 -05:00
}
void *bsearch(const void *key, const void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *)) {
return __export_fn_rom.bsearch(key, base, nmemb, size, compar);
2022-08-15 04:20:27 -05:00
}
int sprintf(char *buf, const char *fmt, ...) {
va_list ap;
int len;
2022-08-15 04:20:27 -05:00
va_start(ap, fmt);
len = __export_fn_rom.vsnprintf(buf, -(size_t)buf, fmt, ap);
va_end(ap);
return (len);
2022-08-15 04:20:27 -05:00
}
int snprintf(char *buf, size_t size, const char *fmt, ...) {
va_list ap;
int len;
2022-08-15 04:20:27 -05:00
va_start(ap, fmt);
len = __export_fn_rom.vsnprintf(buf, size, fmt, ap);
va_end(ap);
return (len);
2022-08-15 04:20:27 -05:00
}
int vsprintf(char *buf, const char *fmt, va_list ap) {
return __export_fn_rom.vsprintf(buf, fmt, ap);
2022-08-15 04:20:27 -05:00
}
int vsnprintf(char *buf, size_t size, const char *fmt, va_list ap) {
return __export_fn_rom.vsnprintf(buf, size, fmt, ap);
2022-08-15 04:20:27 -05:00
}
#ifndef NO_VSSCANF
int sscanf(const char *buf, const char *fmt, ...) {
va_list args;
int i;
va_start(args, fmt);
i = __export_fn_rom.vsscanf(buf, fmt, args);
va_end(args);
return i;
2022-08-15 04:20:27 -05:00
}
int vsscanf(const char *fp, const char *fmt0, va_list ap) {
return __export_fn_rom.vsscanf(fp, fmt0, ap);
2022-08-15 04:20:27 -05:00
}
#endif