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

added vsprintf() - sprintf with variable arguments list #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,10 @@ int vprintf_(const char* format, va_list va)
return _vsnprintf(_out_char, buffer, (size_t)-1, format, va);
}

int vsprintf_(char* buffer, const char* format, va_list va)
{
return _vsnprintf(_out_buffer, buffer, (size_t)-1, format, va);
}

int vsnprintf_(char* buffer, size_t count, const char* format, va_list va)
{
Expand Down
9 changes: 6 additions & 3 deletions printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,17 @@ int printf_(const char* format, ...);


/**
* Tiny sprintf implementation
* Tiny sprintf/vsprintf implementation
* Due to security reasons (buffer overflow) YOU SHOULD CONSIDER USING (V)SNPRINTF INSTEAD!
* \param buffer A pointer to the buffer where to store the formatted string. MUST be big enough to store the output!
* \param format A string that specifies the format of the output
* \param va A value identifying a variable arguments list
* \return The number of characters that are WRITTEN into the buffer, not counting the terminating null character
*/
#define sprintf sprintf_
int sprintf_(char* buffer, const char* format, ...);
#define sprintf sprintf_
#define vsprintf vsprintf_
int sprintf_(char* buffer, const char* format, ...);
int vsprintf_(char* buffer, const char* format, va_list va);


/**
Expand Down