diff --git a/client/clparse.c b/client/clparse.c index c6c8b52c..7f12b3b5 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -22,7 +22,7 @@ #ifndef lint static char copyright[] = -"$Id: clparse.c,v 1.36 1999/10/07 06:35:35 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n"; +"$Id: clparse.c,v 1.37 1999/10/12 16:00:17 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -559,7 +559,7 @@ void parse_option_list (cfile, list) break; } if (i == 256) { - parse_warn (cfile, "%s: expected option name."); + parse_warn (cfile, "%s: expected option name.", val); skip_to_semi (cfile); return; } diff --git a/client/dhclient.c b/client/dhclient.c index 256aa793..4035c87b 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -22,7 +22,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhclient.c,v 1.84 1999/10/07 06:35:36 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.85 1999/10/12 16:00:18 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -673,9 +673,9 @@ void bind_lease (client) add_timeout (client -> active -> renewal, state_bound, client); - log_info ("bound to %s -- renewal in %d seconds.", + log_info ("bound to %s -- renewal in %ld seconds.", piaddr (client -> active -> address), - client -> active -> renewal - cur_time); + (long)(client -> active -> renewal - cur_time)); client -> state = S_BOUND; reinitialize_interfaces (); go_daemon (); @@ -1205,9 +1205,11 @@ void state_panic (cpp) if (cur_time < client -> active -> renewal) { client -> state = S_BOUND; - log_info ("bound: renewal in %d seconds.", - client -> active -> renewal - - cur_time); + log_info ("bound: renewal in %s %ld.", + "seconds", + (long) + (client -> active -> renewal + - cur_time)); add_timeout ((client -> active -> renewal), state_bound, client); @@ -2138,7 +2140,8 @@ char *dhcp_option_ev_name (option) int i; if (strlen (option -> name) + 1 > sizeof evbuf) - log_fatal ("option %s name is larger than static buffer."); + log_fatal ("option %s name is larger than static buffer.", + option -> name); for (i = 0; option -> name [i]; i++) { if (option -> name [i] == '-') evbuf [i] = '_'; diff --git a/common/bpf.c b/common/bpf.c index f6291d7b..39ea4476 100644 --- a/common/bpf.c +++ b/common/bpf.c @@ -22,7 +22,7 @@ #ifndef lint static char copyright[] = -"$Id: bpf.c,v 1.30 1999/10/07 06:47:49 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: bpf.c,v 1.31 1999/10/12 16:00:26 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -227,7 +227,8 @@ void if_register_receive (info) log_fatal ("Can't get bpf buffer length: %m"); info -> rbuf = malloc (info -> rbuf_max); if (!info -> rbuf) - log_fatal ("Can't allocate %d bytes for bpf input buffer."); + log_fatal ("Can't allocate %d bytes for bpf input buffer.", + info -> rbuf_max); info -> rbuf_offset = 0; info -> rbuf_len = 0; diff --git a/common/tree.c b/common/tree.c index 5b5cec6e..ecf9aedc 100644 --- a/common/tree.c +++ b/common/tree.c @@ -22,7 +22,7 @@ #ifndef lint static char copyright[] = -"$Id: tree.c,v 1.59 1999/10/07 06:35:45 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; +"$Id: tree.c,v 1.60 1999/10/12 16:00:27 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -64,7 +64,7 @@ int make_const_option_cache (oc, buffer, data, len, option, name) } if (!option_cache_allocate (oc, name)) { - log_error ("%s: can't allocate option cache."); + log_error ("%s: can't allocate option cache.", name); buffer_dereference (&bp, name); return 0; } @@ -1095,7 +1095,7 @@ int evaluate_data_expression (result, packet, lease, unsigned buflen, i; if (len != 8 && len != 16 && len != 32) { - log_info ("binary_to_ascii: %s %d!", + log_info ("binary_to_ascii: %s %ld!", "invalid width", len); goto b2a_out; } @@ -1104,7 +1104,7 @@ int evaluate_data_expression (result, packet, lease, /* The buffer must be a multiple of the number's width. */ if (other.len % len) { - log_info ("binary-to-ascii: %s %d %s %d!", + log_info ("binary-to-ascii: %s %d %s %ld!", "length of buffer", other.len, "not a multiple of width", len); status = 0; @@ -1211,7 +1211,7 @@ int evaluate_data_expression (result, packet, lease, /* The buffer must be a multiple of the number's width. */ if (other.len % len) { - log_info ("reverse: %s %d %s %d!", + log_info ("reverse: %s %d %s %ld!", "length of buffer", other.len, "not a multiple of width", len); status = 0; diff --git a/includes/cdefs.h b/includes/cdefs.h index f968a806..02fc7fcd 100644 --- a/includes/cdefs.h +++ b/includes/cdefs.h @@ -29,6 +29,12 @@ #if !defined (__ISC_DHCP_CDEFS_H__) #define __ISC_DHCP_CDEFS_H__ +/* Delete attributes if not gcc or not the right version of gcc. */ +#if !defined(__GNUC__) || __GNUC__ < 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ < 5) +#define __attribute__(x) +#endif + #if (defined (__GNUC__) || defined (__STDC__)) && !defined (BROKEN_ANSI) #define PROTO(x) x #define KandR(x) diff --git a/includes/dhcpd.h b/includes/dhcpd.h index f5fbb60d..2c0f5cf0 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h @@ -900,11 +900,16 @@ int hashed_option_space_encapsulate PROTO ((struct data_string *, struct universe *)); /* errwarn.c */ -void log_fatal PROTO ((const char *, ...)); -int log_error PROTO ((const char *, ...)); -int log_info PROTO ((const char *, ...)); -int log_debug PROTO ((const char *, ...)); -int parse_warn PROTO ((struct parse *, const char *, ...)); +void log_fatal PROTO ((const char *, ...)) + __attribute__((__format__(__printf__,1,2))); +int log_error PROTO ((const char *, ...)) + __attribute__((__format__(__printf__,1,2))); +int log_info PROTO ((const char *, ...)) + __attribute__((__format__(__printf__,1,2))); +int log_debug PROTO ((const char *, ...)) + __attribute__((__format__(__printf__,1,2))); +int parse_warn PROTO ((struct parse *, const char *, ...)) + __attribute__((__format__(__printf__,2,3))); /* dhcpd.c */ extern TIME cur_time; diff --git a/server/confpars.c b/server/confpars.c index dec99ab9..0e1c7934 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -22,7 +22,7 @@ #ifndef lint static char copyright[] = -"$Id: confpars.c,v 1.87 1999/10/07 06:36:30 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: confpars.c,v 1.88 1999/10/12 16:00:33 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -445,7 +445,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) if (token == CODE) { if (type != ROOT_GROUP) { parse_warn (cfile, - "option definitions%s%s", + "option definitions%s", " may not be scoped."); skip_to_semi (cfile); free_option (option, @@ -513,7 +513,7 @@ int parse_statement (cfile, group, type, host_decl, declaration) "expecting a declaration"); else parse_warn (cfile, - "expecting a parameter %s" + "expecting a parameter %s", "or declaration"); skip_to_semi (cfile); } @@ -1119,8 +1119,8 @@ void parse_host_declaration (cfile, group) status = enter_host (host, dynamicp, 0); if (status != ISC_R_SUCCESS) - parse_warn (cfile, - "host %s: %s", isc_result_totext (status)); + parse_warn (cfile, "host %s: %s", host -> name, + isc_result_totext (status)); } } diff --git a/server/dhcp.c b/server/dhcp.c index 9a1aabfe..547bed65 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -22,7 +22,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.116 1999/10/08 22:21:34 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.117 1999/10/12 16:00:34 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -978,8 +978,8 @@ void ack_lease (packet, lease, offer, when, msg) oc)) { if (d1.len && packet -> raw -> secs < d1.data [0]) { data_string_forget (&d1, "ack_lease"); - log_info ("%s: %d secs < %d", - packet -> raw -> secs, d1.data [0]); + log_info ("%s: %d secs < %d", msg, + packet -> raw -> secs, d1.data [0]); free_lease_state (state, "ack_lease"); static_lease_dereference (lease, "ack_lease"); return;