summaryrefslogtreecommitdiffstats
path: root/configure.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2006-12-14 23:17:27 +0000
committerRoy Marples <roy@marples.name>2006-12-14 23:17:27 +0000
commit262fe7db607e2fe9b7a20d8b8b32760fe4b0d32f (patch)
tree54f1ff1b4b4b60743b5ad05fa9a469f6080292d6 /configure.c
parentfb4477f477d1faa60759f2b94e29c12999e1db49 (diff)
downloaddhcpcd-262fe7db607e2fe9b7a20d8b8b32760fe4b0d32f.tar.xz
Add loads of debugging CFLAGS so we can remove all compiler warnings
Diffstat (limited to 'configure.c')
-rw-r--r--configure.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/configure.c b/configure.c
index 14a4132a..63e0a461 100644
--- a/configure.c
+++ b/configure.c
@@ -26,10 +26,10 @@
#include <arpa/inet.h>
+#include <netinet/in.h>
#ifdef __linux__
#include <netinet/ether.h>
#endif
-#include <netinet/in.h>
#include <string.h>
#include <errno.h>
#include <netdb.h>
@@ -38,6 +38,7 @@
#include <unistd.h>
#include "common.h"
+#include "configure.h"
#include "dhcp.h"
#include "interface.h"
#include "dhcpcd.h"
@@ -48,7 +49,7 @@
static char *cleanmetas (char *cstr)
{
if (! cstr)
- return "";
+ return NULL;
register char *c = cstr;
@@ -60,7 +61,8 @@ static char *cleanmetas (char *cstr)
return cstr;
}
-void exec_script (char *script, char *infofile, char *arg)
+static void exec_script (const char *script, const char *infofile,
+ const char *arg)
{
if (! script || ! infofile || ! arg)
return;
@@ -73,12 +75,8 @@ void exec_script (char *script, char *infofile, char *arg)
return;
}
- char *argc[4];
-
- argc[0] = script;
- argc[1] = infofile;
- argc[2] = arg;
- argc[3] = NULL;
+ char *const argc[4] =
+ { (char *) script, (char *) infofile, (char *) arg, NULL };
logger (LOG_DEBUG, "exec \"%s %s %s\"", script, infofile, arg);
/* We don't wait for the user script to finish - do we trust it? */
@@ -96,7 +94,7 @@ void exec_script (char *script, char *infofile, char *arg)
logger (LOG_ERR, "fork: %s", strerror (errno));
}
-static int make_resolv (char *ifname, dhcp_t *dhcp)
+static int make_resolv (const char *ifname, const dhcp_t *dhcp)
{
FILE *f;
struct stat buf;
@@ -144,7 +142,7 @@ static int make_resolv (char *ifname, dhcp_t *dhcp)
return 0;
}
-static void restore_resolv(char *ifname)
+static void restore_resolv(const char *ifname)
{
struct stat buf;
@@ -153,12 +151,7 @@ static void restore_resolv(char *ifname)
logger (LOG_DEBUG, "removing information from resolvconf");
- char *argc[4];
-
- argc[0] = RESOLVCONF;
- argc[1] = "-d";
- argc[2] = ifname;
- argc[3] = NULL;
+ char *const argc[4] = { (char *) RESOLVCONF, (char *) "-d", (char *) ifname, NULL };
/* Don't wait around here as we should only be called when
dhcpcd is closing down and something may do a kill -9
@@ -177,7 +170,7 @@ static void restore_resolv(char *ifname)
logger (LOG_ERR, "fork: %s", strerror (errno));
}
-static int make_ntp (char *ifname, dhcp_t *dhcp)
+static int make_ntp (const char *ifname, const dhcp_t *dhcp)
{
FILE *f;
address_t *address;
@@ -206,7 +199,7 @@ static int make_ntp (char *ifname, dhcp_t *dhcp)
return 0;
}
-static int make_nis (char *ifname, dhcp_t *dhcp)
+static int make_nis (const char *ifname, const dhcp_t *dhcp)
{
FILE *f;
address_t *address;
@@ -240,7 +233,7 @@ static int make_nis (char *ifname, dhcp_t *dhcp)
return 0;
}
-static int write_info(interface_t *iface, dhcp_t *dhcp)
+static int write_info(const interface_t *iface, const dhcp_t *dhcp)
{
FILE *f;
route_t *route;
@@ -346,7 +339,8 @@ static int write_info(interface_t *iface, dhcp_t *dhcp)
return 0;
}
-int configure (options_t *options, interface_t *iface, dhcp_t *dhcp)
+int configure (const options_t *options, interface_t *iface,
+ const dhcp_t *dhcp)
{
route_t *route = NULL;
route_t *new_route = NULL;