[klibc] add rt_sscanf

cherry-pick from: https://github.com/PetteriAimonen/Baselibc/blob/master/src/vsscanf.c

BSD license
This commit is contained in:
Meco Man
2024-11-25 09:49:23 +08:00
committed by Rbb666
parent b7520e262b
commit 8b4d1c0c5d
8 changed files with 553 additions and 2 deletions
+5 -1
View File
@@ -2,7 +2,6 @@ from building import *
import os
src = Glob('*.c')
src += Glob('klibc/*.c')
cwd = GetCurrentDir()
inc = [os.path.join(cwd, '..', 'include')]
@@ -49,4 +48,9 @@ group = DefineGroup('Kernel', src, depend=[''], CPPPATH=inc,
LINKFLAGS=LINKFLAGS, LOCAL_CFLAGS=LOCAL_CFLAGS,
CPPDEFINES=['__RTTHREAD__'], LOCAL_CPPDEFINES=['__RT_KERNEL_SOURCE__'])
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))
Return('group')
+14
View File
@@ -0,0 +1,14 @@
from building import *
import os
cwd = GetCurrentDir()
src = Glob('*.c')
group = DefineGroup('klibc', src, depend = [''])
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
group = group + SConscript(os.path.join(item, 'SConscript'))
Return('group')
+22
View File
@@ -72,3 +72,25 @@ int rt_sprintf(char *buf, const char *format, ...)
return n;
}
RTM_EXPORT(rt_sprintf);
/**
* @brief This function parses a formatted string from the input string.
*
* @param str the input string to be parsed.
*
* @param format the format string that specifies how to interpret the input.
*
* @return The number of input items successfully matched and assigned.
*/
int rt_sscanf(const char *str, const char *format, ...)
{
va_list ap;
int rv;
va_start(ap, format);
rv = rt_vsscanf(str, format, ap);
va_end(ap);
return rv;
}
RTM_EXPORT(rt_sscanf);
+1 -1
View File
@@ -6,7 +6,7 @@
* Change Logs:
* Date Author Notes
* 2021-11-27 Meco Man porting for rt_vsnprintf as the fully functional version
* 2024-11-19 Meco Man move into rtklibc
* 2024-11-19 Meco Man move to klibc
*/
/**
File diff suppressed because it is too large Load Diff