Porting to SunOS 5.8:
- More #includes Linux doesn't seem to need - Don't do unsetenv() on SunOS - Use a replacement asprintf() in case the OS doesn't support it It now compiles properly under SunOS.
This commit is contained in:
parent
56bd0864e4
commit
f8f1007bf4
4 changed files with 40 additions and 6 deletions
31
lib/utils.c
31
lib/utils.c
|
@ -21,11 +21,13 @@
|
|||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.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[]) = {"?", "?", "?", "?", "?", "?", "?", "?"};
|
||||
|
@ -72,3 +74,32 @@ void cp_trace()
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue