IBM / portlibfori

A set of APIs to enable applications to be more easily ported to PASE on IBM i
Other
8 stars 7 forks source link

Add asprintf/vasprintf function #15

Closed kadler closed 4 years ago

kadler commented 4 years ago

This is needed by util-linux

https://man7.org/linux/man-pages/man3/asprintf.3.html https://www.freebsd.org/cgi/man.cgi?query=asprintf&apropos=0&sektion=3&manpath=FreeBSD+6.2-RELEASE&format=html

It can be created by wrapping vsnprintf, eg something like this but with error checking:

int size = vsnprintf(NULL, 0, fmt, args);
char* str = malloc(size+1);
vsnprintf(str, size+1, fmt, args);