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