mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-25 14:28:20 +08:00
[klibc] add rt_sscanf
cherry-pick from: https://github.com/PetteriAimonen/Baselibc/blob/master/src/vsscanf.c BSD license
This commit is contained in:
+5
-1
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
@@ -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);
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user