Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libc: implement vscanf() #87632

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abrarnasirjaffari
Copy link

@abrarnasirjaffari abrarnasirjaffari commented Mar 25, 2025

This pull request implements the vscanf() function in Zephyr's libc. The implementation provides a minimal version by delegating to vfscanf() with stdin as the input stream, in accordance with the C89 standard.

Changes Included:

  • Source Code:
    A new implementation of vscanf() has been added in lib/libc/stdio/vscanf.c:
    /*
     * Copyright The Zephyr Project Contributors
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    #include <stdio.h>
    #include <stdarg.h>
    
    FILE *vscanf(const char *format, va_list args)
    {
        return vfscanf(stdin, format, args);
    }
  • Build System:
    The build configuration in lib/libc/stdio/CMakeLists.txt has been updated to include vscanf.c.

Verification:

  • A pristine build was performed using:
    west build -t pristine -b qemu_x86 samples/hello_world
  • The sample application was run using:
    west build -t run -b qemu_x86 samples/hello_world

Additional Notes:

  • This change addresses issue [#66954](libc: implement vscanf() #66954).
  • The commit message follows Zephyr's commit guidelines, including the necessary Signed-off-by line for DCO compliance.

@DanTGL
Copy link
Contributor

DanTGL commented Mar 26, 2025

  • Add a license header
  • Format the file
  • Sign the commits
  • Make sure every commit passes all of the checks
  • Write a description for the commits
  • Run checks locally before pushing

Please read https://docs.zephyrproject.org/latest/contribute/guidelines.html

@cfriedt
Copy link
Member

cfriedt commented Mar 28, 2025

@abrarnasirjaffari - it looks like the 4 commits should probably be squashed.

libc: update vscanf() implementation for style compliance

Trigger re-run of tests

libc: implement vscanf()

This commit implements the vscanf() function in Zephyr's libc by delegating
to vfscanf() with stdin as the input stream, in accordance with the C89 standard.

Fixes: zephyrproject-rtos#66954
Signed-off-by: Abrar Nasir Jaffari <abrarnasirjaffari@gmail.com>
@abrarnasirjaffari
Copy link
Author

@cfriedt Please help me with the check that is failing. I am not sure how to resolve it. Failing check is Compliance Checks / Run compliance checks on patch series (PR) (pull_request)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: C Library C Standard Library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants