blob: a5876cff3057c51d9cc0d978f15d1ef12bdfc9ca [file] [log] [blame]
Juan Castillo9e751572014-11-17 17:27:41 +00001/*
Roberto Vargas05712702018-02-12 12:36:17 +00002 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
Juan Castillo9e751572014-11-17 17:27:41 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Juan Castillo9e751572014-11-17 17:27:41 +00005 */
6
Roberto Vargas05712702018-02-12 12:36:17 +00007#include <stdio.h>
Juan Castillo9e751572014-11-17 17:27:41 +00008#include <sys/cdefs.h>
9
10/*
11 * TODO: This is not a real implementation of the sscanf() function. It just
12 * returns the number of expected arguments based on the number of '%' found
13 * in the format string.
14 */
15int
16sscanf(const char *__restrict str, char const *__restrict fmt, ...)
17{
18 int ret = 0;
19
20 while (*fmt != '\0') {
21 if (*fmt++ == '%') {
22 ret++;
23 }
24 }
25
26 return ret;
27}