Robert Griebl | efd4983 | 2002-07-19 20:27:11 +0000 | [diff] [blame] | 1 | /* |
| 2 | Copyright (C) 2002 Vladimir Oleynik <dzo@simtreas.ru> |
| 3 | */ |
| 4 | |
| 5 | #include <stdlib.h> |
| 6 | #include <stdio.h> |
| 7 | #include <stdarg.h> |
| 8 | |
| 9 | |
Manuel Novoa III | 4d0884a | 2002-09-12 14:52:26 +0000 | [diff] [blame] | 10 | #include "libbb.h" |
Robert Griebl | efd4983 | 2002-07-19 20:27:11 +0000 | [diff] [blame] | 11 | |
| 12 | |
Robert Griebl | efd4983 | 2002-07-19 20:27:11 +0000 | [diff] [blame] | 13 | void bb_asprintf(char **string_ptr, const char *format, ...) |
| 14 | { |
| 15 | va_list p; |
| 16 | |
| 17 | va_start(p, format); |
Manuel Novoa III | 4d0884a | 2002-09-12 14:52:26 +0000 | [diff] [blame] | 18 | if(vasprintf(string_ptr, format, p)<0) |
| 19 | error_msg_and_die(memory_exhausted); |
Robert Griebl | efd4983 | 2002-07-19 20:27:11 +0000 | [diff] [blame] | 20 | va_end(p); |
| 21 | } |