Juan Castillo | 9e75157 | 2014-11-17 17:27:41 +0000 | [diff] [blame] | 1 | /* |
Roberto Vargas | 0571270 | 2018-02-12 12:36:17 +0000 | [diff] [blame] | 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
Juan Castillo | 9e75157 | 2014-11-17 17:27:41 +0000 | [diff] [blame] | 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 | |
Roberto Vargas | 0571270 | 2018-02-12 12:36:17 +0000 | [diff] [blame] | 7 | #include <stdio.h> |
Juan Castillo | 9e75157 | 2014-11-17 17:27:41 +0000 | [diff] [blame] | 8 | #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 | */ |
| 15 | int |
| 16 | sscanf(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 | } |