2002-07-19 20:27:11 +00:00
|
|
|
/*
|
2005-09-29 16:18:57 +00:00
|
|
|
Copyright (C) 2002,2005 Vladimir Oleynik <dzo@simtreas.ru>
|
2002-07-19 20:27:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
2002-09-12 14:52:26 +00:00
|
|
|
#include "libbb.h"
|
2002-07-19 20:27:11 +00:00
|
|
|
|
2005-09-29 16:18:57 +00:00
|
|
|
char *bb_xasprintf(const char *format, ...)
|
2002-07-19 20:27:11 +00:00
|
|
|
{
|
2003-03-19 09:13:01 +00:00
|
|
|
va_list p;
|
|
|
|
int r;
|
2005-09-29 16:18:57 +00:00
|
|
|
char *string_ptr;
|
2004-03-15 08:29:22 +00:00
|
|
|
|
2003-03-19 09:13:01 +00:00
|
|
|
va_start(p, format);
|
2005-09-29 16:18:57 +00:00
|
|
|
r = vasprintf(&string_ptr, format, p);
|
2003-03-19 09:13:01 +00:00
|
|
|
va_end(p);
|
2002-07-19 20:27:11 +00:00
|
|
|
|
2003-03-19 09:13:01 +00:00
|
|
|
if (r < 0) {
|
|
|
|
bb_perror_msg_and_die("bb_xasprintf");
|
|
|
|
}
|
2005-09-29 16:18:57 +00:00
|
|
|
return string_ptr;
|
2002-07-19 20:27:11 +00:00
|
|
|
}
|