asprintf.c 674 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
  2. *
  3. * GNU Library General Public License (LGPL) version 2 or later.
  4. *
  5. * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
  6. */
  7. #include <features.h>
  8. #ifdef __USE_GNU
  9. #include "_stdio.h"
  10. #include <stdarg.h>
  11. libc_hidden_proto(asprintf)
  12. libc_hidden_proto(vasprintf)
  13. #ifndef __STDIO_HAS_VSNPRINTF
  14. #warning Skipping asprintf and __asprintf since no vsnprintf!
  15. #else
  16. int asprintf(char **__restrict buf, const char * __restrict format, ...)
  17. {
  18. va_list arg;
  19. int rv;
  20. va_start(arg, format);
  21. rv = vasprintf(buf, format, arg);
  22. va_end(arg);
  23. return rv;
  24. }
  25. libc_hidden_def(asprintf)
  26. #endif
  27. #endif