Files
mop3/libaux/mprintf.c
kamkow1 80a728f04b
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m47s
Implement streams IPC mechanism
2026-03-18 22:27:56 +01:00

29 lines
534 B
C

#include <malloc.h>
#include <mprintf.h>
#include <printf.h>
#include <process_self.h>
#include <stdarg.h>
#include <streams.h>
#include <string.h>
#include <system.h>
void mprintf (const char* fmt, ...) {
va_list args;
va_start (args, fmt);
char* buf = malloc (MPRINTF_BUF_MAX);
if (buf == NULL) {
va_end (args);
return;
}
memset (buf, 0, MPRINTF_BUF_MAX);
int len = vsnprintf (buf, MPRINTF_BUF_MAX, fmt, args);
va_end (args);
stream_write (process_get_pgid (), STREAM_OUT, buf, len);
free (buf);
}