Last change
on this file since 1402 was 821, checked in by Bruno Cornec, 18 years ago |
Addition of busybox 1.2.1 as a mindi-busybox new package
This should avoid delivering binary files in mindi not built there (Fedora and Debian are quite serious about that)
|
File size:
605 bytes
|
Line | |
---|
1 | /*
|
---|
2 | Copyright (C) 2002,2005 Vladimir Oleynik <dzo@simtreas.ru>
|
---|
3 | */
|
---|
4 |
|
---|
5 | #include <stdlib.h>
|
---|
6 | #include <stdio.h>
|
---|
7 | #include <stdarg.h>
|
---|
8 | #include "libbb.h"
|
---|
9 |
|
---|
10 | char *bb_xasprintf(const char *format, ...)
|
---|
11 | {
|
---|
12 | va_list p;
|
---|
13 | int r;
|
---|
14 | char *string_ptr;
|
---|
15 |
|
---|
16 | #ifdef HAVE_GNU_EXTENSIONS
|
---|
17 | va_start(p, format);
|
---|
18 | r = vasprintf(&string_ptr, format, p);
|
---|
19 | va_end(p);
|
---|
20 | #else
|
---|
21 | va_start(p, format);
|
---|
22 | r = vsnprintf(NULL, 0, format, p);
|
---|
23 | va_end(p);
|
---|
24 | string_ptr = xmalloc(r+1);
|
---|
25 | va_start(p, format);
|
---|
26 | r = vsnprintf(string_ptr, r+1, format, p);
|
---|
27 | va_end(p);
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | if (r < 0) {
|
---|
31 | bb_perror_msg_and_die("bb_xasprintf");
|
---|
32 | }
|
---|
33 | return string_ptr;
|
---|
34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.