summaryrefslogtreecommitdiff
path: root/src/stdio/scanf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/scanf.c')
-rw-r--r--src/stdio/scanf.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/stdio/scanf.c b/src/stdio/scanf.c
new file mode 100644
index 00000000..5fbe51ec
--- /dev/null
+++ b/src/stdio/scanf.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+#include "stdarg.h"
+#include "nonstd/internal.h"
+#include "nonstd/io.h"
+
+/** read formatted input **/
+int scanf(const char * restrict format, ...)
+{
+ int ret = 0;
+ va_list ap;
+ struct io_options opt = {0};
+ opt.fnname = "scanf";
+ opt.stream = stdout;
+ va_start(ap, format);
+ ret = __scanf(&opt, format, ap);
+ va_end(ap);
+ /*
+ RETURN_SUCCESS(the number of input items assigned);
+ RETURN_FAILURE(CONSTANT(EOF));
+ */
+ return ret;
+}
+
+/***
+reads formatted input from macro(stdin).
+
+FIXME: scanf format goes here
+***/
+/*
+STDC(1)
+*/