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
|
@ -1,6 +1,6 @@
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
dnl $Id: configure.in,v 1.13.2.14 2000/11/07 22:33:33 guus Exp $
|
dnl $Id: configure.in,v 1.13.2.15 2000/11/08 00:10:49 guus Exp $
|
||||||
|
|
||||||
AC_INIT(src/tincd.c)
|
AC_INIT(src/tincd.c)
|
||||||
AM_INIT_AUTOMAKE(tinc, 1.0pre3)
|
AM_INIT_AUTOMAKE(tinc, 1.0pre3)
|
||||||
|
@ -46,7 +46,7 @@ dnl Checks for library functions.
|
||||||
AC_FUNC_MEMCMP
|
AC_FUNC_MEMCMP
|
||||||
AC_FUNC_ALLOCA
|
AC_FUNC_ALLOCA
|
||||||
AC_TYPE_SIGNAL
|
AC_TYPE_SIGNAL
|
||||||
AC_CHECK_FUNCS(ftime socket select strtol strerror flock)
|
AC_CHECK_FUNCS(ftime socket select strtol strerror flock unsetenv asprintf)
|
||||||
jm_FUNC_MALLOC
|
jm_FUNC_MALLOC
|
||||||
jm_FUNC_REALLOC
|
jm_FUNC_REALLOC
|
||||||
|
|
||||||
|
|
31
lib/utils.c
31
lib/utils.c
|
@ -21,11 +21,13 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <utils.h>
|
#include <utils.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
#include <xalloc.h>
|
||||||
|
|
||||||
volatile int (cp_line[]) = {0, 0, 0, 0, 0, 0, 0, 0};
|
volatile int (cp_line[]) = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
volatile char (*cp_file[]) = {"?", "?", "?", "?", "?", "?", "?", "?"};
|
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
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: net.c,v 1.35.4.68 2000/11/07 21:43:28 guus Exp $
|
$Id: net.c,v 1.35.4.69 2000/11/08 00:10:49 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -25,7 +25,8 @@
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/sockios.h>
|
/* SunOS really wants sys/socket.h BEFORE net/if.h */
|
||||||
|
#include <sys/socket.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
@ -33,7 +34,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/signal.h>
|
#include <sys/signal.h>
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
@ -106,10 +106,12 @@ int execute_script(const char *name)
|
||||||
asprintf(&s, "NETNAME=%s", netname);
|
asprintf(&s, "NETNAME=%s", netname);
|
||||||
putenv(s); /* Don't free s! see man 3 putenv */
|
putenv(s); /* Don't free s! see man 3 putenv */
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_UNSETENV
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsetenv("NETNAME");
|
unsetenv("NETNAME");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
chdir(confbase); /* This cannot fail since we already read config files from this directory. */
|
chdir(confbase); /* This cannot fail since we already read config files from this directory. */
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: tincd.c,v 1.10.4.24 2000/11/03 22:31:55 zarq Exp $
|
$Id: tincd.c,v 1.10.4.25 2000/11/08 00:10:50 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -35,6 +35,7 @@
|
||||||
#include <openssl/rsa.h>
|
#include <openssl/rsa.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <termios.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_IOCTL_H
|
#ifdef HAVE_SYS_IOCTL_H
|
||||||
# include <sys/ioctl.h>
|
# include <sys/ioctl.h>
|
||||||
|
|
Loading…
Reference in a new issue