Juan Castillo | 9e75157 | 2014-11-17 17:27:41 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Juan Castillo | 9e75157 | 2014-11-17 17:27:41 +0000 | [diff] [blame] | 5 | */ |
| 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 | */ |
| 14 | int |
| 15 | sscanf(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 | } |