about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-11-18 14:25:53 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-11-18 14:25:53 +0100
commit684d67d12ec2be6526088f36c2e83d2820392895 (patch)
tree4d23fb0f4fd667c3a891024caed3a91ca752611e /src
parent8d7683b851980f81bd5776fd02b91737e56d6583 (diff)
downloadbox64-684d67d12ec2be6526088f36c2e83d2820392895.tar.gz
box64-684d67d12ec2be6526088f36c2e83d2820392895.zip
Added wrapped __isoc99_scanf function (for #164)
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/generated/functions_list.txt1
-rw-r--r--src/wrapped/generated/wrappedlibctypes.h1
-rwxr-xr-xsrc/wrapped/wrappedlibc.c8
-rwxr-xr-xsrc/wrapped/wrappedlibc_private.h2
4 files changed, 11 insertions, 1 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 3b5fe1ff..500b289d 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -2453,6 +2453,7 @@ wrappedlibc:
   - sigaltstack
   - swapcontext
 - iFpV:
+  - __isoc99_scanf
   - execl
   - execlp
   - printf
diff --git a/src/wrapped/generated/wrappedlibctypes.h b/src/wrapped/generated/wrappedlibctypes.h
index 834efe64..343e9669 100644
--- a/src/wrapped/generated/wrappedlibctypes.h
+++ b/src/wrapped/generated/wrappedlibctypes.h
@@ -110,6 +110,7 @@ typedef int64_t (*iFpippppp_t)(void*, int64_t, void*, void*, void*, void*, void*
 	GO(execvp, iFpp_t) \
 	GO(sigaltstack, iFpp_t) \
 	GO(swapcontext, iFpp_t) \
+	GO(__isoc99_scanf, iFpV_t) \
 	GO(execl, iFpV_t) \
 	GO(execlp, iFpV_t) \
 	GO(printf, iFpV_t) \
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 91bc50b4..708051d8 100755
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -763,6 +763,14 @@ EXPORT int my___isoc99_fscanf(x64emu_t* emu, void* stream, void* fmt, uint64_t*
 }
 EXPORT int my_fscanf(x64emu_t* emu, void* stream, void* fmt, uint64_t* b) __attribute__((alias("my___isoc99_fscanf")));
 
+EXPORT int my___isoc99_scanf(x64emu_t* emu, void* fmt, uint64_t* b)
+{
+  myStackAlignScanf(emu, (const char*)fmt, b, emu->scratch, 1);
+  PREPARE_VALIST;
+
+  return vscanf(fmt, VARARGS);
+}
+
 EXPORT int my___isoc99_sscanf(x64emu_t* emu, void* stream, void* fmt, uint64_t* b)
 {
   myStackAlignScanf(emu, (const char*)fmt, b, emu->scratch, 2);
diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h
index da0e8fa5..1eb99b3d 100755
--- a/src/wrapped/wrappedlibc_private.h
+++ b/src/wrapped/wrappedlibc_private.h
@@ -920,7 +920,7 @@ GO(__isnanl, iFD)
 GOW(isnanl, iFD)
 GOM(__isoc99_fscanf, iFEppV)
 //GO(__isoc99_fwscanf, iFppV)
-//GO(__isoc99_scanf, iFpV)
+GOM(__isoc99_scanf, iFEpV)
 GOM(__isoc99_sscanf, iFEppV)
 //GO(__isoc99_swscanf, iFppV)
 GOM(__isoc99_vfscanf, iFEppp)