Commit cfdfb9f1 authored by Ted Lemon's avatar Ted Lemon
Browse files

AIX and Digital Unix compatibility fixes.

parent fb6297b1
......@@ -73,7 +73,7 @@ MINORVERSION=MinorVersion
# removes the comment characters from the appropriate set of
# assignments, and writes the output to Makefile.
## AIX 4.1.5.0
## AIX 4.3
##--aix--
#CF = cf/aix.h
#CC=cc -Daix
......
......@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
"$Id: dns.c,v 1.14 2000/01/26 14:55:34 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
"$Id: dns.c,v 1.15 2000/02/01 03:19:38 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -444,7 +444,8 @@ void dns_packet (protocol)
u_int16_t class;
TIME ttl;
u_int16_t rdlength;
int len, status;
socklen_t len;
int status;
int i;
struct dns_query *query;
......
......@@ -23,7 +23,7 @@
#ifndef lint
static char copyright[] =
"$Id: icmp.c,v 1.17 2000/01/26 14:55:34 mellon Exp $ Copyright (c) 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
"$Id: icmp.c,v 1.18 2000/02/01 03:19:38 mellon Exp $ Copyright (c) 1997, 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -163,7 +163,8 @@ isc_result_t icmp_echoreply (h)
struct sockaddr_in from;
unsigned char icbuf [1500];
int status;
int len, hlen;
socklen_t len;
int hlen;
struct iaddr ia;
struct icmp_state *state;
......@@ -179,7 +180,7 @@ isc_result_t icmp_echoreply (h)
/* Find the IP header length... */
ip = (struct ip *)icbuf;
hlen = ip -> ip_hl << 2;
hlen = IP_HL (ip) << 2;
/* Short packet? */
if (status < hlen + (sizeof *icfrom)) {
......
......@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
"$Id: packet.c,v 1.30 2000/01/29 05:47:50 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: packet.c,v 1.31 2000/02/01 03:19:39 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -125,8 +125,8 @@ void assemble_udp_ip_header (interface, buf, bufix,
struct udphdr udp;
/* Fill out the IP header */
ip.ip_v = 4;
ip.ip_hl = 5;
IP_V_SET (&ip, 4);
IP_HL_SET (&ip, 20);
ip.ip_tos = IPTOS_LOWDELAY;
ip.ip_len = htons(sizeof(ip) + sizeof(udp) + len);
ip.ip_id = 0;
......
......@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
"$Id: parse.c,v 1.60 2000/01/26 14:55:34 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: parse.c,v 1.61 2000/02/01 03:19:39 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -3352,11 +3352,7 @@ int parse_auth_key (key_id, cfile)
return key_id -> len ? 1 : 0;
}
int parse_warn (ANSI_DECL (struct parse *)cfile,
ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
KandR (struct parse *cfile;)
KandR (char *fmt;)
va_dcl
int parse_warn (struct parse *cfile, const char *fmt, ...)
{
va_list list;
static char spaces [] = " ";
......@@ -3374,7 +3370,7 @@ int parse_warn (ANSI_DECL (struct parse *)cfile,
cfile -> tlname, cfile -> lexline, mbuf);
#endif
VA_start (list, fmt);
va_start (list, fmt);
vsnprintf (mbuf, sizeof mbuf, fbuf, list);
va_end (list);
......
......@@ -30,7 +30,7 @@
#ifndef lint
static char copyright[] =
"$Id: socket.c,v 1.43 2000/01/02 22:21:23 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
"$Id: socket.c,v 1.44 2000/02/01 03:19:39 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -213,7 +213,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
struct sockaddr_in *from;
struct hardware *hfrom;
{
int flen = sizeof *from;
socklen_t flen = sizeof *from;
int result;
#ifdef IGNORE_HOSTUNREACH
......@@ -240,7 +240,7 @@ isc_result_t fallback_discard (object)
{
char buf [1540];
struct sockaddr_in from;
int flen = sizeof from;
socklen_t flen = sizeof from;
int status;
struct interface_info *interface;
......
......@@ -68,7 +68,7 @@ depend:
makedepend $(INCLUDES) $(PREDEFINES) $(SRCS)
clean:
-rm -f $(OBJ) test.o test
-rm -f $(OBJ) test.o test cltest.o cltest
realclean: clean
-rm -f libdhcpctl.a *~ $(CATMANPAGES) $(SEDMANPAGES)
......
......@@ -67,9 +67,10 @@ extern int h_errno;
#define _PATH_DHCRELAY_PID "/etc/dhcrelay.pid"
#endif
#include <varargs.h>
#define VA_DOTDOTDOT va_alist
#include <stdarg.h>
#define VA_DOTDOTDOT ...
#define VA_start(list, last) va_start (list)
#define va_dcl
#define vsnprintf(buf, size, fmt, list) vsprintf (buf, fmt, list)
#define NO_SNPRINTF
......
......@@ -21,6 +21,7 @@
*/
#ifndef __CYGWIN32__
#define _POSIX_PII_SOCKET
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
......@@ -997,7 +998,7 @@ int parse_option_token PROTO ((struct expression **, struct parse *,
const char *, struct expression *, int, int));
int parse_allow_deny PROTO ((struct option_cache **, struct parse *, int));
int parse_auth_key PROTO ((struct data_string *, struct parse *));
int parse_warn PROTO ((struct parse *, const char *, ...))
int parse_warn (struct parse *, const char *, ...)
__attribute__((__format__(__printf__,2,3)));
/* tree.c */
......@@ -1519,7 +1520,7 @@ int write_lease PROTO ((struct lease *));
int write_host PROTO ((struct host_decl *));
int write_group PROTO ((struct group_object *));
int db_printable PROTO ((const char *));
int db_printable_len PROTO ((const char *, unsigned));
int db_printable_len PROTO ((const unsigned char *, unsigned));
int write_billing_class PROTO ((struct class *));
int commit_leases PROTO ((void));
void db_startup PROTO ((int));
......
......@@ -49,14 +49,7 @@
* against negative integers quite easily, and fail in subtle ways.
*/
struct ip {
#if BYTE_ORDER == LITTLE_ENDIAN
u_int8_t ip_hl:4, /* header length */
ip_v:4; /* version */
#endif
#if BYTE_ORDER == BIG_ENDIAN
u_int8_t ip_v:4, /* version */
ip_hl:4; /* header length */
#endif
u_int8_t ip_fvhl; /* header length, version */
u_int8_t ip_tos; /* type of service */
int16_t ip_len; /* total length */
u_int16_t ip_id; /* identification */
......@@ -70,6 +63,12 @@ struct ip {
struct in_addr ip_src, ip_dst; /* source and dest address */
};
#define IP_V(iph) ((iph)->ip_fvhl >> 4)
#define IP_HL(iph) ((iph)->ip_fvhl & 0x0F)
#define IP_V_SET(iph,x) ((iph)->ip_fvhl = ((iph)->ip_fvhl & 0x0F) | ((x) << 4))
#define IP_HL_SET(iph,x) ((iph)->ip_fvhl = \
((iph)->ip_fvhl & 0xF0) | ((x) >> 2))
#define IP_MAXPACKET 65535 /* maximum packet size */
/*
......@@ -129,14 +128,7 @@ struct ip_timestamp {
u_int8_t ipt_code; /* IPOPT_TS */
u_int8_t ipt_len; /* size of structure (variable) */
u_int8_t ipt_ptr; /* index of current entry */
#if BYTE_ORDER == LITTLE_ENDIAN
u_int8_t ipt_flg:4, /* flags, see below */
ipt_oflw:4; /* overflow counter */
#endif
#if BYTE_ORDER == BIG_ENDIAN
u_int8_t ipt_oflw:4, /* overflow counter */
ipt_flg:4; /* flags, see below */
#endif
u_int8_t ipt_flg_oflw; /* flags, see below, overflow counter */
union ipt_timestamp {
u_int32_t ipt_time[1];
struct ipt_ta {
......
......@@ -24,6 +24,7 @@
#define __OMAPIP_OMAPIP_P_H__
#ifndef __CYGWIN32__
#define _POSIX_PII_SOCKET
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
......
......@@ -32,6 +32,7 @@ isc_result_t omapi_connect (omapi_object_t *c,
isc_result_t status;
omapi_connection_object_t *obj;
int flag;
socklen_t sl;
obj = (omapi_connection_object_t *)dmalloc (sizeof *obj, MDL);
if (!obj)
......@@ -131,10 +132,10 @@ isc_result_t omapi_connect (omapi_object_t *c,
/* I don't know why this would fail, so I'm tempted not to test
the return value. */
hix = sizeof (obj -> local_addr);
sl = sizeof (obj -> local_addr);
if (getsockname (obj -> socket,
((struct sockaddr *)
&obj -> local_addr), &hix) < 0) {
&obj -> local_addr), &sl) < 0) {
}
if (fcntl (obj -> socket, F_SETFL, O_NONBLOCK) < 0) {
......
......@@ -29,7 +29,7 @@
#ifndef lint
static char copyright[] =
"$Id: errwarn.c,v 1.2 2000/01/26 14:56:05 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: errwarn.c,v 1.3 2000/02/01 03:19:52 mellon Exp $ Copyright (c) 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include <omapip/omapip_p.h>
......@@ -48,15 +48,13 @@ static char fbuf [1024];
/* Log an error message, then exit... */
void log_fatal (ANSI_DECL(const char *) fmt, VA_DOTDOTDOT)
KandR (char *fmt;)
va_dcl
void log_fatal (const char * fmt, ... )
{
va_list list;
do_percentm (fbuf, fmt);
VA_start (list, fmt);
va_start (list, fmt);
vsnprintf (mbuf, sizeof mbuf, fbuf, list);
va_end (list);
......@@ -82,15 +80,13 @@ void log_fatal (ANSI_DECL(const char *) fmt, VA_DOTDOTDOT)
/* Log an error message... */
int log_error (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
KandR (char *fmt;)
va_dcl
int log_error (const char * fmt, ...)
{
va_list list;
do_percentm (fbuf, fmt);
VA_start (list, fmt);
va_start (list, fmt);
vsnprintf (mbuf, sizeof mbuf, fbuf, list);
va_end (list);
......@@ -108,15 +104,13 @@ int log_error (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
/* Log a note... */
int log_info (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
KandR (char *fmt;)
va_dcl
int log_info (const char *fmt, ...)
{
va_list list;
do_percentm (fbuf, fmt);
VA_start (list, fmt);
va_start (list, fmt);
vsnprintf (mbuf, sizeof mbuf, fbuf, list);
va_end (list);
......@@ -134,15 +128,13 @@ int log_info (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
/* Log a debug message... */
int log_debug (ANSI_DECL (const char *) fmt, VA_DOTDOTDOT)
KandR (char *fmt;)
va_dcl
int log_debug (const char *fmt, ...)
{
va_list list;
do_percentm (fbuf, fmt);
VA_start (list, fmt);
va_start (list, fmt);
vsnprintf (mbuf, sizeof mbuf, fbuf, list);
va_end (list);
......
......@@ -125,7 +125,7 @@ int omapi_listener_readfd (omapi_object_t *h)
isc_result_t omapi_accept (omapi_object_t *h)
{
isc_result_t status;
int len;
socklen_t len;
omapi_connection_object_t *obj;
omapi_listener_object_t *listener;
......
......@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
"$Id: confpars.c,v 1.99 2000/01/31 23:41:56 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: confpars.c,v 1.100 2000/02/01 03:19:56 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -423,7 +423,6 @@ int parse_statement (cfile, group, type, host_decl, declaration)
"option space definitions %s",
"may not be scoped.");
skip_to_semi (cfile);
free_option (option, MDL);
break;
}
parse_option_space_decl (cfile);
......@@ -2208,14 +2207,16 @@ struct lease *parse_lease_declaration (cfile)
(&binding -> value.buffer,
binding -> value.len + 1, MDL)))
log_fatal ("No memory for binding.");
strcpy (binding -> value.buffer -> data, val);
strcpy ((char *)
binding -> value.buffer -> data, val);
binding -> value.data =
binding -> value.buffer -> data;
binding -> value.terminated = 1;
} else {
s = (parse_numeric_aggregate
(cfile, (unsigned char *)0,
&binding -> value.len, ':', 16, 8));
s = ((char *)
(parse_numeric_aggregate
(cfile, (unsigned char *)0,
&binding -> value.len, ':', 16, 8)));
if (!s)
return (struct lease *)0;
if (binding -> value.len) {
......
......@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
"$Id: db.c,v 1.42 2000/01/26 14:56:18 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
"$Id: db.c,v 1.43 2000/02/01 03:19:56 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
......@@ -134,7 +134,7 @@ int write_lease (lease)
}
if (lease -> uid_len) {
int i;
if (db_printable_len ((const char *)lease -> uid,
if (db_printable_len (lease -> uid,
lease -> uid_len)) {
fprintf (db_file, "\n uid \"%*s\";",
lease -> uid_len, lease -> uid);
......@@ -290,8 +290,7 @@ int write_host (host)
if (host -> client_identifier.len) {
int i;
errno = 0;
if (db_printable_len ((const char *)
host -> client_identifier.data,
if (db_printable_len (host -> client_identifier.data,
host -> client_identifier.len)) {
fprintf (db_file, "\n uid \"%*s\";",
host -> client_identifier.len,
......@@ -453,7 +452,7 @@ int db_printable (s)
}
int db_printable_len (s, len)
const char *s;
const unsigned char *s;
unsigned len;
{
int i;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment