projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Porting to SunOS 5.8:
[tinc]
/
lib
/
utils.c
diff --git
a/lib/utils.c
b/lib/utils.c
index
795ece9
..
7f588b4
100644
(file)
--- a/
lib/utils.c
+++ b/
lib/utils.c
@@
-21,11
+21,13
@@
#include <sys/types.h>
#include <ctype.h>
#include <string.h>
#include <sys/types.h>
#include <ctype.h>
#include <string.h>
+#include <stdarg.h>
#include "config.h"
#include <utils.h>
#include <syslog.h>
#include "config.h"
#include <utils.h>
#include <syslog.h>
+#include <xalloc.h>
volatile int (cp_line[]) = {0, 0, 0, 0, 0, 0, 0, 0};
volatile char (*cp_file[]) = {"?", "?", "?", "?", "?", "?", "?", "?"};
volatile int (cp_line[]) = {0, 0, 0, 0, 0, 0, 0, 0};
volatile char (*cp_file[]) = {"?", "?", "?", "?", "?", "?", "?", "?"};
@@
-72,3
+74,32
@@
void cp_trace()
cp_file[cp_index], cp_line[cp_index]
);
}
cp_file[cp_index], cp_line[cp_index]
);
}
+
+#ifndef HAVE_ASPRINTF
+int asprintf(char **buf, const char *fmt, ...)
+{
+ int status;
+ va_list ap;
+ int len;
+
+ len = 4096;
+ *buf = xmalloc(len);
+
+ va_start(ap, fmt);
+ status = vsnprintf (*buf, len, fmt, ap);
+ va_end (ap);
+
+ if(status >= 0)
+ *buf = xrealloc(*buf, status);
+
+ if(status > len-1)
+ {
+ len = status;
+ va_start(ap, fmt);
+ status = vsnprintf (*buf, len, fmt, ap);
+ va_end (ap);
+ }
+
+ return status;
+}
+#endif